我只需要将 bib 文件中的其中一个参考文献加粗显示在参考书目中。以下是我的参考文献:
@article{papike1982lunar,
title={The lunar regolith: Chemistry, mineralogy, and petrology},
author={Papike, JJ and Simon, S B\_ and Laul, JC},
journal={Reviews of Geophysics},
volume={20},
number={4},
pages={761--826},
year={1982},
publisher={Wiley Online Library}
}
如果我添加\textbf
,{}
则什么都不会改变。
这是我的代码:
\documentclass{aa}
\usepackage{array}
\newcolumntype{C}{>{$}c<{$}}
\usepackage{adjustbox}
\usepackage[skip=0.333\baselineskip]{caption}
\usepackage{booktabs,
amsmath,
siunitx}
\usepackage{url}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{xspace}
\usepackage[varg]{txfonts}
\usepackage{hyperref}
\begin{document}
\title
\section
\bibliographystyle{aa}
\bibliography{references}
\end{document}
应进行哪些更改才能使此引用变为粗体?
答案1
natbib
这是一种适合您所使用的参考书目样式(以及可能其他样式)的方法。
我定义了一个命令\makeboldref{⟨cite list⟩}
,将 中的每个项目添加到⟨cite list⟩
参考文献列表中,使其变为粗体。稍后,在打印参考文献列表时,将根据该列表中的引用键进行检查,并相应地将其变为粗体。您可以\makeboldref
根据需要使用任意次数的键。每个键都将添加到粗体参考文献列表中。
这是输出(我添加了另一个来显示差异):
代码如下:
\documentclass{aa}
\usepackage{filecontents}
\begin{filecontents}{references.bib}
@article{papike1982lunar,
title={The lunar regolith: Chemistry, mineralogy, and petrology},
author={Papike, JJ and Simon, S B\_ and Laul, JC},
journal={Reviews of Geophysics},
volume={20},
number={4},
pages={761--826},
year={1982},
publisher={Wiley Online Library}
}
@inproceedings {Gentleman1966,
address = {New York},
author = {Gentleman, W Morven and Sande, G},
booktitle = {Proceedings of the fall joint computer conference on XX - AFIPS '66},
doi = {10.1145/1464291.1464352},
pages = {563},
publisher = {ACM Press},
title = {{Fast Fourier Transforms---For Fun and Profit}},
url = {http://portal.acm.org/citation.cfm?doid=1464291.1464352},
year = {1966}}
\end{filecontents}
%%% Code to make bold references
\usepackage{xparse}
\ExplSyntaxOn
\seq_new:N \g_yasamin_boldcite_seq
\cs_new_eq:NN \__yasamin_org_bibitem:wn \bibitem
\RenewDocumentCommand \bibitem { O{} m }
{
\seq_if_in:NnTF \g_yasamin_boldcite_seq {#2}
{ \__yasamin_boldify_bibitem:nnw {#1} {#2} }
{ \__yasamin_org_bibitem:wn [#1] {#2} }
}
\cs_new_protected:Npn \__yasamin_boldify_bibitem:nnw #1 #2 #3 \par
{
\__yasamin_org_bibitem:wn [#1] {#2}
\group_begin:
\bfseries #3 \tex_par:D
\group_end:
}
\NewDocumentCommand \makeboldref { m }
{
\seq_set_from_clist:Nn \l_tmpa_seq {#1}
\seq_gconcat:NNN \g_yasamin_boldcite_seq \g_yasamin_boldcite_seq \l_tmpa_seq
}
\ExplSyntaxOff
%%% End of code
\usepackage{array}
\newcolumntype{C}{>{$}c<{$}}
\usepackage{adjustbox}
\usepackage[skip=0.333\baselineskip]{caption}
\usepackage{booktabs,
amsmath,
siunitx}
\usepackage{url}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{xspace}
\usepackage[varg]{txfonts}
\usepackage{hyperref}
\begin{document}
\title{aa}
\section{aa}
\cite{papike1982lunar,Gentleman1966}
\makeboldref{papike1982lunar} % <-- Adding to list of bold citations
\bibliographystyle{aa}
\bibliography{references}
\end{document}
答案2
如果您愿意改用biblatex
,则可以使用参考书目类别轻松实现此目的:
% define a new bibliography category
\DeclareBibliographyCategory{boldcitations}
% list of citations to make bold
\addtocategory{boldcitations}{papike1982lunar,SomeOtherPaper}
% sort-of ugly hack to make the citation bold:
\AtEveryBibitem{%
\ifcategory{boldcitations}
{\bfseries}
{}}
完整文档:
\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\DeclareBibliographyCategory{boldcitations} % define a new bibliography category
\addtocategory{boldcitations}{papike1982lunar,SomeOtherPaper} % list of citations to make bold
\AtEveryBibitem{%
\ifcategory{boldcitations}
{\bfseries} % ugly hack to make the citation bold
{}}
\addbibresource{references.bib}
\usepackage{filecontents} % just for demonstration
\begin{filecontents*}{references.bib}
@inproceedings{TestDoe,
title={This is a Test},
author={Doe, Jane and Roe, John},
booktitle={2016 Placeholder Conference on Citation Testing},
pages={1--2},
year={2016}
}
@inproceedings{TestSmith,
title={This is also a Test},
author={Smith, John and Jones, Ben},
booktitle={2016 Placeholder Conference on Citation Testing},
pages={3--4},
year={2016}
}
@article{papike1982lunar,
title={The lunar regolith: Chemistry, mineralogy, and petrology},
author={Papike, JJ and Simon, S B\_ and Laul, JC},
journal={Reviews of Geophysics},
volume={20},
number={4},
pages={761--826},
year={1982},
publisher={Wiley Online Library}
}
\end{filecontents*}
\begin{document}
\cite{papike1982lunar}, \cite{TestSmith},\cite{TestDoe}
\printbibliography
\end{document}