15

Is there any way around to create glossary entries in separate file? I do prefer to store glossary entries in a separate file.

Thanks for any comment.

  • 1
    Welcome to TeX.SX! You can store \newglossaryentry - definitions in a separate file, say, foo.tex and use \input{foo} or \loadglsentries{foo} –  Jan 11 '16 at 12:53
  • I have answered your question -- please accept it. –  Mar 07 '18 at 06:55

2 Answers2

19

The \loadglsentries[type]{file name} command should be used for external definitions, since this allows for selecting specific glossary types (only useful for more than one glossary, however).

\documentclass{article}

\usepackage{glossaries}

\makeglossaries
\loadglsentries{foo}
\begin{document}

\gls{foobar} is a strange animal

\gls{foo} is another strange animal
\printglossaries

\end{document}

The foo.tex file contains the glossary definitions:

\newglossaryentry{foobar}{%
  name={Foobar},
  description={A strange animal, not to be confused with \gls{foo}}
}

\newglossaryentry{foo}{%
  name={Foo},
  description={A strange animal, not to be confused with \gls{foobar}}
}

enter image description here

0

I gave up on \loadglsentries with a memoir document class. Instead, create pages/foo.sty with your glossary entries:

\documentclass{article}

\usepackage{glossaries}

\makeglossaries
\usepackage{pages/foo}
\begin{document}

\gls{foobar} is a strange animal

\gls{foo} is another strange animal
\printglossaries

\end{document}
Aaron
  • 103
  • 5