我正在尝试制作更自动化的乳胶简历。我希望我的参考资料部分以“同行评审出版物(N 位第一作者,M 位总作者):”开头
对于 M 总数,我找到了一个基于的解决方案这个帖子:
\usepackage{totcount}
\newtotcounter{citnum} %From the package documentation
\def\oldbibitem{} \let\oldbibitem=\bibitem
\def\bibitem{\stepcounter{citnum}\oldbibitem}
\renewcommand{\refname}{Refereed Publications [N first author, \total{citnum} total]:}
这会导致该部分的标题Bibliography
变为Refereed Publications [9 first author, 45 total]:
,其中本例中的数字9
是硬编码的,并且该数字45
已由 latex 计算出来。
我怎样才能进行同样的计数,但只针对我作为第一作者的 N 篇出版物?
MWE 根据 Johannes_B 的要求添加:
\documentclass{article}
\usepackage{natbib}
\usepackage{totcount}
\newtotcounter{citnum} %From the package documentation
\def\oldbibitem{} \let\oldbibitem=\bibitem
\def\bibitem{\stepcounter{citnum}\oldbibitem}
\renewcommand{\refname}{Refereed Publications [2 first author, \total{citnum} total]:}
\begin{document}
\nocite{*}
\bibliographystyle{apj_revchron}
\bibliography{mwe}
\end{document}
使用 bib 文件mwe.bib
:
@article{one,
author = {{me}, a. and {you}, b.},
title = {one},
journal = {one},
year = {2015},
}
@article{two,
author = {{you}, a. and {me}, b.},
title = {two},
journal = {two},
year = {2015},
}
@article{three,
author = {{me}, a. and {you}, b. and {them}},
title = {three},
journal = {three},
year = {2015},
}
这样就会导致标题:
Refereed Publications [2 first author, 3 total]:
我的问题是,这里如何2
自动确定?
答案1
这里的解决方案主要来自奥黛丽在使用 biblatex 计算参考文献数量
%\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{one,
author = {Bee, B. and Wombat, W.},
title = {Loving cobblestone},
journal = {Stones weekly},
year = {2015},
keywords = {mefirst},
}
@article{two,
author = {Wombat, W. and Bee, B.},
title = {Flying Penguins},
journal = {MP Monthly},
year = {2015},
}
@article{three,
author = {Bee, Busy and Wombat, Walzing and Penguins},
title = {Animal Friendships},
journal = {Madagascar Quarterly},
year = {2015},
keywords = {mefirst},
}
\end{filecontents}
\documentclass{article}
\usepackage{biblatex}
\addbibresource{\jobname.bib}
\defbibheading{bibliography}[]{\section*{Refereed Publications}
\arabic{firstA} as first author, a total of \arabic{sum}\medbreak
}
\newcounter{firstA}
\newcounter{notfirst}
\AtDataInput{%
\ifboolexpr{ test {\ifkeyword{mefirst}} }
{ \stepcounter{firstA} }
{ \stepcounter{notfirst} }%
}
\newcounter{sum}
\begin{document}
\defcounter{sum}{\value{firstA}+\value{notfirst}}
\nocite{*}
\printbibliography
\end{document}