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.
Post Reply
marek_step
Posts: 27
Joined: Sun Aug 19, 2012 8:48 am

How to Create a Glossary with a separate List of Acronyms

Post by marek_step »

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":

Code: Select all


\documentclass{article}

\usepackage[nomain,xindy,acronym]{glossaries}
\makeglossaries
 
\include{glossary_acron_test} 

\begin{document}

\title{How to Create a Glossary with a separate List of Acronyms}
\date{}
\maketitle

\section{Chapter with Glossary}

\Gls{earthenware} was burned in \glspl{kiln}. 
 
\section{Chapter with Acronyms}

Shang period (ca. $16^{th}$ - $11^{th}$ century \gls{bce}) ... 

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}). 
 
%Print the glossary
%\printacronyms % not working
\printglossary[type=\acronymtype]
%\printnoidxglossary[type=\acronymtype]

Some text between the list of acronyms and the glossary.

%\printglossaries
%\printglossary
\printglossary[title=Multilingual Glossary,toctitle=Multilingual Glossary]
 
\end{document}

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

Code: Select all

%Term definitions
\newglossaryentry{kiln}
{
  name=kiln,
  description={German: Brennofen (m.);\\Français: fourneau (m.)},
  plural=kilns
}

\newglossaryentry{earthenware}
{
  name=earthenware,
  description={German: Steingut (n.);\\Français: fa\"{\i}ence (f.)},
  plural=earthenwares
}

%Acronym definitions:
\newacronym[description={Or if you want ``before Jesus Christ''}]{bce}{BCE}{Before Common Era}

\newacronym[description={Or if you want ``after Jesus Christ''}]{ce}{CE}{Common Era}

\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:

Code: Select all

pdflatex acron_test
makeglossaries acron_test
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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How to Create a Glossary with a separate List of Acronyms

Post by Johannes_B »

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.

Code: Select all

\begin{filecontents}{\jobname Gls.tex}
        \newglossaryentry{kiln}
        {
                name=kiln,
                description={German: Brennofen (m.);\\Français: fourneau (m.)},
                plural=kilns
        }
        \newglossaryentry{earthenware}
        {
                name=earthenware,
                description={German: Steingut (n.);\\Français: fa\"{\i}ence (f.)},
                plural=earthenwares
        }
\end{filecontents}
\begin{filecontents}{\jobname acro.tex}
        \newacronym[description={Or if you want ``before Jesus Christ''}]{bce}{BCE}{Before Common Era}
        \newacronym[description={Or if you want ``after Jesus Christ''}]{ce}{CE}{Common Era}
        \newacronym[description={Or if you want ``after Jesus Christ'', which is exactly the same as ``CE''}]{ace}{ACE}{After Common Era}
\end{filecontents}

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[xindy,acronym]{glossaries}
\makeglossaries
\loadglsentries{\jobname Gls.tex}
\loadglsentries[acronym]{\jobname acro.tex}
\usepackage[super]{nth}
\newcommand{\cent}[1]{\nth{#1}}
\newcommand{\centrange}[2]{\nth{#1}~-- \nth{#2}}

\begin{document}

\section{Chapter with Glossary}

\Gls{earthenware} was burned in \glspl{kiln}.

\section{Chapter with Acronyms}

Some text to show a line break line break line break line break
(ca. \cent{16}) \centrange{16}{11} 
or another period \centrange{8}{4}

If you want to have both to stay always on the same line, you
have to change the definition accordingly. 



Shang period (ca. $16^{th}$ - $11^{th}$ century \gls{bce}) ...

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}).

\printglossaries

\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: 27
Joined: Sun Aug 19, 2012 8:48 am

How to Create a Glossary with a separate List of Acronyms

Post by marek_step »

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

Code: Select all

\usepackage[super]{nth}
\newcommand{\cent}[1]{\nth{#1}}
\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

Code: Select all

\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":

Code: Select all

\documentclass{article}

\usepackage[xindy,acronym]{glossaries}
\makeglossaries
\loadglsentries[main]{glossary_acron_test.tex}

\begin{document}

\title{How to Create a Glossary with a separate List of Acronyms}
\date{}
\maketitle

\section{Chapter with Glossary}

\Gls{earthenware} was burned in \glspl{kiln}. 
 
\section{Chapter with Acronyms}

Shang period (ca. $16^{th}$ - $11^{th}$ century \gls{bce}) ... 

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}). 

And here we introduce a second ACE: we write the year 2014 \gls{ace} now!
 
\printglossary[type=\acronymtype]

\printglossary[title=Multilingual Glossary,toctitle=Multilingual Glossary]
 
\end{document}
And the file "glossary_acron_test.tex" looks like:

Code: Select all

%Term definitions
\newglossaryentry{kiln}
{
  name=kiln,
  description={German: Brennofen (m.);\\Français: fourneau (m.)},
  plural=kilns
}

\newglossaryentry{earthenware}
{
  name=earthenware,
  description={German: Steingut (n.);\\Français: fa\"{\i}ence (f.)},
  plural=earthenwares
}

%Acronym definitions:
\newacronym[description={Or if you want ``before Jesus Christ''}]{bce}{BCE}{Before Common Era}

\newacronym[description={Or if you want ``after Jesus Christ''}]{ce}{CE}{Common Era}

\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:

Code: Select all

pdflatex acron_test
makeglossaries acron_test
pdflatex acron_test
And that is it! Hurray! :-)
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How to Create a Glossary with a separate List of Acronyms

Post by Johannes_B »

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: 27
Joined: Sun Aug 19, 2012 8:48 am

How to Create a Glossary with a separate List of Acronyms

Post by marek_step »

Thank you again! I understood later, that

Code: Select all

texdoc nth
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: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How to Create a Glossary with a separate List of Acronyms

Post by Johannes_B »

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