1

I have made a symbollist with the glossary package. Here is the code:

\documentclass[12pt]{article} 

\usepackage[utf8]{inputenc} %Inputencoding: Umlaute richtig eingeben
\usepackage[T1]{fontenc}    %Fontencoding: Worte mit Umlauten richtig trennen
\usepackage[ngerman]{babel} 
\usepackage{acronym}
\usepackage{hyperref}

\usepackage[
nonumberlist, %keine Seitenzahlen anzeigen
nogroupskip,  %kein Abstand
acronym,      %ein Abkürzungsverzeichnis erstellen
toc,          %Einträge im Inhaltsverzeichnis
section]      %im Inhaltsverzeichnis auf section-Ebene erscheinen
{glossaries}


%Ein eigenes Symbolverzeichnis erstellen
\newglossary[slg]{symbolslist}{syi}{syg}{Symbolverzeichnis}
\newglossary[slg]{acronyms}{syi}{syg}{Abkürzungsverzeichnis}

%Den Punkt am Ende jeder Beschreibung deaktivieren
\renewcommand*{\glspostdescription}{}


%eigenen glossaries style für symbolverzeichnis definieren
\newglossarystyle{superAB}{% 
\glossarystyle{long}%
\newcommand*{\myglossaryindent}{0cm}% linker Seitenabstand symbolverzeichnis %symbolverzeichnis nach links einrücken --------------------

\renewenvironment{theglossary}
{%
\begin{longtable}[l]{@{\hspace{\myglossaryindent}}lp{\glsdescwidth}}%
}%
% 
{\end{longtable}% 
}
\renewcommand*{\glossarysubentryfield}[6]{%
##3 & \glssubentryitem{##2}\glstarget{##2}{\strut}##4\glspostdescription\\}
}%

%symbolverzeichnis nach links einrücken 


%Glossar-Befehle anschalten
\makeglossaries

%%%%%%%%%%%%%%%%%%%%%%%%%%Settings%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\setlength{\glslistdottedwidth}{.25\hsize} %Punktlänge einstellen

\newglossaryentry{romanletter}{name={\textbf{\large Lateinische Symbole}},description={}}
\newglossaryentry{greekletter}{name={\textbf{\large Griechische Symbole}},description={}}

\newglossaryentry{symb:omega}{
name=$\Omega$,
description={Giergeschwindigkeit},
parent=greekletter,
sort=symbolomega, 
type=symbolslist
}
\newglossaryentry{symb:M0}{
name=$M_{\mathrm{0}}$,
description={gemessenes Biegemoment mittels Vollmessbrücken DMS Schaltung},
parent=romanletter,
sort=symbolM0, 
type=symbolslist
}

\glsaddall[types=symbolslist]

\begin{document}
\printglossary[type=symbolslist, style=superAB]
\end{document}

It looks like this: enter image description here

But I want to change some things: 1.) Increase the distance between the last greec symbol and the caption of the roman symbols 2.) the distance between the symbol and the description should be smaller 3.) the distance between the symbol and the description should be dotted.

In the end it should look like this: enter image description here

Thank you in advance!

  • What version of glossaries do you have? (\glossarystyle, \glossaryentryfield and \glossarysubentryfield were all deprecated in v4.0, so the answer depends on whether or not you need it to work with an old version.) – Nicola Talbot Oct 30 '18 at 11:08
  • where can i see it? i am working with overleaf. – keiner99 Oct 30 '18 at 12:30
  • The package version numbers are in the .log file. On Overleaf there's an icon next to the "Recompile" button with the tooltip "Logs and output files". Click on that and then click on "View raw logs" to see the contents of the .log file. The line Package: glossaries 2016/04/30 v4.23 (NLCT) indicates that the version number is 4.23, which is a bit out of date, but is new enough for the new glossary style commands. – Nicola Talbot Oct 30 '18 at 15:33
  • Package: glossaries 2017/06/11 v4.30 (NLCT) Package: glossary-hypernav 2017/06/11 v4.30 (NLCT) Package: glossary-list 2017/06/11 v4.30 (NLCT) Package: glossary-long 2017/06/11 v4.30 (NLCT) this is written in the log file – keiner99 Oct 30 '18 at 20:50
  • nobody an idea? – keiner99 Nov 3 '18 at 10:04
0

