我正在使用该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).
在文本中看起来会像下面这样。
我们首先使用新缩写(NA)(Exocom,2019),然后继续正文。
我们学到了宝贵的教训(VL)(即我们以前不知道的东西)。
程序包中是否有方法acronym
可以执行此操作,以便我可以合并括号? 在某种程度上,输出将变成如下内容:
我们首先使用新缩写(NA;Exocom,2019),然后继续正文。
我们学到了宝贵的教训(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}