acronym
頭字語には -package を使用します。
頭字語のリストを作成するには、main.tex に次のコードを追加します。
\usepackage[printonlyused, withpage]{acronym}
...
\section*{List of Acronyms}
\input{../assets/acronyms}
acronyms.tex は次のようになります。
\begin{acronym}
...
\acro{JSON}{JavaScript Object Notation}
\acro{JSONP}{JavaScript Object Notation with Padding}
\acro{REST}{Representational State Transfer}
...
\end{acronym}
私は頭字語間のスペースが本当に嫌いなので、私のリストのリストのように行間を空けないほうがいいと思います。
答え1
acronym
環境は実際には単なる環境であるため、環境の をdescription
指定することが 1 つの方法です。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}
答え2
パッチを適用する環境は と呼ばれAC@deflist
、これに追加します\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}
答え3
内部的にacronym
を使用しますdescription
。したがって、(1)acronym
独自のリスト構造を使用して を再定義するか、(2) 直前にacronym
を再定義することができます。以下は 2 番目のアプローチです。の標準定義にdescription
追加しました。\itemsep0pt\parsep0pt
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}
アップデートオプションを使用するとperpage
、パッケージは余分な を追加します\\
が、これはおそらくバグです。したがって、この場合、パッケージが項目を出力する方法も再定義する必要があります。
\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}
答え4
これはもう数年前の話ですが、私もちょうど同じ問題を抱えていて、もっと簡単な解決策を見つけたので、皆さんにシェアしたいと思います。
質問のように頭字語のリストを定義する場合:
\begin{acronym}
...
\acro{JSON}{JavaScript Object Notation}
\acro{JSONP}{JavaScript Object Notation with Padding}
\acro{REST}{Representational State Transfer}
...
\end{acronym}
次のように、begin ステートメントの後に角括弧で囲んだ最も長い頭字語を追加するだけです。
\begin{acronym}[JSONP]
...
\acro{JSON}{JavaScript Object Notation}
\acro{JSONP}{JavaScript Object Notation with Padding}
\acro{REST}{Representational State Transfer}
...
\end{acronym}
はい、それだけです。\itemsep0pt
カスタムの行間隔が必要な場合のみ必要です。