首字母縮寫詞包 - 將首次出現的首字母縮寫與以下引文/括號合併

首字母縮寫詞包 - 將首次出現的首字母縮寫與以下引文/括號合併

我正在使用該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)(Exocom,2019),然後繼續正文。

  2. 我們學到了寶貴的教訓(VL)(即我們以前不知道的東西)。

包中有沒有辦法acronym做到這一點,以便我可以合併括號?在某種程度上,輸出變成這樣:

  1. 我們首先使用新的縮寫(NA;Exocom,2019),然後文字繼續。

  2. 我們學到了寶貴的教訓(VL;即我們以前不知道的東西)。

如果有人有其他好的解決方案或解決方法來解決該問題,請告訴我。

PS:我嘗試更新範例並按要求添加程式碼。我希望這有幫助。

PPS: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}

相關內容