![首字母缩略词包和 apacite - 引用:括号周围(首字母缩略词;作者,年份)](https://linux22.com/image/344168/%E9%A6%96%E5%AD%97%E6%AF%8D%E7%BC%A9%E7%95%A5%E8%AF%8D%E5%8C%85%E5%92%8C%20apacite%20-%20%E5%BC%95%E7%94%A8%EF%BC%9A%E6%8B%AC%E5%8F%B7%E5%91%A8%E5%9B%B4%EF%BC%88%E9%A6%96%E5%AD%97%E6%AF%8D%E7%BC%A9%E7%95%A5%E8%AF%8D%EF%BC%9B%E4%BD%9C%E8%80%85%EF%BC%8C%E5%B9%B4%E4%BB%BD%EF%BC%89.png)
我正在使用该acronym
包并且遇到格式问题:
\usepackage[acronym]
\newacro{FWA}{Full Written Acronym}
with \ac{FWA} \cite{FWA_paper} it looks like this:
(FWA) (J. Doe, 2016)
但是我需要它看起来像这样(这就是 APA 标准)
Full Written Acronym (FWA; J. Doe, 2016)
我发现的一个解决方法是像这样写:
\acl{FWA} ( \acf{FWA}; \citeNP{FWA_paper})
然而,下次我\ac{FWA}
再次使用它时会写入完整版本,因为这是它第一次出现在文本中。
有什么解决办法吗?
编辑:
我找到了一个使用 python 的解决方案;)
#!/usr/bin/python
import fileinput
fileToSearch = 'myDocument.tex'
acroList = ["FOO","BAR","ACRO3"]
# replace all \ac with \acs
for acro in acroList:
textToSearch = "\\ac{" + acro + "}"
textToReplace = "\\acs{" + acro + "}"
with fileinput.FileInput(fileToSearch, inplace=True, backup='.bak') as file:
for line in file:
print(line.replace(textToSearch, textToReplace), end='')
# replace the first occurence in the file with the long + short + cite version
for acro in acroList:
first = 1
textToSearch = "\\acs{" + acro + "}"
textToReplace = "\\acl{" + acro + "}(" "\\acs{" + acro + "};\\citeNP{XXXXXXXX" + acro + "})"
with fileinput.FileInput(fileToSearch, inplace=True, backup='.bak') as file:
for line in file:
newLine = line.replace(textToSearch, textToReplace,1)
if newLine.find("XXXXXXXX" + acro) > -1 & first == 1:
first = 0
print(newLine, end='')
else:
print(line, end='')
运行脚本后,您必须将引用复制到 XXXXXXACRO 空间持有者。这不是完美的解决方案,但对我来说很有效。无论如何,谢谢
答案1
我正在使用类似的解决方法,添加命令 \glsunset
,解决重复完整缩写版本的问题,如下所示:
\Acl{bpe} \glsunset{bpe} (\acs{bpe}; \citealp{sennrich-etal-2016-neural})
渲染结果如下:
字节对编码(BPE;Sennrich 等人,2016)
所有后续用法都\ac{bpe}
将呈现为“BPE”。