Closed inmybrain closed 5 years ago
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
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}
@CBornes Hello, would you please tell me more information about the log message and your environments?
@CBornes in the same .cls file there is a \DeclareNameFormat block. removing that will make it work
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.