List of Acronyms without line spacing

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{JSONP}{JavaScript Object Notation with Padding}
  \acro{REST}{Representational State Transfer}
\end{acronym}

\section{Foo}

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

\section{Bar}

\ac{REST}.

\end{document}

acronym


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{JSONP}{JavaScript Object Notation with Padding}
  \acro{REST}{Representational State Transfer}
\end{acronym}
\end{document}

enter image description here

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{}%
       {\string\newacro{#1}[\string\AC@hyperlink{#1}{#2}]{#3}}%
    \@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{JSONP}{JavaScript Object Notation with Padding}

  \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}

enter image description here


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}
  {\addtolength{\leftmargin}{\labelsep}}
  {\addtolength{\leftmargin}{\labelsep}\setlength{\itemsep}{0pt}}
  {}{}
\makeatother

\begin{document}

\tableofcontents

\section*{List of Acronyms}

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

\section{Foo}

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

\section{Bar}

\ac{REST}.

\end{document}

enter image description here

Tags:

Acronyms