指南指出,引用格式必须包含作者的四个字母、一个不可中断的空格和年份的最后两位数字。使用 BibLaTeX 并设置“style=alphabetic”选项就很接近了。但这种格式只使用了三个字母,而且缺少空格。
以下是 MWE:
\begin{filecontents}{\jobname.bib}
@book{longfellow:limmericks,
author = {Longfellow, Louis},
title = {Long Lasting Last Limmericks},
publisher = {Limmerick Lounge},
year = {2022}
}
\end{filecontents}
\documentclass{scrartcl}
\usepackage[style=alphabetic]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
\cite{longfellow:limmericks}
\printbibliography
\end{document}
它看起来是这样的。它给出的不是所要求的 [Long 22],而是 [Lon22]。
如何改变这一现状?
答案1
您可以使用\DeclareLabelalphaTemplate
以下方法来格式化标签:
\begin{filecontents}{\jobname.bib}
@book{longfellow:limmericks,
author = {Longfellow, Louis},
title = {Long Lasting Last Limmericks},
publisher = {Limmerick Lounge},
year = {2022}
}
\end{filecontents}
\documentclass{scrartcl}
\usepackage[style=alphabetic]{biblatex}
\DeclareLabelalphaTemplate{
\labelelement{
\field[strwidth=4,strside=left,names=1,noalphaothers=true]{labelname}
}
\labelelement{
\literal{\nobreakspace}
}
\labelelement{
\field[strwidth=2,strside=right]{year}
}
}
\addbibresource{\jobname.bib}
\begin{document}
\cite{longfellow:limmericks}
\printbibliography
\end{document}