2

I am currently trying to make a dictionary in LaTeX (using iOS textmaker), and have been using the \usepackage{glossaries}. The issue I am having is that I have to define my entries in the preamble through \newglossaryentry, and it has gotten rather difficult to navigate. I am a big fan of using sections and chapters to keep my document clean and easy to navigate, but this is not an option until I begin my document.

I am wondering if:

  • there is anything analogous the adding sections into my preamble that I can minimize or expand when needed.

  • there is a way to create a separate document/documents where I can define my terms, and import that into my preamble.

I am open to other suggestions too -- let me know what worked for you!

~Breena


Update

Code for main document:

\documentclass{article}
\usepackage{glossaries}.       %allows usage of glossary
\makenoidxglossaries

\loadglsentries{ch1}           %calls for text file (ch1.tex) with definitions
\loadglsentries{ch2}           %%calls for text file (ch2.tex) with definitions

\begin{document}
\gls{word}.                    %will print the name of the word
\printnoidxglossary[sort=word] %prints the glossary using all definitions called for
\end{document}

Code for secondary document with definitions (file name: ch1.tex):

\newglossaryentry{word}{name={word name},description={word definition}}
  • 2
    You might want to use \loadglsentries[<type>]{<filename>} to load an external file that contains the glossary entry definitions as described in section '4.6 Loading Entries From a File' of the glossaries's user manual – leandriis Jan 10 '18 at 21:03
  • You can also put any part of your document into another .tex and say \input{<filename>}. – cfr Jan 11 '18 at 2:42
  • @leandriis Do you want to answer? – cfr Jan 11 '18 at 2:49
1

In order to separate the commands that define your acronyms from the rest of your document, you might want to use \loadglsentries[<type>]{<filename>} to load an external file that contains the glossary entry definitions as described in section '4.6 Loading Entries From a File' of the glossaries's user manual.

Alternatively, you can also use \input to load the file, while the use of \include is discouraged.

If your definition file gets too large, you might as well consider using bib2gls, a 'Java com­mand line ap­pli­ca­tion that can extract glos­sary in­for­ma­tion stored in a .bib file and con­vert it into glos­sary en­try def­i­ni­tion com­mands' in combination with glossaries-extra. To organize the glossary information, jabref, a graph­i­cal fron­tend to man­age BibTeX databases, might come in handy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.