LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and AcronymsERROR: Missing number, treated as zero when defining a custom glossary

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
aluaces
Posts: 3
Joined: Fri May 15, 2020 1:41 pm

ERROR: Missing number, treated as zero when defining a custom glossary

Postby aluaces » Fri May 15, 2020 1:51 pm

Hi, I have reduced my problem with a customized glossary to a minimal example.

I get some errors of the following type when using my glossary.

ERROR: Missing number, treated as zero.

--- TeX said ---
<to be read again>
\gls@numberpage
l.5 ...etentrycounter[]{page}\glsnumberformat{1}}}


If I take out either the \frontmatter line or the \usepackage[...]{babel}, no errors are shown.

Thanks!

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[12pt,a4paper,twoside]{book}
  2.  
  3. \usepackage{siunitx}
  4. \usepackage[acronym,toc,nonumberlist,nogroupskip]{glossaries}
  5. \usepackage[spanish,es-nosectiondot,es-tabla]{babel}
  6.  
  7. \newglossary[slg]{symbolslist}{syi}{syg}{Simbolos}
  8.  
  9. \glsaddkey{descripES}{}{\glsentrydescripES}{\GLsentrydescripES}{\glsdescripES}{\GlsdescripES}{\GLSdescripES}
  10. \glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}
  11.  
  12. \makeglossaries
  13.  
  14. \newglossaryentry{ap}{unit={\si{mm}}, name={\ensuremath{z_p}},
  15. description={2}, type=symbolslist, descripES={mi desc}}
  16.  
  17. \newglossarystyle{symbunitlong}{ \setglossarystyle{long3col}
  18. \renewenvironment{theglossary}{
  19. \begin{longtable}{lp{0.6\glsdescwidth}>{\centering\arraybackslash}p{2cm}}}
  20. {\end{longtable}}
  21.  
  22. \renewcommand*{\glossaryheader}{ \bfseries Sign & \bfseries
  23. Description & \bfseries Unit \\ \hline \endhead}
  24. \renewcommand*{\glossentry}[2]{ \glstarget{##1}{\glossentryname{##1}}
  25. & \glsdescripES{##1} & \glsunit{##1} \tabularnewline } }
  26.  
  27.  
  28. \begin{document}
  29.  
  30. \frontmatter \printglossary[type=symbolslist, style=symbunitlong]
  31.  
  32. \mainmatter
  33.  
  34. \glsunit{ap} \gls{ap}
  35.  
  36. \backmatter
  37.  
  38. \end{document}

Bartman
Posts: 68
Joined: Fri Jan 03, 2020 2:39 pm

Postby Bartman » Fri May 15, 2020 2:50 pm

I will only receive your error message, if I eliminate the cause of another one beforehand. It is avoided by suppressing the expansion of your custom key unit. Read section 4.4 Expansion for an explanation.

You get your error message because you use the commands \glsdescripES and \glsunit when changing \glossentry instead of \glsentrydescripES and \glsentryunit.

You may be interested in the automake option of the glossaries package.

Off topic remark: The default setting for the document class is two-sided.

aluaces
Posts: 3
Joined: Fri May 15, 2020 1:41 pm

Postby aluaces » Fri May 15, 2020 5:12 pm

Thanks for your time, Bartman!

With respect to reproducing the issue, I tried to see if I could replicate it on overleaf, but I could not be able to trigger the indexing, both as is or with automake present.

I tried to use both

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \glssetnoexpandfield{descripES}
  2. \glssetnoexpandfield{unit}


and \glsnoexpandfields to no avail, before and after the calls to \glsaddkey.

I can make it work by using no external indexing at all, using \makenoidxglossaries and \printnoidxglossaries, at least for the MWE posted.

aluaces
Posts: 3
Joined: Fri May 15, 2020 1:41 pm

Postby aluaces » Fri May 15, 2020 5:28 pm

Bartman wrote:You get your error message because you use the commands \glsdescripES and \glsunit when changing \glossentry instead of \glsentrydescripES and \glsentryunit.


Sorry, I don't know how I could misread your post so badly. Of course using "entry" solves the problem, thanks a lot!


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 1 guest