Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make one author name bold in the reference section? #292

Closed
inmybrain opened this issue Aug 13, 2019 · 4 comments
Closed

How to make one author name bold in the reference section? #292

inmybrain opened this issue Aug 13, 2019 · 4 comments

Comments

@inmybrain
Copy link

Have anyone tried to make your name bold in the reference?

I found one answer from https://tex.stackexchange.com/a/327046/47328, which works well independently of Awesome-CV format. I wonder how I could incorporate the solution into Awesome-CV.

p.s. I want to find a solution that does not add something in the .bib file.

@inmybrain
Copy link
Author

The problem was caused by my own declaration using \DeclareNameFormat. After removing it, it works fine. Sorry for the confusion my question may cause. It works well too with Awesome-CV style.

FYI, I added the answer below to awesome-cv.cls, and specify the author (usually your name) as well.

\def\makenamesetup{%
  \def\bibnamedelima{~}%
  \def\bibnamedelimb{ }%
  \def\bibnamedelimc{ }%
  \def\bibnamedelimd{ }%
  \def\bibnamedelimi{ }%
  \def\bibinitperiod{.}%
  \def\bibinitdelim{~}%
  \def\bibinithyphendelim{.-}}    
\newcommand*{\makename}[2]{\begingroup\makenamesetup\xdef#1{#2}\endgroup}

\newcommand*{\boldname}[3]{%
  \def\lastname{#1}%
  \def\firstname{#2}%
  \def\firstinit{#3}}
\boldname{}{}{}

% Patch new definitions
\renewcommand{\mkbibnamegiven}[1]{%
  \ifboolexpr{ ( test {\ifdefequal{\firstname}{\namepartgiven}} or test {\ifdefequal{\firstinit}{\namepartgiven}} ) and test {\ifdefequal{\lastname}{\namepartfamily}} }
  {\mkbibbold{#1}}{#1}%
}

\renewcommand{\mkbibnamefamily}[1]{%
  \ifboolexpr{ ( test {\ifdefequal{\firstname}{\namepartgiven}} or test {\ifdefequal{\firstinit}{\namepartgiven}} ) and test {\ifdefequal{\lastname}{\namepartfamily}} }
  {\mkbibbold{#1}}{#1}%
}

\boldname{Last}{First}{Initial} % Specify the author's name

@carlosbornes
Copy link

carlosbornes commented Apr 9, 2020

How exactly did you make this work? I've tried to insert the code but is not working.
My awesome-cv.cls looks something like this

\RequirePackage[ % BibLaTeX
	sorting=ydnt, % Sorts entries by year (descending order), name, title
	style=numeric,
	doi=false,
	isbn=true,
	url=false,
	eprint=false,
	backref = false, % include back references in bibliography
	maxcitenames=3, % affects only the citations in the document body
	maxbibnames=99, % affects only the bibliography, pass 99 to print all
	hyperref=true,
	block=none,
	backend=biber % {Options: bibtex, biber}
	]{biblatex}
\addbibresource{pub.bib}
\renewcommand*\newunitpunct{}

\def\makenamesetup{%
  \def\bibnamedelima{~}%
  \def\bibnamedelimb{ }%
  \def\bibnamedelimc{ }%
  \def\bibnamedelimd{ }%
  \def\bibnamedelimi{ }%
  \def\bibinitperiod{.}%
  \def\bibinitdelim{~}%
  \def\bibinithyphendelim{.-}}    
\newcommand*{\makename}[2]{\begingroup\makenamesetup\xdef#1{#2}\endgroup}

\newcommand*{\boldname}[3]{%
  \def\lastname{#1}%
  \def\firstname{#2}%
  \def\firstinit{#3}}
\boldname{}{}{}

% Patch new definitions
\renewcommand{\mkbibnamegiven}[1]{%
  \ifboolexpr{ ( test {\ifdefequal{\firstname}{\namepartgiven}} or test {\ifdefequal{\firstinit}{\namepartgiven}} ) and test {\ifdefequal{\lastname}{\namepartfamily}} }
  {\mkbibbold{#1}}{#1}%
}

\renewcommand{\mkbibnamefamily}[1]{%
  \ifboolexpr{ ( test {\ifdefequal{\firstname}{\namepartgiven}} or test {\ifdefequal{\firstinit}{\namepartgiven}} ) and test {\ifdefequal{\lastname}{\namepartfamily}} }
  {\mkbibbold{#1}}{#1}%
}

\boldname{Bornes}{Carlos}{C.} % Specify the author's name

and the publication.tex file

\cvsubsection{Journal Articles}
\begin{refsection}
	\nocite{*}
	\printbibliography[
	heading=none, 
	sorting=ydnt
	]
\end{refsection}

@inmybrain
Copy link
Author

@CBornes Hello, would you please tell me more information about the log message and your environments?

@anfoss
Copy link

anfoss commented May 28, 2020

@CBornes in the same .cls file there is a \DeclareNameFormat block. removing that will make it work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants