Glossaries package, Multiple glossaries mixing up entries

MWE

\documentclass[11pt]{report} % use larger type; default would be 10pt

\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=blue,
filecolor=blue,
linkcolor=blue,
urlcolor=red
}

\usepackage[nopostdot,acronym,toc,section=chapter,style=indexgroup,nomain]{glossaries}

\newglossary[tld]{type1}{pref1}{ntn}{Title One}
\newglossary[tld]{type2}{pref2}{ntn}{Title Two}
\newglossary[tld]{type3}{pref3}{ntn}{Title Three}
\makeglossaries

\newglossaryentry{pref1:testone}{
type=type1,
name={Testing One},
description={We are Testing One}
}

\newglossaryentry{pref1:testone2}{
type=type1,
name={Testing One Too},
description={We are Testing One as well}
}

\newglossaryentry{pref2:testtwo}{
type=type2,
name={Testing Two},
description={Now we are adding to Two}
}

\newglossaryentry{pref2:testtwo2}{
type=type2,
name={Testing Two Too},
description={Now we are adding to Two too}
}

\newglossaryentry{pref3:testthree}{
type=type3,
name={Testing Three},
description={Finally Three}
}

\newglossaryentry{pref3:testthree2}{
type=type3,
name={Testing Three Too},
description={Finally Three Too}
}

\begin{document}

\gls{pref3:testthree2} and \hfill\\
\gls{pref2:testtwo}

\printglossary[type=type3]
\printglossary[type=type1]
\printglossary[type=type2]

\end{document}


I'm getting three glossaries in the correct order, but:

1. only {pref3:testthree2} is being referenced

2. {pref3:testthree2} is being referenced by ALL types

Command to generate PDF is: PDFlatex + PDFlatex + makeglossaries + makeglossaries + PDFlatex + PDFlatex.

Any help would be greatly appreciated!

• You've used the same file extension ntn for each glossary. Change them to {ntn1}, {ntn2} and {ntn3} and retry. Aug 3, 2016 at 17:16
• Excellent, thank you. Can you change your comment to an answer so I can tick it as solved? Aug 3, 2016 at 18:26

1 Answer

The problem is that you've used the same file extension for each glossary. This means they're being overwritten by makeindex and the same file is being read for each \printglossary.

Here's your edited MWE:

\documentclass[11pt]{report}

\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=blue,
filecolor=blue,
linkcolor=blue,
urlcolor=red
}

\usepackage[nopostdot,acronym,toc,section=chapter,style=indexgroup,nomain]{glossaries}

\newglossary[tld]{type1}{pref1}{ntn1}{Title One}
\newglossary[tld]{type2}{pref2}{ntn2}{Title Two}
\newglossary[tld]{type3}{pref3}{ntn3}{Title Three}
\makeglossaries

\newglossaryentry{pref1:testone}{
type=type1,
name={Testing One},
description={We are Testing One}
}

\newglossaryentry{pref1:testone2}{
type=type1,
name={Testing One Too},
description={We are Testing One as well}
}

\newglossaryentry{pref2:testtwo}{
type=type2,
name={Testing Two},
description={Now we are adding to Two}
}

\newglossaryentry{pref2:testtwo2}{
type=type2,
name={Testing Two Too},
description={Now we are adding to Two too}
}

\newglossaryentry{pref3:testthree}{
type=type3,
name={Testing Three},
description={Finally Three}
}

\newglossaryentry{pref3:testthree2}{
type=type3,
name={Testing Three Too},
description={Finally Three Too}
}

\begin{document}

\gls{pref3:testthree2} and \hfill\\
\gls{pref2:testtwo}

\printglossary[type=type3]
\printglossary[type=type1]
\printglossary[type=type2]

\end{document}


An alternative is to use the starred form of \newglossary which constructs the extensions from the glossary label. For example

\newglossary*{type1}{Title One}


is equivalent to

\newglossary[type1-glg]{type1}{type1-gls}{type1-glo}{Title One}


This can be useful if you have a lot of glossaries as then you don't have to keep track of all the extensions. Since the glossary label has to be unique, this will ensure that the glossary file extensions don't clash with each other.

Updated MWE:

\documentclass[11pt]{report}

\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=blue,
filecolor=blue,
linkcolor=blue,
urlcolor=red
}

\usepackage[nopostdot,acronym,toc,section=chapter,style=indexgroup,nomain]{glossaries}

\newglossary*{type1}{Title One}
\newglossary*{type2}{Title Two}
\newglossary*{type3}{Title Three}
\makeglossaries

\newglossaryentry{pref1:testone}{
type=type1,
name={Testing One},
description={We are Testing One}
}

\newglossaryentry{pref1:testone2}{
type=type1,
name={Testing One Too},
description={We are Testing One as well}
}

\newglossaryentry{pref2:testtwo}{
type=type2,
name={Testing Two},
description={Now we are adding to Two}
}

\newglossaryentry{pref2:testtwo2}{
type=type2,
name={Testing Two Too},
description={Now we are adding to Two too}
}

\newglossaryentry{pref3:testthree}{
type=type3,
name={Testing Three},
description={Finally Three}
}

\newglossaryentry{pref3:testthree2}{
type=type3,
name={Testing Three Too},
description={Finally Three Too}
}

\begin{document}

\gls{pref3:testthree2} and \hfill\\
\gls{pref2:testtwo}

\printglossary[type=type3]
\printglossary[type=type1]
\printglossary[type=type2]

\end{document}

• This is perfect. \makeglossaries only needs to be called once, right? Aug 4, 2016 at 19:44
• Also, I can do away with the prefixes too right? As long as I specify the type Aug 4, 2016 at 19:46
• @tetris11 Only one \makeglossaries is needed in the document and only one makeglossaries system call to process all three glossaries. For prefixes, do you mean the prefix to the labels? All labels must be unique across all glossaries, so prefixes are useful to avoid label clashes (for example, pref1:testone and pref2:testone). You can't have both a testone in type1 and a testone in type2, but you can have a testone1 in type1 and a testone2 in type2. Aug 4, 2016 at 20:07