1

in writing my PhD thesis, I would like LaTeX to produce two bibliographies as follows:

  1. In the initial overview chapter I would like to produce a biblio that contains only the works authored by myself, with my name in bold. More precisely I would like to print all my works with a given keyword (from the .bib file), and then all my works with a second given keyword (from the .bib file).

  2. At the end of my thesis I would like all references to appear, including mine, but without any bold name.

As of now my main issue is that both bibliographies end up with my name in bold. I am using bib latex with biber and xpatch to get my name in bold. A snapshot of this is in the following, where I replace <insertheremyhash> with the hash associated by biber to my name.

Thanks a lot!

\usepackage[backend=biber,natbib=true,style=alphabetic,sorting=nyt,giveninits=true, defernumbers=false,citetracker=true,maxnames=99,doi=false,isbn=false,url=false, noerroretextools=true]{biblatex}
\addbibresource{biblio_thesis_2.bib}


\usepackage{xpatch}
\newbibmacro*{name:bold}[2]{%
  \def\do##1{\iffieldequalstr{hash}{##1}{\bfseries\listbreak}{}}%
  \dolistloop{\boldnames}%
}
\newcommand*{\boldnames}{}
\xpretobibmacro{name:family}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:given-family}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:family-given}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:delim}{\begingroup\normalfont}{}{}
\xapptobibmacro{name:family}{\endgroup}{}{}
\xapptobibmacro{name:given-family}{\endgroup}{}{}
\xapptobibmacro{name:family-given}{\endgroup}{}{}
\xapptobibmacro{name:delim}{\endgroup}{}{}
\renewcommand*{\boldnames}{}
\forcsvlist{\listadd\boldnames}{{<insertheremyhash>}}

EDIT: ADDED MWE

\documentclass[12pt, a4paper, titlepage, headsepline, twoside]{book}

\usepackage{filecontents}
%
\begin{filecontents}{biblatextest1.bib}
@BOOK{BookMe1,
  author    = {Me Me},
  title     = {Paper for first part},
  publisher = {Some Publisher},
  year      = 2003,
  Keywords  = {minepart1}
}
@BOOK{BookMe2,
  author    = {Me Me},
  title     = {Paper for second part},
  publisher = {Some Publisher},
  year      = 2002,
  Keywords  = {minepart2}
}
@BOOK{Bookothers1,
  author    = {Someone else},
  title     = {Someone else work},
  publisher = {Some Publisher},
  year      = 2002,
}
\end{filecontents}


% == Bibliography ================================================
\usepackage[backend=biber,natbib=true,style=alphabetic,sorting=nyt,giveninits=true, defernumbers=false,citetracker=true,maxnames=99,doi=false,isbn=false,url=false, noerroretextools=true]{biblatex}

\addbibresource{biblatextest1.bib}


% GETTING Me Me to appear in bold
\usepackage{xpatch}
\newbibmacro*{name:bold}[2]{%
  \def\do##1{\iffieldequalstr{hash}{##1}{\bfseries\listbreak}{}}%
  \dolistloop{\boldnames}%
}
\newcommand*{\boldnames}{}
\xpretobibmacro{name:family}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:given-family}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:family-given}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:delim}{\begingroup\normalfont}{}{}
\xapptobibmacro{name:family}{\endgroup}{}{}
\xapptobibmacro{name:given-family}{\endgroup}{}{}
\xapptobibmacro{name:family-given}{\endgroup}{}{}
\xapptobibmacro{name:delim}{\endgroup}{}{}
\renewcommand*{\boldnames}{}
\forcsvlist{\listadd\boldnames}
  {{0e4113c11a30770aa5d2e0f481425c95}}



\begin{document}

