![引用首字母缩略词的第一个实例](https://linux22.com/image/386465/%E5%BC%95%E7%94%A8%E9%A6%96%E5%AD%97%E6%AF%8D%E7%BC%A9%E7%95%A5%E8%AF%8D%E7%9A%84%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%AE%9E%E4%BE%8B.png)
我使用glossaries
包中的首字母缩略词,这样我就可以做到这一点:
\newacronym{MIRDD}{MIRDD}{Mid-Infrared Diagnostic Diagram}
\gls{MIRDD}
\gls{MIRDD}
这将存储缩写词,然后打印
Mid-Infrared Diagnostic Diagram (MIRDD)
MIRDD
不过,如果我能这样做就好了:
\newacronym[\citep{Person2018}]{MIRDD}{MIRDD}{Mid-Infrared Diagnostic Diagram}\gls{MIRDD}
\gls{MIRDD}
\gls{MIRDD}
有可能
\glscite{MIRDD}
这样它就会打印:
Mid-Infrared Diagnostic Diagram (MIRDD; Person et al. 2018)
MIRDD
有可能
MIRDD (Person et al. 2018)
使用常见的 natbib 内容。
这可能吗??
我查看了文档,虽然支持前缀,但似乎不支持后缀或类似的东西。
答案1
最简单的方法是glossaries-extra
:
\documentclass{article}
\usepackage{natbib}
\usepackage[postdot]{glossaries-extra}
\makeglossaries
\setabbreviationstyle[acronym]{long-short-user}
\renewcommand*{\glsxtruserparen}[2]{% requires glossaries-extra v1.04+
\glsxtrfullsep{#2}%
\glsxtrparen
{#1\ifglshasfield{\glsxtruserfield}{#2}{;
\expandafter\citet\expandafter{\glscurrentfieldvalue}}{}}%
}
\glsdefpostdesc{acronym}{% requires glossaries-extra v1.31+
\ifglshasfield{\glsxtruserfield}{\glscurrententrylabel}%
{~\expandafter\citep\expandafter{\glscurrentfieldvalue}}%
{}%
}
\newacronym[user1={article-minimal}]{MIRDD}{MIRDD}{Mid-Infrared Diagnostic Diagram}
\begin{document}
First use: \gls{MIRDD}. Next use: \gls{MIRDD}.
\printglossary
\bibliographystyle{plainnat}
\bibliography{xampl}
\end{document}
基础glossaries
包被隐式加载,但至少需要 4.23 版本才能\glscurrentfieldvalue
在 的真实部分中使用\ifglshasfield
。此示例生成:
该user1
字段可能包含以逗号分隔的引用标签列表。
此示例效果不佳,hyperref
因为首次使用时会出现嵌套超链接。最简单的解决方法是在首次使用时禁用超链接:
\documentclass{article}
\usepackage{natbib}
\usepackage[colorlinks]{hyperref}
\usepackage[postdot]{glossaries-extra}
\makeglossaries
\setabbreviationstyle[acronym]{long-short-user}
\glssetcategoryattribute{acronym}{nohyperfirst}{true}
\renewcommand*{\glsxtruserparen}[2]{% requires glossaries-extra v1.04+
\glsxtrfullsep{#2}%
\glsxtrparen
{#1\ifglshasfield{\glsxtruserfield}{#2}{;
\expandafter\citet\expandafter{\glscurrentfieldvalue}}{}}%
}
\glsdefpostdesc{acronym}{% requires glossaries-extra v1.31+
\ifglshasfield{\glsxtruserfield}{\glscurrententrylabel}%
{~\expandafter\citep\expandafter{\glscurrentfieldvalue}}%
{}%
}
\newacronym[user1={article-minimal}]{MIRDD}{MIRDD}{Mid-Infrared Diagnostic Diagram}
\begin{document}
First use: \gls{MIRDD}. Next use: \gls{MIRDD}.
\printglossary
\bibliographystyle{plainnat}
\bibliography{xampl}
\end{document}