- Creating a document in ShareLaTeX
- Uploading a project
- Copying a project
- Creating a project from a template
- Including images in ShareLaTeX
- Exporting your work from ShareLaTeX
- Using bibliographies in ShareLaTeX
- Sharing your work with others
- Debugging Compilation timeout errors
- Knowledge Base

- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors

- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Fractions and Binomials
- Aligning Equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts

- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package

- Bibliography management in LaTeX
- Bibliography management with biblatex
- Biblatex bibliography styles
- Biblatex citation styles
- Bibliography management with natbib
- Natbib bibliography styles
- Natbib citation styles
- Bibliography management with bibtex
- Bibtex bibliography styles

- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish

- Sections and chapters
- Table of contents
- Cross referencing sections and equations
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks

- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes

- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typing exams in LaTeX
- Knitr
- Attribute Value Matrices

When writing a document that contain some filed-specific concepts it might be convenient to add a glossary. A glossary is a list of terms in a particular domain of knowledge with definitions for those terms. This article explains how to create one.

## Contents |

Let's start with a simple example.

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{glossaries} \makeglossaries \newglossaryentry{latex} { name=latex, description={Is a mark up language specially suited for scientific documents} } \newglossaryentry{maths} { name=mathematics, description={Mathematics is what mathematicians do} } \title{How to create a glossary} \author{ } \date{ } \begin{document} \maketitle The \Gls{latex} typesetting markup language is specially suitable for documents that include \gls{maths}. \clearpage \printglossaries \end{document}

To create a glossary the package **glossaries** has to be imported. This is accomplished by the line

\usepackage{glossaries}

in the preamble. The command `\makeglossaries`

must be written before the first glossary entry.

Each glossary entry is created by the command `\newglossaryentry`

which takes two parameters, then each entry can be referenced later in the document by the command `gls`

. See the subsection about terms for a more complete description.

The command `\printglossaries`

is the one that will actually render the list of words and definitions typed in each entry, with the title "Glossary". In this case it's shown at the end of the document, but *\printglossaries* can be used in any other location.

Open an example of the glossaries package in ShareLaTeX

Usually there are two types of entries in a glossary: terms and their definitions, or acronyms and their meaning. This two types can be printed separately in your LaTeX document.

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage[acronym]{glossaries} \makeglossaries \newglossaryentry{latex} { name=latex, description={Is a mark up language specially suited for scientific documents} } \newglossaryentry{maths} { name=mathematics, description={Mathematics is what mathematicians do} } \newglossaryentry{formula} { name=formula, description={A mathematical expression} } \newacronym{gcd}{GCD}{Greatest Common Divisor} \newacronym{lcm}{LCM}{Least Common Multiple} \begin{document} The \Gls{latex} typesetting markup language is specially suitable for documents that include \gls{maths}. \Glspl{formula} are rendered properly an easily once one gets used to the commands. Given a set of numbers, there are elementary methods to compute its \acrlong{gcd}, which is abbreviated \acrshort{gcd}. This process is similar to that used for the \acrfull{lcm}. \clearpage \printglossary[type=\acronymtype] \printglossary \end{document}

In the next subsections a detailed description on how to create each one of the lists is provided.

Open an example of the glossaries package in ShareLaTeX

As seen in the introduction, terms are defined by means of the command `\newglossaryentry`

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{glossaries} \makeglossaries \newglossaryentry{maths} { name=mathematics, description={Mathematics is what mathematicians do} } \newglossaryentry{latex} { name=latex, description={Is a mark up language specially suited for scientific documents} } \newglossaryentry{formula} { name=formula, description={A mathematical expression} } \begin{document} The \Gls{latex} typesetting markup language is specially suitable for documents that include \gls{maths}. \Glspl{formula} are rendered properly an easily once one gets used to the commands. \clearpage \printglossary \end{document}

Let's see in more detail the syntax of each parameter passed to the command `\newglossaryentry`

. The first term defined in the example is "mathematics".

`maths`

. This first parameter is the label of this term and is used to reference it within the document with`gls`

`name=mathematics`

. Includes The word to be defined, in this case "mathematics". It's recommended to write it in lowercase letters and singular form.

`description={Mathematics is what mathematicians do}`

. Inside the braces is the definition of the current term.

After you have defined the terms, to use them while you are typing your LaTeX file use one of the commands describe below:

`\gls{ }`

- To print the term, lowercase. For example,
`\gls{maths}`