% OVERVIEW CHAPTER
\section*{Overview}
\nocite{BookMe1,BookMe2,Bookothers1}
Part I of this thesis is based on the following works.
% print partial biblio relative to part 1 + bold
\begin{refcontext}[sorting=ydnt]
\defbibfilter{filt_minepart1}{ keyword=minepart1 }
\printbibliography[filter=filt_minepart1,heading=none,title=none]
\end{refcontext}


Part II of this thesis is based on the following works.
% print partial biblio relative to part 2 + bold
\begin{refcontext}[sorting=ydnt]
\defbibfilter{filt_minepart2}{ keyword=minepart2 }
\printbibliography[filter=filt_minepart2,heading=none,title=none]
\end{refcontext}

% print full biblio, no bold!
%backmatter
%\addcontentsline{toc}{part}{Bibliography}
\printbibliography

\end{document}
4

1 Answer 1

0

All commands involved can be used locally since they don't need global assignments. That means we can pack the commands responsible for bold author name up into a macro (called \makenamesbold below) that we can then use whenever we want a specific bibliography to have your name in bold.

In the MWE it is enough to simply issue the command within the refcontext because that gives the necessary grouping, but you could also use \AtNextBibliography.

\documentclass[12pt, a4paper, titlepage, twoside]{book}

\usepackage[backend=biber, natbib=true, style=alphabetic,
            sorting=nyt, giveninits=true, defernumbers=false,
            citetracker=true, maxnames=99, doi=false, isbn=false, url=false]{biblatex}

\usepackage{xpatch}
\newcommand*{\boldnamedo}[1]{%
  \iffieldequalstr{hash}{#1}
    {\bfseries\listbreak}
    {}}
\newbibmacro*{name:bold}{%
  \forlistloop{\boldnamedo}{\boldnames}}

\newcommand*{\boldnames}{}
\forcsvlist{\listadd\boldnames}
  {{0e4113c11a30770aa5d2e0f481425c95}}

\newcommand*{\makenamesbold}{%
  \xpretobibmacro{name:family}{\begingroup\usebibmacro{name:bold}}{}{}%
  \xpretobibmacro{name:given-family}{\begingroup\usebibmacro{name:bold}}{}{}%
  \xpretobibmacro{name:family-given}{\begingroup\usebibmacro{name:bold}}{}{}%
  \xpretobibmacro{name:delim}{\begingroup\normalfont}{}{}%
  \xapptobibmacro{name:family}{\endgroup}{}{}%
  \xapptobibmacro{name:given-family}{\endgroup}{}{}%
  \xapptobibmacro{name:family-given}{\endgroup}{}{}%
  \xapptobibmacro{name:delim}{\endgroup}{}{}%
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{BookMe1,
  author    = {Me Me},
  title     = {Paper for first part},
  publisher = {Some Publisher},
  year      = 2003,
  Keywords  = {minepart1}
}
@BOOK{BookMe2,
  author    = {Me Me},
  title     = {Paper for second part},
  publisher = {Some Publisher},
  year      = 2002,
  Keywords  = {minepart2}
}
@BOOK{Bookothers1,
  author    = {Someone else},
  title     = {Someone else work},
  publisher = {Some Publisher},
  year      = 2002,
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}

\section*{Overview}
\nocite{BookMe1,BookMe2,Bookothers1}
Part I of this thesis is based on the following works.
% print partial biblio relative to part 1 + bold
\begin{refcontext}[sorting=ydnt]
\makenamesbold
\defbibfilter{filt_minepart1}{ keyword=minepart1 }
\printbibliography[filter=filt_minepart1,heading=none,title=none]
\end{refcontext}


Part II of this thesis is based on the following works.
% print partial biblio relative to part 2 + bold
\begin{refcontext}[sorting=ydnt]
\makenamesbold
\defbibfilter{filt_minepart2}{ keyword=minepart2 }
\printbibliography[filter=filt_minepart2,heading=none,title=none]
\end{refcontext}

\printbibliography
\end{document}

The two overview bibliographies with "M. Me" in bold

Full bibliography on page 3 with no bold names

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.