LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and AcronymsHow to Create a Glossary with a separate List of Acronyms

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
marek_step
Posts: 23
Joined: Sun Aug 19, 2012 8:48 am

How to Create a Glossary with a separate List of Acronyms

Postby marek_step » Sun Jun 29, 2014 7:27 am

Hello all!

Since two weeks I am trying to separate the Acronym list of my Glossary with no avail. Here a minimal example with the name of "acron_test.tex":

  1. \documentclass{article}
  2.  
  3. \usepackage[nomain,xindy,acronym]{glossaries}
  4. \makeglossaries
  5.  
  6. \include{glossary_acron_test}
  7.  
  8. \begin{document}
  9.  
  10. \title{How to Create a Glossary with a separate List of Acronyms}
  11. \date{}
  12. \maketitle
  13.  
  14. \section{Chapter with Glossary}
  15.  
  16. \Gls{earthenware} was burned in \glspl{kiln}.
  17.  
  18. \section{Chapter with Acronyms}
  19.  
  20. Shang period (ca. $16^{th}$ - $11^{th}$ century \gls{bce}) ...
  21.  
  22. The mantou \gls{kiln} (or round kiln), a type traditional in north China, is named for its shape, like a steamed bun. The earliest examples, derived from the primitive cave \glspl{kiln}, were built in the early Shang period (ca. $16^{th}$ - $11^{th}$ century \gls{bce}). It developed into a semi-down-draft kiln in the Tang dynasty (618 - 907 \gls{ace}), and matured in the Song dynasty ( 960 - 1127 \gls{ce}).
  23.  
  24. %Print the glossary
  25. %\printacronyms % not working
  26. \printglossary[type=\acronymtype]
  27. %\printnoidxglossary[type=\acronymtype]
  28.  
  29. Some text between the list of acronyms and the glossary.
  30.  
  31. %\printglossaries
  32. %\printglossary
  33. \printglossary[title=Multilingual Glossary,toctitle=Multilingual Glossary]
  34.  
  35. \end{document}
  36.  


