Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using TeXShop and the pdflatexmk script. When I link at least one entry of the glossary with \gls{label} the glossary compiles fine and all works well (working code example). However I want to use the \glsaddall command such that I don't have to link to all glossary entries. Unfortunately pdflatexmk neglects this option (malfunctioning code example). Why does it do that?

I know I can run the makeglossaries command in the terminal, but I would rather have it work with pdflatexmk. How can I solve this? Is there a newer pdflatexmk script that addresses this issue?

A working example is shown below.

Working code: mentioning at least one glossary item with \gls{label}:

% !TEX TS-program = pdflatexmk
\documentclass[12pt,a4paper,titlepage,final]{report}
\usepackage[toc, nonumberlist]{glossaries}

\makeglossaries

\begin{document}
\title{Title}
\author{Author}
\date{\today}
\tableofcontents
\printglossaries

\chapter{Chapatare Uno}
\newglossaryentry{One}
{name=One, description={First number after zero}}
Body text for chapter one mentioning the glossary item \gls{One}

\chapter{Chapter Deux}
\newglossaryentry{Open}
{name=Open, description={Opposite of closed}}
Body text for chapter two mentioning the glossary item \gls{Open}

\end{document}

Malfunctioning code: using \glsaddall to print entries without mention

% !TEX TS-program = pdflatexmk
\documentclass[12pt,a4paper,titlepage,final]{report}
\usepackage[toc, nonumberlist]{glossaries}

\makeglossaries

\begin{document}
\title{Title}
\author{Author}
\date{\today}
\tableofcontents
\glsaddall
\printglossaries

\chapter{Chapatare Uno}
\newglossaryentry{One}
{name=One, description={First number after zero}}
Body text for chapter one NOT mentioning the glossary item 

\chapter{Chapter Deux}
\newglossaryentry{Open}
{name=Open, description={Opposite of closed}}
Body text for chapter two NOT mentioning the glossary item

\end{document}
share|improve this question
    
Can you provide a MWE? –  Nicola Talbot Apr 9 '13 at 21:05
add comment

1 Answer

up vote 2 down vote accepted

Move the glossary entry definitions before issuing \glsaddall, and make sure that latexmk knows how to deal with glossaries. There is an example file in the package that shows what you should add to your ~/.latexmkrc setting file.

All in all,

\documentclass[12pt,a4paper,titlepage,final]{report}
\usepackage[toc, nonumberlist]{glossaries}

\makeglossaries
\newglossaryentry{One}
{name=One, description={First number after zero}}
\newglossaryentry{Open}
{name=Open, description={Opposite of closed}}

\begin{document}
\title{Title}
\author{Author}
\date{\today}
\tableofcontents
\glsaddall
\printglossaries

\chapter{Chapatare Uno}
Body text for chapter one NOT mentioning the glossary item

\chapter{Chapter Deux}
Body text for chapter two NOT mentioning the glossary item

\end{document}

and

add_cus_dep( 'glo', 'gls', 0, 'makeglo2gls' );
sub makeglo2gls {
    system("makeindex -s \"$_[0].ist\" -t \"$_[0].glg\" -o \"$_[0].gls\" \"$_[0].glo\"" );
}

or

add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' );
sub makeglossaries {
   system( "makeglossaries \"$_[0]\"" );
}

in ~/.latexmkrc resolves your problem.

share|improve this answer
    
It works, thank you for the solution. It puzzles me though why the default latexmk script (without the makeglossaries sub) compiles the glossary fine when I use \gls{label}. Doesn't that indicate that it already knows how to compile glossaries? –  Bart Arondson Apr 10 '13 at 10:05
    
@BartArondson Maybe you have a rule already in latexmkrc? Or you have a .gls file around from some manual run of makeindex? I tested this: with a clean folder (only the tex file), and a vanilla latexmk (without the sub), I never get a .gls file, regardless what is in the tex file. –  mafp Apr 10 '13 at 13:45
    
Ok, I think I understand it now. With the vanilla latexmkrc I can put the glossary entry definitions in the body (as I did originally), but then it only works when I use \gls{label} in the body as well. If I don't use \gls{label} and try to use \glsaddall no glossary is printed. But when I put the entry definitions before \glsaddall (as you suggested) and run the vanilla latexmkrc it works. So adding the sub is not necessary for the latexmkrc script bundled with TexShop. My problem was that I didn't place the glossary entry definitions before calling \glsaddall. –  Bart Arondson Apr 10 '13 at 14:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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