LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and AcronymsSeveral bugs with glossaries Topic is solved

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

Several bugs with glossaries

Postby nabufe86 » Sun Jul 20, 2014 7:04 am

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:
  1. %%----------Preamble-------------
  2.  
  3. \documentclass[12pt]{article}
  4. \usepackage{amsmath}
  5. \usepackage{datatool}
  6. \usepackage[hidelinks]{hyperref}
  7. \usepackage{glossaries}
  8. \makeglossaries
  9. \author{NA. Bufe}
  10. \title{Some equations}
  11.  
  12.  
  13. \begin{document}
  14.  
  15. %%--------Glossary entries----------
  16. \newglossaryentry{sediflux}{name=\ensuremath{q_s},
  17. description={Unspecified sediment flux per unit width ($m^2$ $s^{-1}$)}}
  18. \newglossaryentry{sediheight}{name=\ensuremath{h_s},
  19. description={Sediment thickness ($m$)}}
  20.  
  21. %%------------Title & TOC----------
  22. \maketitle
  23. \tableofcontents
  24.  
  25.  
  26. %% -------Glossary--------
  27. \setglossarystyle{long3col}
  28. \setlength\LTleft{0pt}
  29. \setlength\LTright{0pt}
  30. \printglossaries[title=Symbols]
  31.  
  32.  
  33. %% -------Section 1--------
  34. \section{Transport limited versus Detachment limited}
  35. \subsection*{Transport limited}
  36. Exner Equation
  37. \begin{equation}
  38. (1- \lambda_p) \frac{\partial \gls{sediheight}}{\partial t} = - \frac{\partial \gls{sediflux}}{\partial x}
  39. \end{equation}
  40.  
  41. \subsection*{Detachment limited}
  42. \begin{equation}
  43. \frac{\partial \gls{sediheight}}{\partial t}=-K\tau_b
  44. \end{equation}
  45. \newpage
  46. \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 175 times

esdd
Posts: 34
Joined: Sat Jan 25, 2014 9:13 pm
Location: Germany

Postby esdd » Sun Jul 20, 2014 12:27 pm

1) Use
  1. \printglossary[title=Symbols]


instead of \printglossaries

2) Define the entries outside the document environment

  1. %%--------Glossary entries----------
  2. \newglossaryentry{sediflux}{type=main,name=\ensuremath{q_s},
  3. description={Unspecified sedimentes flux per unit width ($m^2$ $s^{-1}$)}}
  4. \newglossaryentry{sediheight}{type=main,name=\ensuremath{h_s},
  5. description={Sediment thickness ($m$)}}
  6.  
  7. \begin{document}


3) The width of the description column is governed by the length \glsdescwidth. Use something like

  1. \setlength\glsdescwidth{.8\linewidth}


Best regards
Elke

nabufe86
Posts: 5
Joined: Sat Jul 19, 2014 10:21 pm

Postby nabufe86 » Sun Jul 20, 2014 3:28 pm

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

Thanks a lot

User avatar
Johannes_B
Site Moderator
Posts: 3663
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Jul 20, 2014 5:04 pm

Since i already made a little example:
  1. \iffalse
  2. In the example below i missused the description field to typeset
  3. thee unit. I would not recommend that and rather define a new
  4. style.
  5. The Option xindy uses xindy as the external processor, sorting
  6. your entries.
  7. If an entry is not used, it will not appear in the list.
  8.  
  9. Please be aware, that units are typeset upright. Package siunitx
  10. can be of great help with that.
  11. \fi
  12.  
  13.  
  14. \documentclass[12pt]{article}
  15. \usepackage{amsmath}
  16. \usepackage{siunitx}
  17. \usepackage[nomain,xindy]{glossaries}
  18. \newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname}
  19.  
  20. \newglossaryentry{sediheigthA}{%
  21. name={sediment thickness},
  22. description={m},%Missusing desc here
  23. symbol={\ensuremath{h_{s}}},
  24. type=symbols,
  25. user1=m,
  26. }
  27. \newglossaryentry{waterheightA}{%
  28. name={water depth},
  29. description={m},%Missusing desc here
  30. symbol={\ensuremath{h_{w}}},
  31. type=symbols,
  32. user1=m,
  33. }
  34. \newglossaryentry{nabufe}{%
  35. name={nabufe},
  36. description={a \LaTeX-user},%Missusing desc here
  37. symbol={\ensuremath{\mathit{Na_{Bu}Fe}}},
  38. type=symbols,
  39. }
  40.  
  41. \setglossarystyle{long4col}
  42. \makeglossaries
  43. \let\glsunit\glsuseri
  44.  
  45. \begin{document}
  46.  
  47.  
  48. %\maketitle
  49. %\tableofcontents
  50. %\clearpage%JB: I always recommend clearpage
  51.  
  52. \newcommand{\waterheight}{\ensuremath{h_w}}
  53. \newcommand{\sediheight}{\ensuremath{h_s}}
  54. %JB: Using ensuremmath here
  55.  
  56. \section*{Symbols}
  57. \begin{tabular}{l l}
  58. \waterheight &Water depth ($m$)\\
  59. \sediheight &Sediment thickness ($m$)\\
  60. \end{tabular}
  61.  
  62. \section{using it}
  63. The \gls{waterheightA} is about 30 meters.
  64. \[\glssymbol{waterheightA}=\SI{30}{\meter}\]
  65. Please be aware that units are typeset upright. You can use
  66. package siunitx.
  67.  
  68. The \gls{sediheigthA} \glssymbol{sediheigthA} is given in
  69. \glsunit{sediheigthA}.
  70. \begin{equation}
  71. x+y = \sediheight \ne \waterheight
  72. \end{equation}
  73. \printglossary[type=symbols]
  74. \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

Postby nabufe86 » Sun Jul 20, 2014 5:13 pm

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


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 1 guest