我正在使用该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”。