Gallery: Multi-Paragraph Descriptions
In contrast to Brief Descriptions, this example has multi-paragraph descriptions so a less compact style is used, in this case thealtlist
glossary style, which is available by default. This style places a paragraph break between the name and
the description.
The altlist
style uses the description
environment. If you are using a class or package that modifies that environment in a way that’s incompatible with this style, then you may prefer to use one of the tree styles instead.
The usual \newglossaryentry
command doesn’t allow paragraph breaks, so \longnewglossaryentry
is used instead. Be careful of spurious spaces caused by line breaks in the document source code. I’ve used the comment character %
to suppress them.
The comment lines below are arara directives. You can remove them if you don’t use arara.
% arara: pdflatex % arara: makeglossaries % arara: pdflatex \documentclass{report} \usepackage[colorlinks]{hyperref} \usepackage[nopostdot]{glossaries} \makeglossaries \loadglsentries{example-glossaries-multipar} \begin{document} \chapter{Sample} \forglsentries{\thislabel}{\gls{\thislabel}. } \printglossary[style=altlist] \end{document}
This document loads the hyperref package, which
creates hyperlinks from the entries in the document (referenced
using commands like \gls
) to their definition in the
glossary. These hyperlinks are displayed in red text. I’ve used
\forglsentries
for this example to iterate over all the defined
entries. In practice, you would typically just use commands like
\gls{label}
in the text. For example:
Here is a reference to the term \gls{loremi-ii}.
The entries have all been defined in the file example-glossaries-multipar.tex, which you should find installed in the same location as the glossaries package (or in a sub-directory called test-entries). The entry definitions look like this:
\longnewglossaryentry{loremi-ii}{name={lorem 1--2}}% {% Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum. Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a nulla. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis. Pellentesque cursus luctus mauris.% }
If you don’t use arara, you need to run the following commands:
pdflatex multipar-descriptions makeglossaries multipar-descriptions pdflatex multipar-descriptions
(See Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build.)
I’ve used the nopostdot
option
to remove the terminating full stop that is placed by default after
the description. The entries all have a “1” after the description.
This is the page number on which the entry was referenced. In this
sample document all the entries were referenced on page 1.
Download: PDF (47.88K), source code (349B), sample glossary definitions (6.88K).