prints*mathematics*when used.

`\Gls{ }`

- The same as
*\gls*but the first letter will be printed in uppercase. Example:`\Gls{maths}`

prints*Mathematics*

`\glspl{ }`

- The same as
*\gls*but the term is put in its plural form. For instance,`\glspl{formula}`

will write*formulas*in your final document.

`\Glspl{ }`

- The same as
*\Gls*but the term is put in its plural form. For example,`\Glspl{formula}`

renders as*Formulas*.

Finally, to print the glossary use the command

`\printglossary`

Open an example of the glossaries package in ShareLaTeX

An acronym is a word formed from the initial letters in a phrase. Below is an example of acronyms in LaTeX

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage[acronym]{glossaries} \makeglossaries \newacronym{gcd}{GCD}{Greatest Common Divisor} \newacronym{lcm}{LCM}{Least Common Multiple} \begin{document} Given a set of numbers, there are elementary methods to compute its \acrlong{gcd}, which is abbreviated \acrshort{gcd}. This process is similar to that used for the \acrfull{lcm}. \clearpage \printglossary[type=\acronymtype] \end{document}

To use acronyms an additional parameter must be used when importing the **glossaries** package. The line to be added to the preamble is

\usepackage[acronym]{glossaries}

Once this line is added, the command `\newacronym`

will declare a new acronym. For the sake of an example, below is a description of the command `\newacronym{gcd}{GCD}{Greatest Common Divisor}`

`gcd`

is the label, used latter in the document to reference this acronym.

`GCD`

the acronym itself. Usually acronyms are written in capital letters.

`Greatest Common Divisor`

is the phrase this acronym is used for.

After the acronyms have been included in the preamble, they can be used by means on the next commands:

`\acrlong{ }`

- Displays the phrase which the acronyms stands for. Put the label of the acronym inside the braces. In the example,
`\acrlong{gcd}`

prints*Greatest Common Divisor*.

`\acrshort{ }`

- Prints the acronym whose label is passed as parameter. For instance,
`\acrshort{gcd}`

renders as*GCD*.

`\acrfull{ }`

- Prints both, the acronym and its definition. In the example the output of
`\acrfull{lcm}`

is*Least Common Multiple (LCM)*.

To print the list of acronyms use the command

\printglossary[type=\acronymtype]

The acronyms list needs a temporary file generated by `\printglossary`

to work, thereby you must add said command right before the line `\printglossary[type=\acronymtype]`

and compile your document, once you've compiled your document for the first time you can remove the line `\printglossary`

.

Open an example of the glossaries package in ShareLaTeX

If you want to change the default title of the glossary for something else, this is straightforward, two parameters must be added when printing the glossary. Below is an example.

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{glossaries} \makeglossaries \newglossaryentry{maths} { name=mathematics, description={Mathematics is what mathematicians do} } ... [the rest of the example is the one in the sub section "Terms"] \printglossary[title=Special Terms, toctitle=List of terms] \end{document}

Notice that the command `\printglossary`

has two comma-separated parameters:

`title=Special Terms`

is the title to be displayed on top of the glossary.

`toctitle=List of terms`

this is the entry to be displayed in the table of contents. See the next section.

Open an example of the glossaries package in ShareLaTeX

For the glossary to show up in the table of contents put

\usepackage[toc]{glossaries}

in the preamble of your document

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage[toc]{glossaries} \makeglossaries \newglossaryentry{maths} { name=mathematics, description={Mathematics is what mathematicians do} } [...] \begin{document} \tableofcontents \section{First Section} [...] \printglossary \end{document}

Open an example of the glossaries package in ShareLaTeX

To compile a document that contains a glossary in ShareLaTeX you don't have to do anything special, but if you add new terms to the glossary once you compiled it, make sure to click on *Clear cached files* first under logs option).

If you are compiling the document, for instance one called "glossaries.tex", in your local machine, you have to use these commands:

`pdflatex glossaries.tex`

`makeglossaries glossaries`

`pdflatex glossaries.tex`

Open an example of the glossaries package in ShareLaTeX

**Styles available for glossaries**

The command `\glossarystyle{style}`

must be inserted before `\printglossaries`

. Below a list of available styles:

- list. Writes the defined term in boldface font
- altlist. Inserts newline after the term and indents the description.
- listgroup. Group the terms based on the first letter.
- listhypergroup. Adds hyperlinks at the top of the index.

Open an example of the glossaries package in ShareLaTeX

For more information see: