6

I am a total beginner with LaTeX and I can't find a way to solve the following problem. I have a glossary which I have printed in two columns by adding the code that I have included at the end. The problem is that the title of the glossary appears included in the first column. What I would like is that the title stays out, and the two column format begins after the title is printed. Is there an easy way to do this?

Thank you very much for your help!

\documentclass[10pt,a4paper]{book}
\usepackage[hyperfirst=true,acronym]{glossaries}
\usepackage{multicol}

\let\glsaltpl\glsuseri
\let\glsing\glsuserii

%%Formatos para la lista de acrónimos
\newglossarystyle{EstiloGlosario}{%
\glossarystyle{listgroup}% Estilo base
%Estilo de las entradas: Entrada en negrita, descripcion normal
\renewcommand*{\glossaryentryfield}[5]{%
\item[]{\bf{\glstarget{##1}{##2}}}\;\;\;\relax
\space{\footnotesize ##3}% Description,
{,}
{\footnotesize ##5}
% Page list
\vspace{-0.2mm}% end of row
}%
%Cabecera con regla debajo de la letra inicial
\renewcommand*{\glsgroupheading}[1]{\setlength{\itemsep}{0mm}\item[{\:}{\:}{\Large        \glsgetgrouptitle{##1}}]\setlength{\itemsep}{-2.5mm}
\item[\rule{3cm}{0.02 cm}]\setlength{\itemsep}{-0mm}}
}

\makeglossaries
\begin{document}
    \begin{multicols}{2}
    \printglossary[type=main,style=EstiloGlosario]
    \newpage
    \end{multicols}

    \newglossaryentry{ppm}{name=ppm,description={parts per million}} The units are expressed in \gls{ppm}.
\end{document}

1 Answers1

5

Your example code produces errors, so I used a simplified document to illustrate the procedure. You can achieve what you want by redefining \glossarysection to write the title using \chapter* and then go into two-column mode, and \glossarypostamble to return to one-column mode; something along these lines:

\documentclass[10pt,a4paper]{book}
\usepackage[hyperfirst=true,acronym,section=chapter]{glossaries}
\usepackage{multicol}

\renewcommand*{\glossarysection}[2][]{%
  \begin{multicols}{2}[\chapter*{#2}]
  \setlength\glsdescwidth{0.6\linewidth}%
  \glossarymark{\glossarytoctitle}%
}
\renewcommand*{\glossarypostamble}{\end{multicols}}
\makeglossaries

\newglossarystyle{EstiloGlosario}{%
\glossarystyle{listgroup}}

\newglossaryentry{ppm}{name=ppm,description={parts per million}} 
\newglossaryentry{ppb}{name=ppb,description={parts per billion}} 

\begin{document}

The units are expressed in \gls{ppm}.
The units are expressed in \gls{ppb}.

\printglossary[type=main,style=EstiloGlosario]

\end{document}

The resulting glossary:

enter image description here

If you're not interested in balanced columns, you could use \twocolumn and \onecolumn instead of the multicols environment:

\renewcommand*{\glossarysection}[2][]{%
  \twocolumn\chapter*{#2}
  \setlength\glsdescwidth{0.6\linewidth}%
  \glossarymark{\glossarytoctitle}%
}
\renewcommand*{\glossarypostamble}{\onecolumn}
Gonzalo Medina
  • 505,128