Glossaries: error when compiling
tldr: Most (but not all) of the list
styles are incompatible with classicthesis
, so the style needs to be switched.
The problem is caused by the way \item
is redefined with classicthesis
. The following is a trimmed down MWE:
\documentclass[twoside]{scrreprt}
\usepackage{classicthesis}
\usepackage[nonumberlist,nopostdot,xindy]{glossaries}
\makeglossaries
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific document}
}
\begin{document}
\begin{description}
\item[\glossentryname {latex}] sample
\end{description}
\end{document}
With classicthesis
, this produces the error:
! Undefined control sequence.
<argument> \letcs {\glo@name
}{glo@\glsdetoklabel{latex}@name}\expandafter ...
l.23 \item[\glossentryname {latex}]
sample
Without classicthesis
, there's no error. It seems that classicthesis
tries to expand the label's argument. Protecting the fragile command fixes the problem:
\documentclass[twoside]{scrreprt}
\usepackage{classicthesis}
\usepackage[nonumberlist,nopostdot,xindy]{glossaries}
\makeglossaries
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific document}
}
\begin{document}
\begin{description}
\item[\protect\glossentryname {latex}] sample
\end{description}
\end{document}
Since the \item
is embedded within the glossary style, the simplest method is to use a different style. For example:
\printglossary[style=index]
The alternative is to define a style that protects all the commands within the optional argument of \item
. For example:
\documentclass[twoside]{scrreprt}
\usepackage{classicthesis}
\usepackage[nonumberlist,nopostdot,xindy]{glossaries}
\makeglossaries
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific document}
}
\newglossarystyle{plist}
{%
\setglossarystyle{list}%
\renewcommand*{\glossentry}[2]{%
\item[\protect\glsentryitem{##1}%
\protect\glstarget{##1}{\protect\glossentryname {##1}}]
\glossentrydesc{##1}\glspostdescription \space ##2%
}%
}
\begin{document}
\printglossary[style=plist]
\gls{latex}
\end{document}
I don't really recommend this method as you're unlikely to want to gather \glsentrytarget
and \glsentryitem
in a command for later use, as they
are specific to the glossary. (\glsentrytarget
provides the hypertarget, which must be unique and \glsentryitem
is dependent on a counter that is reset and incremented in the glossary.)
In answer to your second question \glo@latex@name
is the internal command used to store the value of the name
key for the entry with the label latex
. You shouldn't ever need to use this explicitly. (This value can simply be obtained using \glsentryname{latex}
.)
Edit: As from v4.26, glossaries
now checks if classicthesis
has been loaded. If it has, the default style is switched from list
to index
, which is the closest matching style.
Note that the nolist
option mentioned in the other answer simply prevents the automatic loading of glossary-list.sty
. It doesn't automatically switch the style. For example, with pre glossaries
v4.26:
\documentclass[twoside]{scrreprt}
\usepackage{classicthesis}
\usepackage[nolist]{glossaries}
\makeglossaries
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific document}
}
\begin{document}
\printglossary
\gls{latex}
\end{document}
The error switches to:
! Package glossaries Error: Glossary style `list' undefined.
There is actually a style in glossary-list.sty
that works with classicthesis
and that's the listdotted
style, which becomes unavailable with nolist
. The key point is to select a style that's compatible with classicthesis
.
In the case, such as with classicthesis
, where you are unable to use the list
style, the index
style is the closest match. Note that the tabular-like styles, such as long
, don't allow page breaks within the description, so index
works better for long descriptions. However, an adjustment is required for multi-paragraph descriptions.
For comparison, here's an example of the list
style:
\documentclass{scrreprt}
\usepackage[style=list,nopostdot]{glossaries}
\makeglossaries
% sample entries provided by glossaries for testing:
\loadglsentries{example-glossaries-multipar}
\glsaddall
\begin{document}
\printglossary
\end{document}
Here's the closest matching index
style with adjustment (requires at least glossaries
v4.26):
\documentclass{scrreprt}
\usepackage[style=index,nopostdot]{glossaries}
\makeglossaries
% adjust "index" style to allow multi-paragraph descriptions:
\renewcommand{\glstreeitem}{%
\parindent0pt\par\hangindent40pt
\everypar{\parindent50pt\hangindent40pt}}
% sample entries provided by glossaries for testing:
\loadglsentries{example-glossaries-multipar}
\glsaddall
\begin{document}
\printglossary
\end{document}
It's not an exact match, but it's fairly close.
The altlist
style starts the description on the next line. Here's an example of altlist
:
\documentclass{scrreprt}
\usepackage[style=altlist,nopostdot]{glossaries}
\makeglossaries
% sample entries provided by glossaries for testing:
\loadglsentries{example-glossaries-multipar}
\glsaddall
\begin{document}
\printglossary
\end{document}
The closest non-list match is again the index
style, but with another adjustment (again requires at least v4.26):
\documentclass{scrreprt}
\usepackage[style=index,nopostdot]{glossaries}
\makeglossaries
% adjust "index" style to allow multi-paragraph descriptions:
\renewcommand{\glstreeitem}{%
\parindent0pt\par\hangindent40pt
\everypar{\parindent50pt\hangindent40pt}}
\renewcommand{\glstreepredesc}{\par
\glstreeitem\parindent\hangindent}
% sample entries provided by glossaries for testing:
\loadglsentries{example-glossaries-multipar}
\glsaddall
\begin{document}
\printglossary
\end{document}
The difference in the font used by the label stems from the use of scrreprt
as the class which uses sans-serif for the \item
label in the description
environment. Since the index
style doesn't use a list environment, it's unaffected.
There's a complete list of all predefined styles with examples for comparison.
I can't find where exactly classicthesis.sty redefines anything related to the error you're reporting. What I did find is a note in the 'manual' saying: If you want to use the glossaries package, take care of loading it with the following options: \usepackage[style=long,nolist]{glossaries}. Can't blame classicthesis for everything, can you?