The main problem here is that the top level entries (denoting the Greek and Latin entries) are in the first column of the table, so that column must be at least as wide as those headings. There are a number of ways to resolve this.

The first method adjusts the style to make the top-level entries span both columns. It's more efficient to move the font changing commands out of the name field and put them in the style. This assumes that all your top-level entries are actually headers.

Note that as from version 4.0, the style commands \glossarystyle, \glossaryentryfield and \glossarysubentryfield are all deprecated. You can still use them but you'll get a warning. To update to the newer commands, you need to make the following substitutions:

  • \glossarystyle{style-name} -> \setglossarystyle{style-name}
  • \glossaryentryfield{label}{name}{description}{symbol}{location} replace with:

    \glossentry{label}{location}

    • The name can be accessed with \glossentryname{label}.
    • The description can be accessed with \glossentrydesc{label}.
    • The symbol can be accessed with \glossentrysymbol{label}.
    • Other fields can be accessed with commands like \glsentryuseri{label} described in section 9: Using Glossary Terms Without Links of the user manual.
  • \glossarysubentryfield{level}{label}{name}{description}{symbol}{location} replace with:

    \subglossentry{level}{label}{location}

    The fields can be accessed as above.

Here's a modified version that uses the newer commands and makes the top-level entries span both columns:

\documentclass[12pt]{article} 

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel} 
\usepackage{hyperref}

\usepackage[
nonumberlist,
nogroupskip,
nopostdot,
toc,
section]
{glossaries}


\newglossary[slg]{symbolslist}{syi}{syg}{Symbolverzeichnis}

\newglossarystyle{superAB}{% 
 \setglossarystyle{long}%
 \renewenvironment{theglossary}
 {%
  \begin{longtable}[l]{@{}lp{\glsdescwidth}}%
 }%
 {%
   \end{longtable}% 
 }%
 \renewcommand{\glossentry}[2]{%
   \tabularnewline
   \multicolumn{2}{@{}l}%
   {%
     \glsentryitem{##1}%
     \glstarget{##1}{\textbf{\large\glossentryname{##1}}}%
   }%
   \tabularnewline
 }%
 \renewcommand{\subglossentry}[3]{%
    \glssubentryitem{##2}%
    \glstarget{##2}{\glossentryname{##2}}%
    &
    \glossentrydesc{##2}\glspostdescription\space
    ##3\tabularnewline
 }%
}%

\makeglossaries

\newglossaryentry{romanletter}{name={Lateinische Symbole},description={}}
\newglossaryentry{greekletter}{name={Griechische Symbole},description={}}

\newglossaryentry{symb:omega}{
name=$\Omega$,
description={Giergeschwindigkeit},
parent=greekletter,
sort=symbolomega, 
type=symbolslist
}
\newglossaryentry{symb:M0}{
name=$M_{\mathrm{0}}$,
description={gemessenes Biegemoment mittels Vollmessbrücken DMS Schaltung},
parent=romanletter,
sort=symbolM0, 
type=symbolslist
}

\glsaddall[types=symbolslist]

\begin{document}
\printglossary[type=symbolslist, style=superAB]
\end{document}

The result is:

image of symbol list

The first column is now just wide enough to fit the widest sub-entry. A dotted leader can be added to the style with \dotfill but it will be barely noticeable with just a single dot for the narrower symbol (omega).

Here's a variation that makes the left column 2cm wide and adds a leader:

\newglossarystyle{superAB}{% 
 \setglossarystyle{long}%
 \renewenvironment{theglossary}
 {%
  \begin{longtable}[l]{@{}p{2cm}p{\glsdescwidth}}%
 }%
 {%
   \end{longtable}% 
 }%
 \renewcommand{\glossentry}[2]{%
   \tabularnewline
   \multicolumn{2}{@{}l}%
   {%
     \glsentryitem{##1}%
     \glstarget{##1}{\textbf{\large\glossentryname{##1}}}%
   }%
   \tabularnewline
 }%
 \renewcommand{\subglossentry}[3]{%
    \glssubentryitem{##2}%
    \glstarget{##2}{\glossentryname{##2}}%
    \dotfill
    &
    \glossentrydesc{##2}\glspostdescription\space
    ##3\tabularnewline
 }%
}%

This produces:

image of symbol list with dotted leader

The gap between the columns can be shrunk by reducing the value of \tabcolsep. For example:

\newglossarystyle{superAB}{% 
 \setglossarystyle{long}%
 \renewenvironment{theglossary}
 {%
  \setlength{\tabcolsep}{2pt}%
  \begin{longtable}[l]{@{}p{2cm}p{\glsdescwidth}}%
 }%
 {%
   \end{longtable}% 
 }%
 \renewcommand{\glossentry}[2]{%
   \tabularnewline
   \multicolumn{2}{@{}l}%
   {%
     \glsentryitem{##1}%
     \glstarget{##1}{\textbf{\large\glossentryname{##1}}}%
   }%
   \tabularnewline
 }%
 \renewcommand{\subglossentry}[3]{%
    \glssubentryitem{##2}%
    \glstarget{##2}{\glossentryname{##2}}%
    \dotfill
    &
    \glossentrydesc{##2}\glspostdescription\space
    ##3\tabularnewline
 }%
}%

This produces:

image of symbol list with narrow gap between columns

Alternatively, you can remove it completely with @{} in the column specifier:

  \begin{longtable}[l]{@{}p{2cm}@{}p{\glsdescwidth}}%

Or to use up the entire line width:

  \begin{longtable}[l]{@{}p{2cm}@{}p{\dimexpr\linewidth-2cm}@{}}%

The second method is to remove the hierarchy and have separate glossaries for each type of symbol and use the alttree style. For example:

\documentclass[12pt]{article} 

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel} 
\usepackage{hyperref}

\usepackage[
nonumberlist,
nogroupskip,
nopostdot,
toc,
section]
{glossaries}


\newglossary*{greeklist}{Griechische Symbole}
\newglossary*{romanlist}{Lateinische Symbole}

\makeglossaries

\newglossaryentry{symb:omega}{
name=$\Omega$,
description={Giergeschwindigkeit},
sort=symbolomega, 
type=greeklist
}
\newglossaryentry{symb:M0}{
name=$M_{\mathrm{0}}$,
description={gemessenes Biegemoment mittels Vollmessbrücken DMS Schaltung},
sort=symbolM0, 
type=romanlist
}

\glsaddall[types={greeklist,romanlist}]

\begin{document}

\section*{Symbolverzeichnis}
\setupglossaries{section=subsection}
\setglossarystyle{alttree}

% Set up the way the name is displayed in the alttree style and how
% much space it takes up.
\glssetwidest{MMMM}
\renewcommand*{\glstreenamebox}[2]{% requires v4.19+
  \makebox[#1][l]{#2\dotfill}%
}

\printglossary[type=greeklist]
\printglossary[type=romanlist]
\end{document}

This produces:

image of symbol lists

This method means that you manually order the two symbol lists, which makes it easier to have the Latin list before the Greek list if you prefer.

The third method is only available with the glossaries-extra extension package using the group field and \printunsrtglossary. You can manually arrange the symbols so that they are listed in order of definition (no external tool required):

\documentclass[12pt]{article} 

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel} 
\usepackage{hyperref}

\usepackage[record,% make group field available
 symbols,
 style=alttreegroup,
 nonumberlist]{glossaries-extra}

% Requires glossaries-extra.sty v1.14+
\glsxtrsetgrouptitle{greek}{Griechische Symbole}
\glsxtrsetgrouptitle{roman}{Lateinische Symbole}

\newglossaryentry{symb:omega}{
 name=$\Omega$,
 description={Giergeschwindigkeit},
 type=symbols,
 group=greek
}
\newglossaryentry{symb:M0}{
 name=$M_{\mathrm{0}}$,
 description={gemessenes Biegemoment mittels Vollmessbrücken DMS Schaltung},
 type=symbols,
 group=roman
}

% Set up the way the name is displayed in the alttree style and how
% much space it takes up.
\glssetwidest{MMMM}
\renewcommand*{\glstreenamebox}[2]{% requires v4.19+
  \makebox[#1][l]{#2\dotfill}%
}

\begin{document}

% Requires glossaries-extra.sty v1.08+
\printunsrtglossary[type=symbols,title={Symbolverzeichnis}]
\end{document}

This produces:

image of symbol list

If you want the sorting performed by an external tool, you can combine this method with bib2gls but this is currently not available with Overleaf. (For a similar example, see the sample-textsymbols.tex document described in the "Examples" chapter of the bib2gls documentation.)

|improve this answer|||||

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.