# Adding a glossary with ShareLaTeX

I'm trying to add a glossary to an article in ShareLaTeX but It seems the whole \makeglossariescommand doesn't work if you don't use the makeglossaries document_namewhen compiling (as it says here).

Is there any way to force the compiler to execute that (I mean the shareLaTeX online compiler)?

EDIT:

6 days ago, I received a newsletter from the ShareLaTeX team where they explain the latest additions they've made into their compiler; among which is the possibility of use the glossaries package, without shell-calling makeglossaries so I gave it a try:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{glossaries}
\title{EjGlos}
\newglossaryentry{bitcoin}
{
name=Bitcoin,
description={(\btc)  is a peer-to-peer payment system and digital currency introduced as open source software in 2009 by pseudonymous developer Satoshi Nakamoto. It is a cryptocurrency, so-called because it uses cryptography to control the creation and transfer of money}
}
\makeglossaries
\begin{document}
\maketitle
\section{How does Bitcoin work?}
From a user perspective, \gls{bitcoin} is nothing more than a mobile app or computer program that provides a personal Bitcoin wallet and allows a user to send and receive bitcoins with them. This is how Bitcoin works for most users.
\printglossaries
\end{document}


And it seems to work properly:

• Does sharelatex enable --shell-escape (it would be a security leak)? You can invoke system commands from your .tex file with: \immediate\write18{makeglossaries \jobname} but --shell-escape needs to be on. Apr 24, 2013 at 22:17
• I don't know what sharelatex is, but you can run makindex for all your glossaries, you just need to give it the right command sequence. See the manual for that. It is explained there. If you have three glossaries, for instance, you need three runs of makeindex with different arguments. It is just more manual work to type all these, hence the perl script makeglossaries. Just a simplification... Apr 24, 2013 at 22:34
• Welcome to TeX.sx! Apr 24, 2013 at 22:44
• sharelatex is an online collaboration tool for writing latex documents. After some online research, I doubt it has --shell-escape enabled. You could run makeglossaries command on your computer and add the resulting file in your sharelatex folder. Also suggest sharelatex to add glossaries feature. Apr 24, 2013 at 22:50
• @remus thank you! I think I'm gonna write down to the guys behind ShareLaTeX to ask them to implement this "feature" in next versions of the editor; also, I'll try to compile the glossary in my laptop, as you suggested; but how can I link the glossary file with the main .tex source file to have a single .pdf? Apr 24, 2013 at 23:32

The ShareLaTeX wiki says:

ShareLaTeX does not currently support Glossaries, this is planned to change in the near future.

Until this change happens, you can't generate glossaries in ShareLaTeX using an external indexing application. You can, however, use TeX to perform the sorting and collating without having to invoke an external indexing application. This can be done using datagidx. Example:

\documentclass{article}

\usepackage{datagidx}

\newgidx{glossary}{Glossary}
\DTLgidxSetDefaultDB{glossary}

\newterm[description={a collection of objects}]{set}
\newterm[description={number of objects in a set}]{cardinality}

\begin{document}

% page 1:
\gls{set}.

\newpage
% page 2:
\gls{set}, \gls{cardinality}.

\newpage
% page 3:
\gls{set}.

\newpage
% page 4:
\gls{cardinality}.

\printterms[columns=1,style=align]

\end{document}


Glossary appears as:

Since the sorting and collating is performed by TeX, there is no need to worry about shell escapes and so can be used in documents on ShareLaTeX.

Edit:

You can now also use TeX to perform the sorting and collating with the glossaries package:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{glossaries}

\makenoidxglossaries

\title{EjGlos}
\newglossaryentry{bitcoin}
{
name=Bitcoin,
description={a peer-to-peer payment system and digital
currency introduced as open source software in 2009 by pseudonymous
developer Satoshi Nakamoto. It is a cryptocurrency, so-called
because it uses cryptography to control the creation and transfer of
money}
}

\begin{document}
\maketitle
\section{How does Bitcoin work?}
From a user perspective, \gls{bitcoin} is nothing more than a mobile
app or computer program that provides a personal Bitcoin wallet and
allows a user to send and receive bitcoins with them. This is how
Bitcoin works for most users.

\printnoidxglossaries
\end{document}


This requires at least version 4.04 of glossaries. (This is the "Option 1" described in introduction section of the glossaries user guide.)