Created
September 2, 2016 14:31
-
-
Save jeetsukumaran/87a57db5ea2b4dc8253f72af244b82f3 to your computer and use it in GitHub Desktop.
BibLaTeX customizations (emphasize author name when rendering bibliography, etc.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% emphasize author name when rendering bibliography | |
% Note: requires: \usepackagage{biblatex} | |
\newcommand{\emphasizeAuthorName}[1]{% | |
\DeclareNameFormat{author}{% | |
\edef\tempname{{#1}}% | |
\ifnumequal{\value{listcount}}{1} | |
{\ifnumequal{\value{liststop}}{1} | |
{\expandafter\ifstrequal\tempname{##1}{\textbf{##1\addcomma\addspace ##4\isdot}}{##1\addcomma\addspace ##4\addcomma\isdot}} | |
{\expandafter\ifstrequal\tempname{##1}{\textbf{##1\addcomma\addspace ##4\isdot}}{##1\addcomma\addspace ##4}}} | |
{\ifnumless{\value{listcount}}{\value{liststop}} | |
{\expandafter\ifstrequal\tempname{##1}{\addcomma\addspace \textbf{##1\addcomma\addspace ##4}}{\addcomma\addspace ##1\addcomma\addspace ##4}} | |
{\expandafter\ifstrequal\tempname{##1}{\addcomma\addspace and \addspace \textbf{##1\addcomma\addspace ##4\isdot}}{\addcomma\addspace and \addspace ##1\addcomma\addspace ##4\isdot}}% | |
}% | |
}% | |
} | |
\emphasizeAuthorName{Jeet Sukumaran} | |
\emphasizeAuthorName{Sukumaran} | |
% \DeclareFieldFormat[article]{volume}{\textbf{#1}\addcomma\space} % Bolds volume of citation and adds comma after volume | |
% \DeclareFieldFormat{pages}{#1} % No prefix for the "pages" field in the bibliography | |
% \renewcommand*{\revsdnamepunct}{} % Removing the comma after last name %% NOTE: we override author rendering above, so does not have effect | |
% \renewcommand*{\revsdnamepunct}{} % Removing the periods after first name intial %% NOTE: we override author rendering above, so does not have effect | |
\renewcommand{\labelnamepunct}{\addspace} % Removes period after year in bibliography | |
% \DeclareFieldFormat[article]{title}{#1} % Remove quotes from journal title | |
% \DeclareNameAlias{sortname}{last-first} % Lists all authors with last name first | |
\renewbibmacro{in:}{% Removes "In" from bibliography entries | |
\ifentrytype{article}{}{% | |
\printtext{\bibstring{in}\intitlepunct}}} | |
%% Custom entry: numbering + author-year format | |
\defbibenvironment{bibliography} | |
{\list | |
{\printfield[labelnumberwidth]{labelnumber}} | |
{\setlength{\labelwidth}{\labelnumberwidth}% | |
\setlength{\leftmargin}{\labelwidth}% | |
\setlength{\labelsep}{\biblabelsep}% | |
\addtolength{\leftmargin}{\labelsep}% | |
\setlength{\itemsep}{\bibitemsep}% | |
\setlength{\parsep}{\bibparsep}}% | |
\renewcommand*{\makelabel}[1]{\hss##1}} | |
{\endlist} | |
{\item} | |
\DeclareFieldFormat{labelnumberwidth}{#1.} % Adds a period after each reference number in bibliography | |
\renewcommand*{\finalnamedelim}{\addspace\bibstring{and}\space} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment