약어 패키지 - 다음 인용/괄호와 함께 첫 번째 약어를 병합합니다.

약어 패키지 - 다음 인용/괄호와 함께 첫 번째 약어를 병합합니다.

패키지를 사용하고 있습니다 acronym. 내 텍스트에서 다음과 같은 내용이 자주 발생합니다.

1. We first use a \ac{NA} \citep{exocom2019} and then the text continues.

2. We learn a \ac{VL} (i.e., something we did not know before).

텍스트에서 다음과 같이 표시됩니다.

  1. 먼저 NA(New Acronym)(Exocom, 2019)를 사용한 다음 텍스트가 계속됩니다.

  2. 우리는 VL(Valuable Lesson)(즉, 이전에 몰랐던 것)을 배웁니다.

acronym패키지에 괄호를 병합할 수 있는 방법이 있나요 ? 어떤 방식으로든 출력은 다음과 같습니다.

  1. 먼저 새로운 약어(NA; Exocom, 2019)를 사용한 다음 텍스트가 계속됩니다.

  2. 우리는 귀중한 교훈(VL, 즉 이전에 몰랐던 것)을 배웁니다.

누군가가 문제에 대한 또 다른 좋은 해결책이나 해결 방법을 가지고 있는 경우 알려주시기 바랍니다.

추신: 요청에 따라 예제를 업데이트하고 코드를 추가하려고 했습니다. 도움이 되었기를 바랍니다.

조달청: MWE

--- mwe.tex ---

\documentclass[12pt]{book}

\usepackage[printonlyused]{acronym} % used for the nice acronyms
\usepackage[style=authoryear-comp,citestyle=authoryear,natbib=true,backend=bibtex,maxbibnames=99,maxcitenames=1]{biblatex} %NEW BIB: needed so that bibentry works

\bibliography{mweBib}

\begin{document}

\begin{acronym}
    \acro{NA}{New Acronym} 
    \acro{VL}{Valuable Lesson} 
\end{acronym}

1. We first use a \ac{NA} \citep{exocom2019} and then the text continues.

2. We learn a \ac{VL} (i.e., something we did not know before).
\end{document}

--- mweBib.bib ---

@inproceedings{exocom2019,
  title={My title},
  author={Exocom},
  year={2019},
  booktitle = {Proc. Stackexchange}
}

--- 명령 ---

latexmk -pvc mwe.tex

답변1

이는 패키지로 가능합니다 acro:

  • 옵션을 설정 cite/group = true하고 약어 정의에 인용을 추가하면 인용이 이미 내장되어 있습니다.

  • 기본 템플릿을 재정의하여 일회성 추가가 가능합니다…

      \RenewAcroTemplate{long-short}{%
        \acroiffirstTF{%
          \acrowrite{long}%
          \acspace(%
            \acroifT{foreign}{\acrowrite{foreign}, }%
            \acrowrite{short}%
            \acroifT{alt}{ \acrotranslate{or} \acrowrite{alt}}%
            \acaddition % <<< new
            \acrogroupcite
          )%
        }{%
          \acrowrite{short}%
          \acaddition % <<< new
        }%
      }
    

    ...그리고 명령은 다음과 \ac같습니다.

      \providecommand\acaddition{}
      \RenewAcroCommand\ac{mo}{%
        \IfNoValueF{#2}{\def\acaddition{, #2}}%
        \UseAcroTemplate{first}{#1}%
      }
    

    및 친구 에 의해 정의된 명령은 \NewAcroCommand그룹에 로컬이므로 나중에 정의에 대해 걱정할 필요가 없습니다 \acaddition.

완전한 예:

여기에 이미지 설명을 입력하세요

\documentclass{article}

\usepackage[style=authoryear-comp,citestyle=authoryear]{biblatex}
\addbibresource{\jobname.bib}


\begin{filecontents}{\jobname.bib}
@inproceedings{exocom2019,
  title={My title},
  author={Exocom},
  year={2019},
  booktitle = {Proc. Stackexchange}
}
\end{filecontents}

\usepackage{acro}

\RenewAcroTemplate{long-short}{%
  \acroiffirstTF{%
    \acrowrite{long}%
    \acspace(%
      \acroifT{foreign}{\acrowrite{foreign}, }%
      \acrowrite{short}%
      \acroifT{alt}{ \acrotranslate{or} \acrowrite{alt}}%
      \acaddition % <<< new
      \acrogroupcite
    )%
  }{%
    \acrowrite{short}%
    \acaddition % <<< new
  }%
}

\providecommand\acaddition{}
\RenewAcroCommand\ac{mo}{%
  \IfNoValueF{#2}{\def\acaddition{, #2}}%
  \UseAcroTemplate{first}{#1}%
}

\acsetup{
  cite/group = true
}

\DeclareAcronym{NA}{
  short = NA ,
  long = New Acronym ,
  cite = exocom2019
}
\DeclareAcronym{VL}{
  short = VL ,
  long = Valuable Lesson
}

\begin{document}

\begin{enumerate}
  \item We first use a \ac{NA} and then the text continues.
  \item We learn a \ac{VL}[i.e., something we did not know before].
\end{enumerate}

\end{document}

관련 정보