# List of Acronyms without line spacing

I use the acronym-package for my acronyms.

To create my List of Acronyms I have the following code in my main.tex:

\usepackage[printonlyused, withpage]{acronym}
...
\section*{List of Acronyms}
\input{../assets/acronyms}


and the acronyms.tex looks like:

\begin{acronym}
...
\acro{JSON}{JavaScript Object Notation}

\acro{REST}{Representational State Transfer}
...
\end{acronym}


The result is this:

I really dislike the spaces between the acronyms and would prefer no line spacing, as in my List of Listings:

Since the acronym environment is really just a description environment, one possibility is to specify the itemsep of the acronym environment:

\documentclass{report}
\usepackage[withpage]{acronym}

\begin{document}

\tableofcontents

\section*{List of Acronyms}

\begin{acronym}[JSONP]\itemsep0pt %change this amount as desired
\acro{JSON}{JavaScript Object Notation}
\acro{REST}{Representational State Transfer}
\end{acronym}

\section{Foo}

\ac{JSON} and \ac{JSONP}.

\section{Bar}

\ac{REST}.

\end{document}


• It would be nice if you could add a picture of what the output looks like :) Really adds to the quality of the answer, imo – Troy Apr 13 '17 at 12:04
• Adding only \itemsep did not work but you need the [JSONP]-parameter as well. I did not understand why, but people following this solution should watch for that. – tjati Apr 15 '17 at 10:21

The environment to patch is called AC@deflist, which we want to add \setlength{\itemsep}{0pt} to.

\documentclass{report}
\usepackage[printonlyused,withpage]{acronym}
\usepackage{xpatch}

\makeatletter
\xpatchcmd{\AC@deflist}
{}{}
\makeatother

\begin{document}

\tableofcontents

\section*{List of Acronyms}

\begin{acronym}[JSONP]
\acro{JSON}{JavaScript Object Notation}
\acro{REST}{Representational State Transfer}
\end{acronym}

\section{Foo}

\ac{JSON} and \ac{JSONP}.

\section{Bar}

\ac{REST}.

\end{document}


Internally acronym uses description. So you can either (1) redefine acronym using your own list structure, or (2) just before acronym redefine description. Here is the second approach. I've added \itemsep0pt\parsep0pt to the standard definition of description.

\documentclass{article}

\usepackage{acronym}
\pagestyle{empty}
\begin{document}

\renewenvironment{description}
{\list{}{\labelwidth0pt\itemindent-\leftmargin
\parsep0pt\itemsep0pt\let\makelabel\descriptionlabel}}
{\endlist}
\begin{acronym}
\acro{JSON}{JavaScript Object Notation}
\acro{REST}{Representational State Transfer}
\end{acronym}
\end{document}


UPDATE When perpage option is used, the package adds an extra \\, probably a bug. So in this case we need to redefine the way package prints the items as well:

\documentclass{article}
\usepackage[printonlyused, withpage]{acronym}
\pagestyle{empty}
\makeatletter
\def\AC@@acro#1[#2]#3{%
\ifAC@nolist%
\else%
\ifAC@printonlyused%
\expandafter\ifx\csname acused@#1\endcsname\AC@used%
\item[\protect\AC@hypertarget{#1}{\aclabelfont{#2}}] #3%
\ifAC@withpage%
\expandafter\ifx\csname r@acro:#1\endcsname\relax%
\PackageInfo{acronym}{%
Acronym #1 used in text but not spelled out in
full in text}%
\else%
\dotfill\pageref{acro:#1}% Sputious \\ deleted
\fi
\fi%
\fi%
\else%
\item[\protect\AC@hypertarget{#1}{\aclabelfont{#2}}] #3%
\fi%
\fi%
\begingroup
\def\acroextra##1{}%
\@bsphack
\protected@write\@auxout{}%
\@esphack
\endgroup}
\makeatother

\begin{document}
We use \ac{JSON}, \ac{JSONP}, \ac{REST}.

\renewenvironment{description}
{\list{}{\labelwidth0pt\itemindent-\leftmargin
\parsep0pt\itemsep0pt\let\makelabel\descriptionlabel}}
{\endlist}
\begin{acronym}
\acro{JSON}{JavaScript Object Notation}

\acro{REST}{Representational State Transfer}
\end{acronym}
\end{document}
\documentclass{beamer}
\usepackage{graphicx}
\begin{document}

\begin{figure}
\begin{center}
\input{tmp1.tex}
\caption{Enter caption here}
\label{Enter label here}
\end{center}
\end{figure}

\end{document}