2

I need to make just one of my references in my bib file, bold in the bibliography. Here is my references:

@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}
}

If I add \textbf in the {}, nothing changed.

Here is my code:

\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}

What should be changed to have this reference bold?

4
  • There is no \bibliographystyle called aa in my TeX distribution. Where did you get it from? Commented May 16, 2019 at 15:12
  • @PhelypeOleinik It is the docuement class of the journal template I need to submit my paper
    – Yasamin
    Commented May 16, 2019 at 15:21
  • Yes, but the name aa is not Google friendly. Is it this one ftp.edpsciences.org/pub/aa/readme.html ? Commented May 16, 2019 at 15:28
  • @PhelypeOleinik Yes. It is this.
    – Yasamin
    Commented May 16, 2019 at 15:30

2 Answers 2

2

Here's an approach that works with natbib and the bibliography style you are using (and potentially others).

I defined a command \makeboldref{⟨cite list⟩} which adds each item in the ⟨cite list⟩ to a list of references to make bold. Later, when the list of references is being printed each citation key is checked against the ones in that list and made bold accordingly. You can use \makeboldref as many times as you need with as many keys as necessary. Each one will be added to the list of bold references.

Here's the output (I added another one to show the difference):

enter image description here

And the code:

\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}
10
  • Thank you for your detailed answer. Shoul I add this code to the beginning of my main code?
    – Yasamin
    Commented May 17, 2019 at 15:45
  • @Yasamin You need to add everything from the %%% Code to make bold references until the %%% End of code, which is the commands I defined to make the item bold. After that use \makeboldref like in the example for each reference you want to make bold. Commented May 17, 2019 at 15:51
  • Great. It worked. Thanks alot.
    – Yasamin
    Commented May 17, 2019 at 15:59
  • 2
    @Yasamin I'm not asking you to change, I'm just curious. If this answer worked why did you mark the other one as “accepted”? Commented May 17, 2019 at 17:19
  • 1
    I fix it now and it worked good. Thank you again.
    – Yasamin
    Commented May 20, 2019 at 10:03
2

If you're willing to switch to using biblatex, you can achieve this fairly easily using bibliography categories:

% 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}
      {}}

Full document:

\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}

enter image description here

2
  • But is there anyway to not switcing to biblatex? Because by adding these codes I get tons of erros. It seems it makes everything different and I can not fix the errors as a beginner.
    – Yasamin
    Commented May 16, 2019 at 15:23
  • @Yasamin If you need to use a specific template/document class that doesn't support biblatex (like your aa, which turns out to use natbib), see Phelype's answer. This one's more of an alternative for people who do have a choice. Commented May 17, 2019 at 8:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .