2

I created a glossary (called "Symbolverzeichnis") and split it up in two columns using mcolalttree. My problem is the empty line at the beginning of the left column. Does anyone know how to get rid of it? Thank you very much in advance :)

Here's my current code:

\documentclass[12pt,doublesided,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[onehalfspacing]{setspace}
\usepackage[nogroupskip,nopostdot,acronyms]{glossaries} %,toc
\usepackage{glossary-mcols} 

\makenoidxglossaries

\newglossaryentry{B}{name={$B$},description={Magnetische Flussdichte}}
\newglossaryentry{M}{name={$M$},description={Magnetisierung}}
\newglossaryentry{T}{name={$T$},description={Temperatur}}
\newglossaryentry{g}{name={$g$},description={g-Faktor (Landé-Faktor)}}
\newglossaryentry{H}{name={$H$},description={Magnetische Feldstärke}}
\glssetwidest{M   }


\begin{document}
    \printnoidxglossary[type=main,style=mcolalttree,nonumberlist,title={Symbolverzeichnis}]

    \newpage
    \gls{B}, \gls{M}, \gls{T}, \gls{g}, \gls{H}

\end{document}

And the Output:

Output

9
  • 1
    Welcome to TeX.SX!
    – Bobyandbob
    Commented Aug 11, 2017 at 12:43
  • Did you try it without the \newpage command? I don't see any need for it and it's highly suspicious of causing trouble in this position.
    – dessert
    Commented Aug 11, 2017 at 12:56
  • 1
    The \newpage part is just because the symbols have to be used once in order to appear in the glossary. And yes, it works fine even without the newpage command after it, the blank line ist still there..
    – Sara
    Commented Aug 11, 2017 at 12:58
  • Is style=mcoltree an option`? See User Manual for glossaries.sty v4.31 p.216) Section:15.1.9 In-Line Style .
    – Bobyandbob
    Commented Aug 11, 2017 at 13:06
  • The empty line is gone if I use mcoltree :) But I don't like that the entries aren't aligned anymore.. My glossary has over 50 entries and it would just be too confusing that way
    – Sara
    Commented Aug 11, 2017 at 13:11

2 Answers 2

2

It seems this empty line is hardcoded into the mcolalttree style? If you take a look at the code below, I've added in the definition for the mcolalttree glossary style, but with the \mbox{}\par commented out, and thus renamed the style sara.

\documentclass[12pt,doublesided,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[onehalfspacing]{setspace}
\usepackage[nogroupskip,nopostdot,acronyms]{glossaries} %,toc
\usepackage{glossary-mcols} 

% ===================
\makeatletter
\newglossarystyle{sara}{%
    \setglossarystyle{alttree}%
    \renewenvironment{theglossary}%
    {%
        \begin{multicols}{2}%
            \def\@gls@prevlevel{-1}%
%           \mbox{}\par
        }%
        {\par\end{multicols}}%
}
\makeatother
% ===================

\makenoidxglossaries

\newglossaryentry{B}{name={$B$},description={Magnetische Flussdichte}}
\newglossaryentry{M}{name={$M$},description={Magnetisierung}}
\newglossaryentry{T}{name={$T$},description={Temperatur}}
\newglossaryentry{g}{name={$g$},description={g-Faktor (Landé-Faktor)}}
\newglossaryentry{H}{name={$H$},description={Magnetische Feldstärke}}
\glssetwidest{M   }



\begin{document}
    \printnoidxglossary[type=main,style=sara,nonumberlist,title={Symbolverzeichnis}]

    \newpage
    \gls{B}, \gls{M}, \gls{T}, \gls{g}, \gls{H}

\end{document}

The result is as such:

enter image description here

1

This is more of a dirty workaround than a solution, however it does solve the problem:

\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[nogroupskip,nopostdot,acronyms]{glossaries} %,toc
\usepackage{glossary-mcols}

\newlength{\myl}

\makenoidxglossaries
\newglossaryentry{B}{name={$B$},description={\settowidth{\myl}{$B$}\hspace{-\myl}\hspace{2em}Magnetische Flussdichte}}
\newglossaryentry{M}{name={$M$},description={\settowidth{\myl}{$M$}\hspace{-\myl}\hspace{2em}Magnetisierung}}
\newglossaryentry{T}{name={$T$},description={\settowidth{\myl}{$T$}\hspace{-\myl}\hspace{2em}Temperatur}}
\newglossaryentry{g}{name={$g$},description={\settowidth{\myl}{$g$}\hspace{-\myl}\hspace{2em}g-Faktor (Landé-Faktor)}}
\newglossaryentry{H}{name={$H$},description={\settowidth{\myl}{$H$}\hspace{-\myl}\hspace{2em}Magnetische Feldstärke}}

\begin{document}
\printnoidxglossary[type=main,style=mcoltree,nonumberlist,title={Symbolverzeichnis}]
\newpage
\gls{B}\gls{M}\gls{T}\gls{g}\gls{H}
\end{document}

enter image description here

If you're happy with this, you (or I) can define a function to make the code far shorter and more readable.

8
  • First of all: thank you very much! Even though it is a bit complicated it does work for my mini-example. I tried your code with the rest of my glossary entries as well and it still works, it is just that everything looks a bit messed up now, since it contains longer entries. \newglossaryentry{NA}{name={$N_{\textnormal{A}}$},description={\settowidth{\myl}{$N_{\textnormal{A}}$}\hspace{-\myl}\hspace{2em}Avogadro-Konstante \newline ($6,022 \cdot 10^{22}$ mol$^{-1}$)},sort=Nza}
    – Sara
    Commented Aug 11, 2017 at 14:27
  • \newglossaryentry{B1B2}{name={$B_1$, $B_2$},plural={$B_1$},description=\settowidth{\myl}{$B_1$, $B_2$}\hspace{-\myl}\hspace{2em}{Empirische Parameter der QTM},sort=B2} These are the most troubeling entries.. I'm no pro using LaTex, so could you please tell me what I need to adjust using your code in order to also fit the longer entries? Thanks :)
    – Sara
    Commented Aug 11, 2017 at 14:29
  • Ok, I just changed 2em to 3em :)
    – Sara
    Commented Aug 11, 2017 at 14:32
  • Now my last problem is that the columns are not as wide as they used to be. Before the word "Empirische Parameter der QTM" fit into one row and now it is split up over two rows...
    – Sara
    Commented Aug 11, 2017 at 14:34
  • @Sara Well if you change 2em to 3em (what clearly is the right thing to do), of course there's more space needed, leaving less for the other column. I can't look into it at the moment, but maybe the manual says something about the spacing left and right of the glossary?
    – dessert
    Commented Aug 11, 2017 at 14:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .