我已经按照以下说明在我的 .bib 文件中使用 natbib 实现了 circa 标签这个 tex.stackexchange.com 答案。
有没有一种简单的方法可以修改它,以便我可以在文内引用中生成“ca。”?据我所知,natbib 提取年份字段中的最后四个字符以在文内引用中生成,因此我不确定如何轻松地在前面添加字符而不执行\xpatchcmd{}
或类似操作。
梅威瑟:
是.bst
这里。
\documentclass{article}
\usepackage{url}
\usepackage{csquotes}
\usepackage{natbib}
\usepackage{filecontents}
\newcommand{\noopsort}[1]{} % old BibTeX trick
\begin{filecontents}[overwrite]{\jobname.bib}
@book{dante_paradiso_1317,
title = {Paradiso},
author = {Alighieri, Dante},
year = {\noopsort{1317}ca. 1317},
note = {Canto XVI}
}
@book{asimov_robot_1950,
title={I, Robot},
author={Asimov, I.},
isbn={9780451012821},
lccn={68070665},
series={Panther science fiction},
url={https://books.google.co.nz/books?id=MD0GAQAAIAAJ},
year={1950},
publisher={Dennis Dobson}
}
\end{filecontents}
\begin{document}
In \textit{Paradiso}, Dante writes
\begin{displayquote}
E come 'l volger del ciel de la luna \\
cuopre e discuopre i liti sanza posa, \\
così fa di Fiorenza la Fortuna: \\
\begin{flushright}
-- Alighieri (ca. 1317)\nocite{dante_paradiso_1317}
\end{flushright}
\end{displayquote}
which is a really cool line in Canto XVI. Also in \textit{I, Robot}, Asimov introduces the three laws of robotics:
\begin{displayquote}
The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm. \\
The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law. \\
The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
\begin{flushright}
-- \citet{asimov_robot_1950}
\end{flushright}
\end{displayquote}
\bibliographystyle{mnras}
\bibliography{\jobname.bib}
\end{document}
MWE 输出:
期望输出:
答案1
简而言之,我需要编辑.bst
文件。在 的定义中calc.label
,
year field.or.null purify$ #-1 #4 substring$ % use all four digits
变成
year field.or.null #-1 #8 substring$ % use all eight characters (year + "ca. " if it exists)
如果要使用较短的“ca. ”,请更改#8
。数字必须是4+number of characters preceding the year in the .bib key to include
。