I found somewhere here a way to define my own glossary-style:
\newglossarystyle{superglossarystyle}
{
\setglossarystyle{super}
\renewenvironment{theglossary}
{
\tablehead{}
\tabletail{}
\begin{supertabular}{rp{\glsdescwidth}}
}
{
\end{supertabular}
}
}
%
\setglossarystyle{superglossarystyle}
How do I manually break a line in the name
-field in \newglossaryentry
?
How it looks now:
ParameterA,ParameterB This is the description of ParameterA and ParameterB,
that is long and automatically wraps.
ParameterC This is the description of ParameterC, that is long
and automatically wraps.
How it should look:
ParameterA,
ParameterB This is the description of ParameterA and ParameterB,
that is long and automatically wraps.
ParameterC This is the description of ParameterC, that is long
and automatically wraps.
I tried to add \\,\linebreak,\tabbreak
etc. as a line break without any success.
\documentclass[pdftex,a4paper,oneside,12pt,halfparskip]{scrbook}
\usepackage[]{amsmath,amssymb}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,top=3.6cm,bottom=3.6cm,left=3.6cm,right=3.6cm]{geometry}
\usepackage[]{glossaries}
\newglossarystyle{superglossarystyle}
{
\setglossarystyle{super}
\renewenvironment{theglossary}
{
\tablehead{}
\tabletail{}
\begin{supertabular}{cp{\glsdescwidth}}
}
{
\end{supertabular}
}
}
\setglossarystyle{superglossarystyle}
\makeglossaries
\newglossaryentry{pab}
{
name = {$\boldsymbol{ParameterA},\boldsymbol{ParameterB}$} ,
description = {This is the description of ParameterA and ParameterB, that is long and automatically wraps} ,
}
\newglossaryentry{pc}
{
name = {$\boldsymbol{ParameterC}$} ,
description = {This is the description of ParameterC, that is long and automatically wraps.} ,
}
\begin{document}
\glsaddallunused\printglossaries
\end{document}
Best Answer
The standard column specifiers are
l
,r
,c
andp{
length}
. You can define new column types using thearray
package, but I don't think that's needed in this case as you can adjust the paragraph alignment using\raggedleft
. When defining a new glossary style, it helps to consider a simplified version of what that style does. At it's basic level, the style needs to be in the form:which has a right-aligned paragraph-style first column.
Now test what happens if
ParameterA,ParameterB
is added:This doesn't have a line wrap because TeX can't insert a line break, so the result is rather ugly.
Instead you need to provide TeX with some scope to break the line at the comma:
TeX can now break the line:
Here I've hardcoded the column widths using
2cm
and4cm
, but theglossaries
package defines a length for the second column called\glsdescwidth
. You can define another length to use for the first column:You'll need to set this value as appropriate for your document. For example:
or
The new glossary style can then be defined as:
The complete example is:
which produces: