7

I am using the glossaries package to make a list of symbols. Is there a simple way to manipulate the space between the symbol and the description?

\documentclass{scrreprt}

\usepackage{glossaries}
\usepackage{glossary-mcols}
\newglossary[slg]{symbolslist}{syi}{syg}{List of Symbols}
\makeglossaries
\renewcommand*{\glspostdescription}{}

\newglossaryentry{symb:band_energy}{
name=\ensuremath{\epsilon_k},
description={Band energy in momentum space.},
type=symbolslist
}

\begin{document}

We will refer to the band structure as \gls{symb:band_energy}.

\printglossary[type=symbolslist, nonumberlist]

\end{document}


I like to increase the space between \epsilon_k and the description.

10

One way is to define a new glossary style and use it instead of the predefined you are using (list).

So you can define a new style based on list in this way:

\newglossarystyle{mystyle}{%
  \glossarystyle{list}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glsentryitem{##1}\glstarget{##1}{##2}]%
       \hspace{1cm}##3\glspostdescription\space ##5}%
}

Note \hspace{1cm}. Change that value to modify the spacing.

At printing time, now you have to use

\printglossary[style=mystyle,type=symbolslist, nonumberlist]

Thus, modifying your MWE to

\documentclass{scrreprt}

\usepackage{glossaries}
\usepackage{glossary-mcols}
\newglossary[slg]{symbolslist}{syi}{syg}{List of Symbols}

\renewcommand*{\glspostdescription}{}

\newglossarystyle{mystyle}{%
  \glossarystyle{list}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glsentryitem{##1}\glstarget{##1}{##2}]%
       \hspace{1cm}##3\glspostdescription\space ##5}%
}

\makeglossaries


\newglossaryentry{symb:band_energy}{
name=\ensuremath{\epsilon_k},
description={Band energy in momentum space.},
type=symbolslist
}

\begin{document}

We will refer to the band structure as \gls{symb:band_energy}.

\printglossary[style=mystyle,type=symbolslist, nonumberlist]

\end{document} 

will give:

enter image description here


Remark

If you need \glspostdescription to be empty only for the newly defined style, you can incorporate \renewcommand*{\glspostdescription}{} in the new style definition:

\newglossarystyle{mystyle}{%
  \glossarystyle{list}%
  \renewcommand*{\glspostdescription}{}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glsentryitem{##1}\glstarget{##1}{##2}]%
       \hspace{1cm}##3\glspostdescription\space ##5}%
}

or even better, since we are redefining \glossaryentryfield, completely remove \glspostdescription from its definition:

\newglossarystyle{mystyle}{%
  \glossarystyle{list}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glsentryitem{##1}\glstarget{##1}{##2}]%
       \hspace{1cm}##3\space ##5}%
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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