Ich verwende das acronym
-Paket für meine Akronyme.
Um meine Liste mit Akronymen zu erstellen, habe ich den folgenden Code in meiner main.tex:
\usepackage[printonlyused, withpage]{acronym}
...
\section*{List of Acronyms}
\input{../assets/acronyms}
und die Datei acronyms.tex sieht folgendermaßen aus:
\begin{acronym}
...
\acro{JSON}{JavaScript Object Notation}
\acro{JSONP}{JavaScript Object Notation with Padding}
\acro{REST}{Representational State Transfer}
...
\end{acronym}
Die Leerzeichen zwischen den Akronymen gefallen mir überhaupt nicht und ich hätte lieber keinen Zeilenabstand, wie in meiner Listing-Liste:
Antwort1
Da die acronym
Umgebung eigentlich nur eine Umgebung ist , besteht eine Möglichkeit darin, den Charakter der Umgebung description
anzugeben :itemsep
acronym
\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}
Antwort2
Die zu patchende Umgebung heißt AC@deflist
, die wir ergänzen möchten \setlength{\itemsep}{0pt}
.
\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}
Antwort3
acronym
Verwendet intern description
. Sie können also entweder (1) acronym
mithilfe Ihrer eigenen Listenstruktur neu definieren oder (2) direkt vor acronym
dem Neudefinieren description
. Hier ist der zweite Ansatz. Ich habe \itemsep0pt\parsep0pt
zur Standarddefinition von hinzugefügt 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}
AKTUALISIERENWenn perpage
die Option verwendet wird, fügt das Paket ein zusätzliches hinzu \\
, wahrscheinlich ein Fehler. In diesem Fall müssen wir also auch die Art und Weise neu definieren, wie das Paket die Elemente druckt:
\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}
Antwort4
Ich weiß, dass das schon ein paar Jahre alt ist. Ich hatte jedoch gerade das gleiche Problem und habe eine einfachere Lösung gefunden, die ich teilen möchte.
Beim Definieren der Liste der Akronyme wie in der Frage:
\begin{acronym}
...
\acro{JSON}{JavaScript Object Notation}
\acro{JSONP}{JavaScript Object Notation with Padding}
\acro{REST}{Representational State Transfer}
...
\end{acronym}
Fügen Sie einfach das längste Akronym in eckigen Klammern nach der Begin-Anweisung wie folgt hinzu:
\begin{acronym}[JSONP]
...
\acro{JSON}{JavaScript Object Notation}
\acro{JSONP}{JavaScript Object Notation with Padding}
\acro{REST}{Representational State Transfer}
...
\end{acronym}
Ja, das ist alles. \itemsep0pt
Es ist nur erforderlich, wenn Sie einen benutzerdefinierten Zeilenabstand benötigen.