# Regarding list of symbols

I am typing this code in overleaf, but I am not getting the list of symbols.

\documentclass{article}
\usepackage{bm}
\usepackage[toc,symbols]{glossaries}

\newglossaryentry{mass}{%
name={\ensuremath{m}},
description={The mass of the object},
type=symbols
}

\newglossaryentry{disp}{%
name={\ensuremath{\bm\lambda}},
description={The absolute displacement},
type=symbols
}

\makeglossaries

\begin{document}
\section{Normal section}
The \gls{mass} of the Sun can be determined by the centripetal force
being given by the gravitional force and the orbiting period of
the Earth.

The \gls{disp} can not be used alone for determing the solar mass.

\appendix
\printglossary[numberedsection,type=symbols,style=list,nogroupskip]

\end{document}


But by this post I am supposed to get the list of symbols.

• @campa Overleaf is supposed to detect if the glossary files need creating but it doesn't if the main glossary isn't used. – Nicola Talbot May 18 '18 at 13:07
• @NicolaTalbot Could you please explain what changes I am supposed to make? – user534666 May 18 '18 at 13:16
• Tip (unrelated to the problem): move \makeglossaries before the definitions. (Doesn't make much difference in this case, but you will notice a problem if you use the see key, so it's best to get in the habit of use \makeglossaries first.) – Nicola Talbot May 18 '18 at 13:31

For glossaries to work, the script makeglossaries has to be called. Overleaf uses the rules defined in a file latexmkrc to detect which scripts to called, and uses a default file given here when no such file is present in your project. According to these default rules, makeglossaries is called when there is a .glo or .acn file present after the first run of PDFLaTeX. However, for this specific case, we want to run makeglossaries on a .slo file to produce a .sls file*. So you just need to add this to the rules:

add_cus_dep('slo', 'sls', 0, 'makeglossaries');


Edit: *Actually, we should have a rule that detects whether the .aux file contains @istfilename{...} in order to determine if makeglossaries is required. However, that's not the way how latexmk works.

tl;dr
Add the following file to your Overleaf project and call it latexmkrc:

# support for the glossaries package:
sub makeglossaries {
system("makeglossaries $_[0]"); } # support for the nomencl package: add_cus_dep('nlo', 'nls', 0, 'makenlo2nls'); sub makenlo2nls { system("makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\""); } # from the documentation for V. 2.03 of asymptote: sub asy {return system("asy \"$_[0]\"");}

# metapost rule from http://tex.stackexchange.com/questions/37134
sub mpost {
my $file =$_[0];
my ($name,$path) = fileparse($file); pushd($path);
my $return = system "mpost$name";
popd();
return \$return;
}


• Really the rule needs to detect if the .aux file contains @istfilename{...} in order to determine if makeglossaries is required but that's not the way that latexmk is configured. – Nicola Talbot May 18 '18 at 13:23
• @NicolaTalbot: Thanks for the clarification, I added that to the answer. – Tiuri May 18 '18 at 13:28
• @Tiuri Thank you. It is now working on overleaf. I have a question does this work only in document class article? Will these commands work to make a list of symbols in a customthesis.cls type document class? – user534666 May 18 '18 at 13:43
• @user534666: The specific problem of "makeglossaries not called when using only a list of symbols" should be solved by this regardless of the document class you are using. – Tiuri May 18 '18 at 13:44
• @Tiuri Hey, this code works in both Sharelatex and overleaf, but not on texstudio. Can you tell me why? – user534666 May 21 '18 at 10:09