2

I'm encountering a weird problem when changing my list of acronyms from the long to the longragged style. This is an example for illustration:

\documentclass{article}

\usepackage[acronym,nomain,sanitize={description=false,symbol=false}]{glossaries}
\usepackage{glossary-longragged}
\makeglossaries

\newglossarystyle{longraggeduc}{%
%  \glossarystyle{long}%  <-- works
  \glossarystyle{longragged}%  <-- does not work
  \renewcommand*\glossaryentryfield[5]{%
    \glstarget{##1}{##2} & \makefirstuc{##4}##3\glspostdescription\space##5\\
  }
}

\newacronym{acr:abc}{ABC}{a b c}
\newacronym{acr:def}{DEF}{d e f}

\begin{document}
\gls{acr:abc} \gls{acr:def}

\printglossary[type=\acronymtype,style=longraggeduc,nonumberlist=true]
\end{document}

I'm redefining \glossaryentryfield because of a special style I need to have, including the capitalization of the first letter of the description. That stuff works with the long style, but stops working with the longragged style (see the commented line).

LaTeX (pdflatex) complains

! Extra alignment tab has been changed to \cr.

when processing the .acr file generated by makeglossaries.

I'm kind of stuck with that problem since I'm unable to identify the reason. Any ideas?

  • @TorbjørnT. Well, no error then; anyway it does not lead to the expected result, since & is the alignment character needed to enter the second column of the longtable. – Christoph Apr 15 '12 at 14:30
4

longragged uses \raggedright, which redefines \\ and this means that you can't use \\ to end a tabular line. Use \tabularnewline instead:

\\newglossarystyle{longraggeduc}{%
%  \glossarystyle{long}%  <-- works
  \glossarystyle{longragged}%  <-- does not work
  \renewcommand*\glossaryentryfield[5]{%
    \glstarget{##1}{##2} & \makefirstuc{##4}##3\glspostdescription\space##5\tabularnewline
  }
}
| improve this answer | |
  • Awesome - did not expect that one to cause trouble, even though I had a similar problem before. – Christoph Apr 15 '12 at 15:22

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.