[Tex/LaTex] Problems with printglossaries in Main.tex using external glossary file and external chapters tex files

glossaries

I'm writing a heavy PhD thesis structured in several chapters. Each chapter has many figures, acronyms, symbols and equations. So I decided to structure in separated folders of Figures, Chapters texts, Glossaries, Acronyms and Symbols. There is a Main.tex calling the chapters and glossaries.

All the acronyms of the thesis entries are gathered in only one file as glossaries and symbols as well.

The fact is that after compiling, the aspect is quite good but the list of glossaries, acronyms and symbols don't appear.
I have observe that if a \gls{ } is placed in the Main.tex \printglossaries is effective but if they are placed in the different chapter texts located in other folders, \printglossaries does not work.

Sorry. I have tried to upload several times my MWE. This is the content ofMain.tex:

\documentclass[10pt,a4paper, twoside,titlepage]{report} 
\usepackage[utf8]{inputenc} 
\usepackage{amsmath} 
\usepackage{mathtools} 
\usepackage{amsfonts}    
\usepackage{amssymb}   
\usepackage{graphicx}  
\usepackage{sidecap}    
\usepackage[left=4cm,right=3cm,top=3cm,bottom=2cm]{geometry}     
\usepackage[hidelinks]{hyperref} 
\usepackage[sort]{natbib}   



\title{Title of Thesis}
\author{Name of author}
\date{Presentation date}

%Package for header and footer customization
\usepackage{fancyhdr}
\usepackage{chappg}

%Header customization
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\slshape \nouppercase{\leftmark}}
\fancyhead[RE,LO]{Author's name - PhD thesis title}
\fancyfoot[CE,CO]{\thepage}

\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}

%Additional counter for Table of content' depth control
\setcounter{tocdepth}{4}        

\usepackage{setspace}
\onehalfspacing

\usepackage[acronym,toc]{glossaries}

\newglossary[slg]{symbols}{sym}{sbl}{List of Symbols}

\makeglossaries

\loadglsentries{Chapters/glosario}
\loadglsentries{Chapters/acronimos}
\loadglsentries{Chapters/simbolos}


\begin{document}

\tableofcontents

\input{Chapters/Chapter2}

\printglossaries

Chapter 2 is placed in other folder called "Chapters". glosario.tex, acronimos.tex and simbolos.tex are placed in folder Chapters as well.

The content of chapter 2 is:

\chapter{Governing Equations} 

\label{Chapter2} 

\section{Introduction}

\section{Near-wall treatment}

\subsection{Texto de tutorial}

The k- models, the RSM, and the  \gls{les} model are primarily valid for turbulent core
flows (i.e., the flow in the regions somewhat far from walls). Consideration therefore
needs to be given as to how to make these models suitable for wall-bounded flows. The
Spalart-Allmaras and $ k-\omega $ models were designed to be applied throughout 
the boundary layer, provided that the near-wall mesh resolution is sufficient.

\section{Diplomatic Memoirs}

When I was an \gls{attache}, I lived in a \gls{culdesac}, but
I didn't much care for it as I found there was a fair amount
of \gls{elitism} amongst my neighbours.

\section{Student Memoirs}

When I was a student I often left bits of electronic circuitry
in my pockets, such as \glspl{led} and \glspl{eeprom}, which
often ended up in the washing machine. The \glspl{led} didn't
fair too badly, but the \glspl{eeprom} frequently broke.

\section{Symbols}

The \gls{angstrom} is commonly used in structural biology,
whereas the \gls{ohm} is used in electronics.

The content of glosario.tex is:
% The following definitions will go in the main glossary

\newglossaryentry{culdesac}{name=cul-de-sac,description={passage
or street closed at one end},plural=culs-de-sac}

\newglossaryentry{elite}{name={\'e}lite,description={select
group or class},sort=elite}

\newglossaryentry{elitism}{name={\'e}litism,description={advocacy
of dominance by an \gls{elite}},sort=elitism}

\newglossaryentry{attache}{name=attach\'e,
description={person with special diplomatic responsibilities}}

The content of acronimos.tex is:

% The following definitions will go in the list of acronyms

\newacronym{led}{LED}{light-emitting diode}

\newacronym{eeprom}{EEPROM}{electrically erasable programmable
read-only memory}

\newacronym{dsf}{DSF}{Deterministic Separated Flow}
\newacronym{les}{LES}{Large Eddy Simulation}

The content of simbolos.tex is:

% The following definitions will go in the list of symbols

\newglossaryentry{ohm}{type=symbols,name=ohm,
symbol={\ensuremath{\Omega}},
description=unit of electrical resistance}

\newglossaryentry{angstrom}{type=symbols,name={\aa}ngstr\"om,
symbol={\AA},sort=angstrom,
description={non-SI unit of length}}

Best Answer

Glossary information is only written to the external files when commands like \gls are used. Without a minimal working example, it's difficult to say for certain, but if you're using \include then it may be possible that you're using a command like \includeonly to only selectively include chapters. If the excluded files contain commands like \gls they'll be skipped when the file is skipped, which means that they won't be written to the glossary file and no glossary will appear.

Here's an example. The main file test.tex:

\documentclass{report}

\usepackage{glossaries}

\makeglossaries

\loadglsentries{example-glossaries-brief}

\begin{document}

\include{chapters/test-ch1}

\include{chapters/test-ch2}

\include{chapters/test-ch3}

\printglossaries

\end{document}

In the chapters directory (folder) the files are:

test-ch1.tex:

\chapter{Sample}

\gls{lorem}

test-ch2.tex:

\chapter{Another}

\gls{dolor}

test-ch3.tex:

\chapter{No Glossary Entries Here}

Now the following document build sequence:

pdflatex test
makeglossaries test
pdflatex test

will correctly generate the glossary. However, suppose I now add

\includeonly{chapters/test-ch3}

to the preamble. This excludes the two chapters that use \gls and only includes the chapter that doesn't contain any \gls (or similar) command. This means that nothing is written to the glossary. Now recompile (rebuild) the document:

pdflatex test
makeglossaries test

This produces an error message from makeglossaries:

makeglossaries version 2.15 (2014-07-30)
added glossary type 'main' (glg,gls,glo)
Warning: File 'test.glo' is empty.
Have you used any entries defined in glossary 'main'?
Remember to use package option 'nomain' if you
don't want to use the main glossary.

This is because nothing has been written to test.glo because all the commands that perform that write have been skipped.

What should you do? Well, if you're excluding chapters, that means you're still working on the document, in which case it doesn't matter. The document is already an incomplete draft since there are some chapters missing, so just skip the makeglossaries step until you're ready to check the entire document rather than just the particular chapter you're working on. Once you go back to including the files that contain glossary references, then go back to building the glossary.

Edit: Another possibility is that you may be using an old version of makeglossaries which didn't pick up \@input from the .aux file. This was corrected in makeglossaries version 1.9 (distributed with glossaries v2.07 2010/07/10).

Related Question