MakeIndex, Nomenclature, Glossaries and AcronymsSeveral bugs with glossaries

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
Post Reply
nabufe86
Posts: 5
Joined: Sat Jul 19, 2014 10:21 pm

Several bugs with glossaries

Post by nabufe86 »

Hi all,

after spending 3h trying to fix this and googling for solutions I give up...

I am using MikTex & Texmaker on a Windows 7 OS.

I use the following code:

Code: Select all

%%----------Preamble-------------

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{datatool}
\usepackage[hidelinks]{hyperref}
\usepackage{glossaries}       
\makeglossaries
\author{NA. Bufe}
\title{Some equations}


\begin{document}

%%--------Glossary entries----------
\newglossaryentry{sediflux}{name=\ensuremath{q_s},
  description={Unspecified sediment flux per unit width ($m^2$ $s^{-1}$)}}
\newglossaryentry{sediheight}{name=\ensuremath{h_s},
  description={Sediment thickness ($m$)}}

%%------------Title & TOC----------
\maketitle
\tableofcontents


%% -------Glossary-------- 
\setglossarystyle{long3col}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\printglossaries[title=Symbols]


%% -------Section 1-------- 
\section{Transport limited versus Detachment limited}
\subsection*{Transport limited}
Exner Equation
\begin{equation}
(1- \lambda_p) \frac{\partial \gls{sediheight}}{\partial t} = - \frac{\partial \gls{sediflux}}{\partial x} 
\end{equation}

\subsection*{Detachment limited}
\begin{equation}
\frac{\partial  \gls{sediheight}}{\partial t}=-K\tau_b
\end{equation}
\newpage
\end{document}
When I generate the pdf everything works sort of fine but there are two weird issues.

1) I cannot add options to \printglossaries. Any options that I add just print out as a normal text (as shown in the example). For the style I got around it by just defining the style using \setglossarystyle but for additional options (such as nonumberlist) that won't work.

2) Once I have a newglossaryentry and then I change a little thing (e.g. change the name or add a word in the description etc.) and then rerun the code, the glossary is not updated and also the references in the text are not updated. For that to happen, I need to delete the entry entirely, rerun and then add the modified entry and rerun. I also checked the .glo file and that file just isn't updated. When I add a new entry, the entry is added fine but all the old entries are not updated when I make small changes to them (even after adding a new entry). Hmm I hope that makes sense.

Finally, as you can see in the example, the longtable of the Glossary wraps the text in one of the center column even though the page is still wide enough so that the text could be in one line. I can fix that using the "long4col" style but that doesn't seem right. Is there any way to increase the size of the middle column in the table?

thanks a lot!
Attachments
test.pdf
(82.67 KiB) Downloaded 382 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
esdd
Posts: 36
Joined: Sat Jan 25, 2014 9:13 pm

Several bugs with glossaries

Post by esdd »

1) Use

Code: Select all

\printglossary[title=Symbols]
instead of \printglossaries

2) Define the entries outside the document environment

Code: Select all

%%--------Glossary entries----------
\newglossaryentry{sediflux}{type=main,name=\ensuremath{q_s},
  description={Unspecified sedimentes flux per unit width ($m^2$ $s^{-1}$)}}
\newglossaryentry{sediheight}{type=main,name=\ensuremath{h_s},
  description={Sediment thickness ($m$)}}
  
\begin{document}
3) The width of the description column is governed by the length \glsdescwidth. Use something like

Code: Select all

\setlength\glsdescwidth{.8\linewidth}
Best regards
Elke
nabufe86
Posts: 5
Joined: Sat Jul 19, 2014 10:21 pm

Re: Several bugs with glossaries

Post by nabufe86 »

Magic... Next time I will ask earlier :D

Thanks a lot
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Several bugs with glossaries

Post by Johannes_B »

Since i already made a little example:

Code: Select all

\iffalse
In the example below i missused the description field to typeset
thee unit. I would not recommend that and rather define a new
style. 
The Option xindy uses xindy as the external processor, sorting
your entries. 
If an entry is not used, it will not appear in the list.

Please be aware, that units are typeset upright. Package siunitx
can be of great help with that. 
\fi


\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage[nomain,xindy]{glossaries}
\newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname}

\newglossaryentry{sediheigthA}{%
	name={sediment thickness},
	description={m},%Missusing desc here
	symbol={\ensuremath{h_{s}}},
	type=symbols,
	user1=m,
}
\newglossaryentry{waterheightA}{%
	name={water depth},
	description={m},%Missusing desc here
	symbol={\ensuremath{h_{w}}},
	type=symbols,
	user1=m,
}
\newglossaryentry{nabufe}{%
	name={nabufe},
	description={a \LaTeX-user},%Missusing desc here
	symbol={\ensuremath{\mathit{Na_{Bu}Fe}}},
	type=symbols,
}

\setglossarystyle{long4col}
\makeglossaries
\let\glsunit\glsuseri

\begin{document}


%\maketitle
%\tableofcontents
%\clearpage%JB: I always recommend clearpage

\newcommand{\waterheight}{\ensuremath{h_w}}
\newcommand{\sediheight}{\ensuremath{h_s}}
%JB: Using ensuremmath here

\section*{Symbols}
\begin{tabular}{l l}
	\waterheight &Water depth ($m$)\\
	\sediheight &Sediment thickness ($m$)\\
\end{tabular}

\section{using it}
The \gls{waterheightA} is about 30 meters.
\[\glssymbol{waterheightA}=\SI{30}{\meter}\]
Please be aware that units are typeset upright. You can use
package siunitx.

The \gls{sediheigthA} \glssymbol{sediheigthA} is given in
\glsunit{sediheigthA}.
\begin{equation}
	x+y = \sediheight \ne \waterheight
\end{equation}
\printglossary[type=symbols]
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
nabufe86
Posts: 5
Joined: Sat Jul 19, 2014 10:21 pm

Re: Several bugs with glossaries

Post by nabufe86 »

Thanks for that. That looks a little more involved then what I have (and will require new packages installed). I will have look sometime!
Post Reply