How to underline specific author name automatically in LaTex bibiolgraphy - latex

For a CV, I want to underline my name wherever it appears in a bibliography. I am using LaTex with biblatex. Is there an easy way to automatically underline a certain name? Thanks!
For example, I want "Name Surname" to be underlined automatically in all the entries in the bibliography.
\documentclass[12pt]{article}
\usepackage[maxbibnames=99, sorting=ydnt]{biblatex}
\addbibresource{test.bib}
\begin{filecontents}{test.bib}
#article{paper1,
author = {Surname, Name and Another, Name and Thethird, Name and Andthe, Last},
journal = {JUR},
month = {5},
title = {{Title very good}},
year = {2015}
}
#article{paper2,
author = {Guy, Some and Surname, Name and Dude, The},
journal = {JUR},
month = {5},
title = {{Another brilliant title}},
year = {2016},
}
\end{filecontents}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

You can use the trick from https://tex.stackexchange.com/a/355317/36296
\documentclass[12pt]{article}
\usepackage[maxbibnames=99, sorting=ydnt]{biblatex}
\begin{filecontents*}[overwrite]{\jobname.bib}
#article{paper1,
author = {Surname, Name and Another, Name and Thethird, Name and Andthe, Last},
journal = {JUR},
month = {5},
title = {{Title very good}},
year = {2015}
}
#article{paper2,
author = {Guy, Some and Surname, Name and Dude, The},
journal = {JUR},
month = {5},
title = {{Another brilliant title}},
year = {2016},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\usepackage{xstring}
\usepackage{etoolbox}
\newboolean{bold}
\newcommand{\makeauthorsbold}[1]{%
\DeclareNameFormat{author}{%
\setboolean{bold}{false}%
\renewcommand{\do}[1]{\expandafter\ifstrequal\expandafter{\namepartfamily}{####1}{\setboolean{bold}{true}}{}}%
\docsvlist{#1}%
\ifthenelse{\value{listcount}=1}
{%
{\expandafter\ifthenelse{\boolean{bold}}{\mkbibbold{\namepartfamily\addcomma\addspace \namepartgiveni}}{\namepartfamily\addcomma\addspace \namepartgiveni}}%
}{\ifnumless{\value{listcount}}{\value{liststop}}
{\expandafter\ifthenelse{\boolean{bold}}{\mkbibbold{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni}}{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni}}%
{\expandafter\ifthenelse{\boolean{bold}}{\mkbibbold{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni\addcomma\isdot}}{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni\addcomma\isdot}}%
}
\ifthenelse{\value{listcount}<\value{liststop}}
{\addcomma\space}{}
}
}
\makeauthorsbold{Surname, Name}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

Just to be sure, do you want to highlight all the authors or just a particular name?
In the first case, I invite you to look at the .bst files that format the bibliography to find the one that suits you or even create one yourself (which is quite long).
In the second case, I don't see any solution except to add \hl{Name, Surname} inside your bib file.

Related

Year of publication not appearing in the list of references at the end of a compiled LaTeX document using bibliographystyle{naturemag}

I'm new to LaTex, so I am using overleaf to create my citations. My bibliographystyle is naturemag.
My references are not including the year of publication in the reference list.
Here is an example of the output I am seeing.
Cite these [1, 2]
References
[1] Claw, K. et al. A framework for enhancing ethical genomic research with indigenous communities. Nature Communications 9, 2957. URL https://doi.org/10.1038/s41467-018-05188-3.
[2] Tsosie, K., Yracheta, J., Kolopenuk, J. & Smith, R. Indigenous data sovereignties and data sharing in biological anthropology. American Journal of Physical Anthropology 174, 183–186. URL https://doi.org/10.1002/ajpa2484. 1
Below is a sample of my bib.bib bibliography file
#article{claw2018a,
author = {Claw, K.G. and Anderson, M.Z. and Begay, R.L. and Tsosie, K.S. and Fox, K. and Garrison, N.A. and Consortium, S.internship for In peoples in G.},
title = {A framework for enhancing ethical genomic research with Indigenous communities},
volume = {9},
pages = {2957},
url = {https://doi.org/10.1038/s41467-018-05188-3},
doi = {10.1038/s41467-018-05188-3},
language = {en},
journal = {Nature Communications},
number = {1},
date = {2018}
}
#article{tsosie2021b,
author = {Tsosie, K.S. and Yracheta, J.M. and Kolopenuk, J.A. and Smith, R.W.},
date = {2021},
title = {Indigenous data sovereignties and data sharing in biological anthropology},
volume = {174},
pages = {183–186},
url = {https://doi.org/10.1002/ajpa2484},
doi = {10.1002/ajpa2484},
language = {en},
journal = {American Journal of Physical Anthropology},
number = {2}
}
Below are the LaTeX commands I am running.
\documentclass{article}
\usepackage[utf8]{inputenc}
\title{paper}
\author{author}
\date{February 2022}
\begin{document}
\maketitle
Cite these \cite{claw2018a,tsosie2021b}
\bibliographystyle{naturemag}
\bibliography{bib.bib}
\end{document}
You are using bibtex and not biblatex, so you need to use the less flexible year field instead of the date field:
#article{claw2018a,
author = {Claw, K.G. and Anderson, M.Z. and Begay, R.L. and Tsosie, K.S. and Fox, K. and Garrison, N.A. and Consortium, S.internship for In peoples in G.},
title = {A framework for enhancing ethical genomic research with Indigenous communities},
volume = {9},
pages = {2957},
url = {https://doi.org/10.1038/s41467-018-05188-3},
doi = {10.1038/s41467-018-05188-3},
language = {en},
journal = {Nature Communications},
number = {1},
year = {2018}
}
#article{tsosie2021b,
author = {Tsosie, K.S. and Yracheta, J.M. and Kolopenuk, J.A. and Smith, R.W.},
year = {2021},
title = {Indigenous data sovereignties and data sharing in biological anthropology},
volume = {174},
pages = {183–186},
url = {https://doi.org/10.1002/ajpa2484},
doi = {10.1002/ajpa2484},
language = {en},
journal = {American Journal of Physical Anthropology},
number = {2}
}

Why do my abbreviations not show up on the PDF?

I'm trying to get a list of abbreviations with the package acro. This is a minimal, reproducable Example:
\documentclass[13pt, titlepage]{article}
\usepackage{acro}
\begin{document}
\DeclareAcronym{uxo}{
short = UXO ,
long = Unexploded Ordenances ,
tag = abbrev
}
\printacronyms[include=abbrev, name=Abkürzungsverzeichnis]
\ac{uxo}
\end{document}
So printacronyms should print out all the acronyms I set with the tag abbrev, but all I get is the word "Abkürzungsverzeichnis". There are no Error-messages and I can use the abbreviations if I type \ac{auv} (like in the example). What is going on here?
The problem can be avoided by placing \DeclareAcronym in the preamble:
\documentclass[13pt, titlepage]{article}
\usepackage{acro}
\DeclareAcronym{uxo}{
short = UXO ,
long = Unexploded Ordenances ,
tag = abbrev
}
\begin{document}
\printacronyms[include=abbrev, name=Abkürzungsverzeichnis]
\ac{uxo}
\end{document}

Showing the number in front of an inline citation with \bibentry

I would like to show the number in front of the full inline citation generated by \bibentry from the bibentry package, matching the one that appears in the bibliography.
In the following MWE, this would correspond to a [2] in front of the indented \bibentry. How would I do that?
\documentclass[11pt]{article}
\usepackage{bibentry}
\begin{filecontents}{test.bib}
#misc{Emma,
author = "Emma",
title = "Emma's publication",
year = "2001" }
#misc{Martha,
author = "Martha",
title = "Interesting thoughts",
year = "2003" }
#misc{Paul,
author = "Paul",
title = "Paul's essay",
year = "2000" }
\end{filecontents}
\begin{document}
\nobibliography*
\noindent
This is a usual reference~\cite{Emma}.
Now I'm referring to\\[5pt]
\indent \bibentry{Martha}.\\[5pt]
The following is again a normal reference~\cite{Paul}.
\bibliography{test}
\bibliographystyle{plain}
\end{document}
This image shows the output of the above MWE
I guess bibentry doesn't allow that, one possible solution is to define a new command (or redefine \bibentry) as a \cite and \bibentry.
Some thing like that:
\let\oldbibentry\bibentry
\renewcommand{\bibentry}[1]{\cite{#1} \oldbibentry{#1}}
So if we try this code:
\documentclass[11pt]{article}
\usepackage{bibentry}
% redefine the bibentry command as cite then bibentry
\let\oldbibentry\bibentry
\renewcommand{\bibentry}[1]{\cite{#1} \oldbibentry{#1}}
\begin{filecontents}{test.bib}
#misc{Emma,
author = "Emma",
title = "Emma's publication",
year = "2001" }
#misc{Martha,
author = "Martha",
title = "Interesting thoughts",
year = "2003" }
#misc{Paul,
author = "Paul",
title = "Paul's essay",
year = "2000" }
\end{filecontents}
\nobibliography*
\begin{document}
\noindent
This is a usual reference~\cite{Emma}.
Now I'm referring to\\[5pt]
\indent \bibentry{Martha}.\\[5pt]
The following is again a normal reference~\cite{Paul}.
\bibliography{test}
\bibliographystyle{plain}
\end{document}
it should produce:

convert bib file to \bibitem[\protect\citeauthoryear

I have a reference file (bib file) I want to convert it as
\bibitem[\protect\citeauthoryear{Allen C.W.}{1973}] {b1} Allen C.W., 1973,
Astrophysical quantities, ${3^{rd}}$ ed. (Athlone Press, London)
when I use
\nocite{*}
\bibliographystyle{apalike}
\bibliography{bibfile}
Output ppl file as
\bibitem[Allen, 1973]{allen1973astrophysical}
Allen, C.~W. (1973).
Combining natbib with the newapa style gives something similar:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
#BOOK{1973asqu.book.....A,
author = {{Allen}, C.~W.},
title = "{Astrophysical quantities}",
keywords = {ASTROPHYSICS, ASTRONOMICAL CONSTANTS, TABLES, HANDBOOKS},
booktitle = {London: University of London, Athlone Press, |c1973, 3rd ed.},
year = 1973,
adsurl = {https://ui.adsabs.harvard.edu/abs/1973asqu.book.....A},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
\end{filecontents*}
\usepackage{natbib}
\begin{document}
\cite{1973asqu.book.....A}
\bibliographystyle{newapa}
\bibliography{\jobname}
\end{document}
Resulting .bbl file:
\begin{thebibliography}{}
\bibitem[\protect\citeauthoryear{{Allen}}{{Allen}}{1973}]{1973asqu.book.....A}
{Allen}, C.~W. (1973).
\newblock {\em {Astrophysical quantities}}.
\end{thebibliography}

How can I have LaTeX print citations inside of parentheses?

I have a problem with reference style in LaTeX.
I use:
\usepackage[backend=bibtex,style=authoryear]{biblatex} %
But when I look at the references, the text is not inside parentheses.
For example:
,reviewed in Roy et al. 2010
should be
,reviewed in (Roy et al. 2010)
All bibliography package have a mean to either add or not parenthesis to a citation, depending on context.
Indeed, generally it is undesirable to have all citations bracketted.
For instance, if you say "see \cite{foobar}", you probably want "see (Foobar 1999)". But in a phrase like "(\cite{foobar} also has interesting examples)", you do not want parenthesis, as "((Foobar 1999) also ...)" looks ugly and is not advised in standard typographic rules. Probably "(Foobar 1999 also has ...)" is prefered.
For this reason, in vanilla bibtex, you have \cite (without parenthesis) and \citep (with parenthesis).
In biblatex, you can do the same. Instead of using \cite, use \parencite to get citations with parenthesis.
Another approach to add parenthesis around the citations is to change the definition of the \cite macro:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
#book{knuth,
author = {Knuth, Donald E.},
title = {The {\TeX} book},
date = 1984,
maintitle = {Computers \& Typesetting},
volume = {A},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
langid = {english},
langidopts = {variant=american},
sortyear = {1984-1},
sorttitle = {Computers & Typesetting A},
indexsorttitle= {The TeXbook},
indextitle = {\protect\TeX book, The},
shorttitle = {\TeX book}
}
#article{einstein,
author = {Einstein, A.},
title = {Die Grundlage der allgemeinen Relativitätstheorie},
journal = {Annalen der Physik},
volume = {354},
number = {7},
doi = {10.1002/andp.19163540702},
pages = {769--822},
year = {1916}
}
\end{filecontents*}
\usepackage[backend=bibtex,style=authoryear]{biblatex}
\addbibresource{\jobname.bib}
\DeclareCiteCommand{\cite}[\mkbibparens]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand*{\cite}[\mkbibparens]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{citeyear}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\begin{document}
\cite{einstein}
\printbibliography
\end{document}

Resources