1

I am trying to include \dotfill between the name and description of the glossary entries of an acronym list using the glossaries package

I've managed to get the output I want with:

\renewcommand{\glossentry}[2]{\glsentryname{#1}\dotfill\glossentrydesc{#1}\par}

But I get 45 of these errors:

LaTeX Error: Something's wrong--perhaps a missing \item.

The glossary list prints fine without that line, just not in the format I want.

This is the output I want, just without the errors:

Desired Output

This is an example code snippet that results in the same error:

\documentclass{article}
\usepackage[nonumberlist, nopostdot]{glossaries}

\makeglossaries

\newacronym{adl}{ADL}{Activities of Daily Living} \newacronym{cmc}{CMC}{Carpometacarpal} \newacronym{dip}{DIP}{Distal Interphalangeal}

\begin{document}

\renewcommand{\glossentry}[2]{\glossentryname{#1}\dotfill\glossentrydesc{#1}\par}

\printglossary[type=\acronymtype, title=List of Acronyms]

\section*{Main Body} \acrfull{adl}, \acrfull{cmc},\acrfull{dip}

\end{document}

Thank you!

nick
  • 13
  • Welcome to TeX.SE! Please show us a short compilable TeX code resulting in your issue. Then we do not have to guess what you are doing ... – Mensch Dec 18 '23 at 22:05
  • Thank you for your comment Mensch. I've edited the question to include some code that shows the problem. – nick Dec 18 '23 at 22:25

1 Answers1

0

The default glossary style is essentially a description environment, so it expects to have at least one \item.

Either you can redefine the theglossary as

\renewenvironment{theglossary}{\glslistinit\setlength{\parindent}{0pt}}{}

so the entries aren't typeset inside a description environment (with \setlength{\parindent}{0pt} or similar being necessary for the MWE to get consistent indentations).

Or you can adapt the default \glossentry which uses \items to include a \dotfill as

\renewcommand*{\glossentry}[2]{%
\item[\glsentryitem{#1}%
\glstarget{#1}{\glossentryname{#1}}]%
\dotfill%
\glossentrydesc{#1}\glspostdescription\space#2}

This would then be affected by enumitem which may make spacing/positioning easier to modify.

Dai Bowen
  • 6,117
  • That worked, thank you Dai! How would I go about changing vertical spacing between entries and indenting with the \renewcommand option? – nick Dec 19 '23 at 09:17
  • Using the default theglossary you've got a description environment, this is generally best tweaked with enumitem, e.g. https://tex.stackexchange.com/a/91128/106162 and https://tex.stackexchange.com/a/10689/106162, more generally the enumitem documentation details all the options it can control. You can pass options through \setlist[description]{<options>} (this will effect all description environments unless suitably grouped). – Dai Bowen Dec 19 '23 at 10:18
  • Thank you Dai, this has been really helpful! In case this is useful for anyone looking into formatting like this as well, I used this to change the /dotfill spacing: https://tex.stackexchange.com/questions/85335/how-to-change-dot-spacing-in-dotfill – nick Dec 19 '23 at 11:05