The definition file with acronyms and definitions looks like (name: "glossary_acron_test.tex"):

  1. %Term definitions
  2. \newglossaryentry{kiln}
  3. {
  4. name=kiln,
  5. description={German: Brennofen (m.);\\Français: fourneau (m.)},
  6. plural=kilns
  7. }
  8.  
  9. \newglossaryentry{earthenware}
  10. {
  11. name=earthenware,
  12. description={German: Steingut (n.);\\Français: fa\"{\i}ence (f.)},
  13. plural=earthenwares
  14. }
  15.  
  16. %Acronym definitions:
  17. \newacronym[description={Or if you want ``before Jesus Christ''}]{bce}{BCE}{Before Common Era}
  18.  
  19. \newacronym[description={Or if you want ``after Jesus Christ''}]{ce}{CE}{Common Era}
  20.  
  21. \newacronym[description={Or if you want ``after Jesus Christ'', which is exactly the same as ``CE''}]{ace}{ACE}{After Common Era}


I am running in the shell the following commands over it:

  1. pdflatex acron_test
  2. makeglossaries acron_test
  3. pdflatex acron_test


The result you will see probably too is the same: two times all definitions together - Acronyms with Glossary entries - under the title "Acronyms" and "Multilingual Glossary".

I would be very grateful for a hint.


marek

Tags:

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

Postby Johannes_B » Sun Jun 29, 2014 8:35 pm

The first thing i saw was the use of include which you are not supposed to use. But i think the main reason is the use of nomain. Leave it out and everything works just fine.

Btw: In the example below i splitted the definitions to two files.

I also defined a command for yu to typeset those centuries. It might save you some work. Please compare the output.

Hint: You can click on »Open in Writelatex« ↓ to see the output.
  1. \begin{filecontents}{\jobname Gls.tex}
  2. \newglossaryentry{kiln}
  3. {
  4. name=kiln,
  5. description={German: Brennofen (m.);\\Français: fourneau (m.)},
  6. plural=kilns
  7. }
  8. \newglossaryentry{earthenware}
  9. {
  10. name=earthenware,
  11. description={German: Steingut (n.);\\Français: fa\"{\i}ence (f.)},
  12. plural=earthenwares
  13. }
  14. \end{filecontents}
  15. \begin{filecontents}{\jobname acro.tex}
  16. \newacronym[description={Or if you want ``before Jesus Christ''}]{bce}{BCE}{Before Common Era}
  17. \newacronym[description={Or if you want ``after Jesus Christ''}]{ce}{CE}{Common Era}
  18. \newacronym[description={Or if you want ``after Jesus Christ'', which is exactly the same as ``CE''}]{ace}{ACE}{After Common Era}
  19. \end{filecontents}
  20.  
  21. \documentclass{article}
  22. \usepackage[utf8]{inputenc}
  23. \usepackage[T1]{fontenc}
  24. \usepackage[xindy,acronym]{glossaries}
  25. \makeglossaries
  26. \loadglsentries{\jobname Gls.tex}
  27. \loadglsentries[acronym]{\jobname acro.tex}
  28. \usepackage[super]{nth}
  29. \newcommand{\cent}[1]{\nth{#1}}
  30. \newcommand{\centrange}[2]{\nth{#1}~-- \nth{#2}}
  31.  
  32. \begin{document}
  33.  
  34. \section{Chapter with Glossary}
  35.  
  36. \Gls{earthenware} was burned in \glspl{kiln}.
  37.  
  38. \section{Chapter with Acronyms}
  39.  
  40. Some text to show a line break line break line break line break
  41. (ca. \cent{16}) \centrange{16}{11}
  42. or another period \centrange{8}{4}
  43.  
  44. If you want to have both to stay always on the same line, you
  45. have to change the definition accordingly.
  46.  
  47.  
  48.  
  49. Shang period (ca. $16^{th}$ - $11^{th}$ century \gls{bce}) ...
  50.  
  51. The mantou \gls{kiln} (or round kiln), a type traditional in
  52. north China, is named for its shape, like a steamed bun. The
  53. earliest examples, derived from the primitive cave \glspl{kiln},
  54. were built in the early Shang period (ca. $16^{th}$ - $11^{th}$
  55. century \gls{bce}). It developed into a semi-down-draft kiln in
  56. the Tang dynasty (618 - 907 \gls{ace}), and matured in the Song
  57. dynasty ( 960 - 1127 \gls{ce}).
  58.  
  59. \printglossaries
  60.  
  61. \end{document}


EDIT: It just came to my mind that the macro does not work with 1st, 2nd and 3rd.

EDIT: No problem using the right package ;-)
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

marek_step
Posts: 23
Joined: Sun Aug 19, 2012 8:48 am

Postby marek_step » Mon Jun 30, 2014 12:30 pm

Thank you so much Johannes_B! This was a great help. Although I was confused of the package

  1. \usepackage[super]{nth}
  2. \newcommand{\cent}[1]{\nth{#1}}
  3. \newcommand{\centrange}[2]{\nth{#1}~-- \nth{#2}}


you loaded in your example. Funny, we we need labyrinths for this example - I was thinking ... And your
  1. \begin{filecontents}{\jobname Gls.tex}

was a big surprise. What we can do with LaTeX is amazing :-) But for me, with at least 50 definitions in my glossary, this is too much for the main .tex document. So after some trial and error I finished with this solution - hope this will help some people out there, because I lost nearly two weeks to find it (this is file "acron_test.tex":

  1. \documentclass{article}
  2.  
  3. \usepackage[xindy,acronym]{glossaries}
  4. \makeglossaries
  5. \loadglsentries[main]{glossary_acron_test.tex}
  6.  
  7. \begin{document}
  8.  
  9. \title{How to Create a Glossary with a separate List of Acronyms}
  10. \date{}
  11. \maketitle
  12.  
  13. \section{Chapter with Glossary}
  14.  
  15. \Gls{earthenware} was burned in \glspl{kiln}.
  16.  
  17. \section{Chapter with Acronyms}
  18.  
  19. Shang period (ca. $16^{th}$ - $11^{th}$ century \gls{bce}) ...
  20.  
  21. The mantou \gls{kiln} (or round kiln), a type traditional in north China, is named for its shape, like a steamed bun. The earliest examples, derived from the primitive cave \glspl{kiln}, were built in the early Shang period (ca. $16^{th}$ - $11^{th}$ century \gls{bce}). It developed into a semi-down-draft kiln in the Tang dynasty (618 - 907 \gls{ace}), and matured in the Song dynasty ( 960 - 1127 \gls{ce}).
  22.  
  23. And here we introduce a second ACE: we write the year 2014 \gls{ace} now!
  24.  
  25. \printglossary[type=\acronymtype]
  26.  
  27. \printglossary[title=Multilingual Glossary,toctitle=Multilingual Glossary]
  28.  
  29. \end{document}


And the file "glossary_acron_test.tex" looks like:

  1. %Term definitions
  2. \newglossaryentry{kiln}
  3. {
  4. name=kiln,
  5. description={German: Brennofen (m.);\\Français: fourneau (m.)},
  6. plural=kilns
  7. }
  8.  
  9. \newglossaryentry{earthenware}
  10. {
  11. name=earthenware,
  12. description={German: Steingut (n.);\\Français: fa\"{\i}ence (f.)},
  13. plural=earthenwares
  14. }
  15.  
  16. %Acronym definitions:
  17. \newacronym[description={Or if you want ``before Jesus Christ''}]{bce}{BCE}{Before Common Era}
  18.  
  19. \newacronym[description={Or if you want ``after Jesus Christ''}]{ce}{CE}{Common Era}
  20.  
  21. \newacronym[description={Or if you want ``after Jesus Christ'', which is exactly the same as ``CE''}]{ace}{ACE}{After Common Era}


Run in your shell:

  1. pdflatex acron_test
  2. makeglossaries acron_test
  3. pdflatex acron_test


And that is it! Hurray! :-)

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

Postby Johannes_B » Mon Jun 30, 2014 3:05 pm

Hi Marek, the filecontents environment is just for convenience. A tester has to copy just a single file, LaTeX later extracts them. Have a look in your test folder with my MWE.

BTW: The documentation database is a bit confused (as i was myself). Package nth has nothing to do with labyrinths. :-) I had a look at the package file (nth.sty) and saw the option there.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

marek_step
Posts: 23
Joined: Sun Aug 19, 2012 8:48 am

Postby marek_step » Tue Jul 01, 2014 1:37 pm

Thank you again! I understood later, that



was finding the wrong package. Labyrinth is finishing just with nth ... (But is an interesting package too - so many things to discover!)

Meanwhile I changed all my centuries in my thesis. Very cute :-)

Best greetings from Munich


marek

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

Postby Johannes_B » Tue Jul 01, 2014 2:44 pm

Hi Marek, if you are interested in german support, you should take a look at TeXWelt.de. The format produces precise questions and precise anwsers. You don't have to read long forum threads fully find the solution to a problem.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 2 guests