줄 간격이 없는 약어 목록

줄 간격이 없는 약어 목록

나는 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지정하는 것이 한 가지 가능성입니다 .itemsepacronym

\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

내부적으로 acronymdescription. 따라서 (1) acronym자신의 목록 구조를 사용하여 재정의하거나 (2) acronym재정의 직전에 할 수 있습니다 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{acronym}[JSONP]
...
  \acro{JSON}{JavaScript Object Notation}
  \acro{JSONP}{JavaScript Object Notation with Padding}

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

예, 그게 전부입니다. \itemsep0pt맞춤 줄 간격이 필요한 경우에만 필요합니다.

관련 정보