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.
Post Reply
aluaces
Posts: 3
Joined: Fri May 15, 2020 1:41 pm

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

Post by aluaces »

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

\documentclass[12pt,a4paper,twoside]{book}

\usepackage{siunitx}
\usepackage[acronym,toc,nonumberlist,nogroupskip]{glossaries}
\usepackage[spanish,es-nosectiondot,es-tabla]{babel}

\newglossary[slg]{symbolslist}{syi}{syg}{Simbolos}

\glsaddkey{descripES}{}{\glsentrydescripES}{\GLsentrydescripES}{\glsdescripES}{\GlsdescripES}{\GLSdescripES}
\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}

\makeglossaries

\newglossaryentry{ap}{unit={\si{mm}}, name={\ensuremath{z_p}},
description={2}, type=symbolslist, descripES={mi desc}}

\newglossarystyle{symbunitlong}{ \setglossarystyle{long3col}
\renewenvironment{theglossary}{
  \begin{longtable}{lp{0.6\glsdescwidth}>{\centering\arraybackslash}p{2cm}}}
{\end{longtable}}

\renewcommand*{\glossaryheader}{ \bfseries Sign & \bfseries
Description & \bfseries Unit \\ \hline \endhead}
\renewcommand*{\glossentry}[2]{ \glstarget{##1}{\glossentryname{##1}}
& \glsdescripES{##1} & \glsunit{##1} \tabularnewline } }


\begin{document}

\frontmatter \printglossary[type=symbolslist, style=symbunitlong]

\mainmatter

\glsunit{ap} \gls{ap}

\backmatter

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
Bartman
Posts: 366
Joined: Fri Jan 03, 2020 2:39 pm

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

Post by Bartman »

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

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

Post by aluaces »

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

\glssetnoexpandfield{descripES}
\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

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

Post by aluaces »

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!
Post Reply