I'm writing my own bibliography style based on the trad-standard.bbx
. For the phdthesis
driver I'd like to include the department as a separate input in the bib file. So my bibfile looks like this:
@phdthesis{Test2018,
author = {Doe, John},
school = {University of Foo},
department = {Department for eggs and bacon},
title = {{Studies on the cooking time of eggs and bacon, searching for the perfect symbiosis.}},
type = {Master's Thesis},
year = {2018}
}
The driver for a thesis is defined in the trad-standard.bbx
as:
\DeclareBibliographyDriver{thesis}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\printfield{type}%
\newcommaunit
\usebibmacro{institution+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\usebibmacro{doi+eprint+url+issn}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}{%
\usebibmacro{related:init}%
\usebibmacro{related}%
}{}%
\usebibmacro{finentry}%
}
And the current output of the Test2018
is
J. Doe: “Studies on the cooking time of eggs and bacon, searching for the perfect symbiosis”. Master's Thesis, University of Foo, 2018.
I would like to add the department after the school, so the result would be:
J. Doe: “Studies on the cooking time of eggs and bacon, searching for the perfect symbiosis”. Master's Thesis, University of Foo, Department for eggs and bacon, 2018.
In the driver, I cannot find the print-function for the school, so I'm unable to define a new check to print the department afterwards. I guess that the school is printed by the command \printlist{location}
but I don't find the definition of that command and thus, I have no idea how this list is set up and how I could inject the department.
Can anyone help me out?
(M)WE
Attention: Long file! (To save some space I removed all the drivers but the one used for a thesis.)
\documentclass{article}
\usepackage{filecontents}
\usepackage{hyperref}
\begin{filecontents*}{custom-abbrv.bbx}
% %%%%%%%%%%%%%
% Declare Style
% %%%%%%%%%%%%%
\ProvidesFile{custom-abbrv.bbx}[2018/08/20 v2.0.0 Custom abbrv Bibliography Style]
% %%%%%%%%%%%%%
% Require Style
% %%%%%%%%%%%%%
\RequireBibliographyStyle{standard}
% %%%%%%%%%%%%%
% Basic Options
% %%%%%%%%%%%%%
\ExecuteBibliographyOptions{%
abbreviate = false,
arxiv = false,
useprefix = true,
autolang = hyphen,
backref = false,
dateabbrev = true,
eprint = false,
hyperref = true,
labelnumber = true,
maxnames = 3,
minnames = 3,
sorting = none,
}
% %%%%%%%%%%%%%%%%%%%%%
% Package Functionality
% %%%%%%%%%%%%%%%%%%%%%
\@ifpackagelater{biblatex}{2016/03/01}
{\ExecuteBibliographyOptions{giveninits=true}}
{\ExecuteBibliographyOptions{firstinits=true}}
\@ifpackagelater{biblatex}{2016/03/01}{%
\@ifpackagelater{biblatex}{2016/05/14}{%
\DeclareNameFormat{abbrv}{%
\usebibmacro{name:given-family}%
{\namepartfamily}%
{\namepartgiveni}%
{\namepartprefixi}%
{\namepartsuffixi}%
\usebibmacro{name:andothers}%
}%
}{%
\DeclareNameFormat{abbrv}{%
\nameparts{#1}%
\usebibmacro{name:given-family}%
{\namepartfamily}%
{\namepartgiveni}%
{\namepartprefixi}%
{\namepartsuffixi}%
\usebibmacro{name:andothers}%
}%
}%
}{%
\DeclareNameFormat{abbrv}{%
\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}%
\usebibmacro{name:andothers}%
}%
}%
\DeclareNameAlias{default}{abbrv}
\@ifpackagelater{biblatex}{2016/05/14}{%
\defbibenvironment{bibliography}%
{%
\list{%
\printtext[labelnumberwidth]{%
\printfield{labelprefix}%
\printfield{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}%
}{%
\defbibenvironment{bibliography}%
{%
\list{%
\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{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}%
}
\defbibenvironment{shorthands}%
{%
\list{%
\printfield[shorthandwidth]{shorthand}%
}{%
\setlength{\labelwidth}{\shorthandwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}%
\renewcommand*{\makelabel}[1]{\hss##1}%
}%
}%
{\endlist}%
{\item}%
% %%%%%%%%%%%%%%%%%%%%%%%
% Preliminary Definitions
% %%%%%%%%%%%%%%%%%%%%%%%
% Booleans
\providebool{bbx:subentry}
\DeclareBibliographyOption[boolean]{subentry}[true]{%
\setbool{bbx:subentry}{#1}%
}
\newbool{bbxtrad:doisequal}
\newbool{bbxtrad:eprintsequal}
\newbool{bbxtrad:urlsequal}
\newbool{bbxtrad:notesequal}
\newbool{bbxtrad:addendumsequal}
% Aliases
\DeclareNameAlias{author}{default}
\DeclareNameAlias{editor}{default}
\DeclareNameAlias{translator}{default}
% New commands
\newcommand*{\volumenumberdelim}{} % delim between number and volume
\renewcommand*{\intitlepunct}{\addspace} % after the bibstring in
\renewcommand*{\newunitpunct}{\addperiod\space}
\newcommand*{\newcommaunit}{\@ifstar\newcommaunitStar\newcommaunitNoStar}
\newcommand*{\newcommaunitStar}{\setunit*{\addcomma\space}}
\newcommand*{\newcommaunitNoStar}{\setunit{\addcomma\space}}
\renewcommand*{\labelnamepunct}{\addcolon\space}
\renewcommand*{\subtitlepunct}{\addperiod\space}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Field Formatting and Appearance
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title
\DeclareFieldFormat*{title}{%
\enquote{#1}\isdot%
}
% Titlecase
\DeclareFieldFormat{titlecase}{%
\MakeTitleCase{#1}%
}
\newrobustcmd{\MakeTitleCase}[1]{%
\ifthenelse{
\ifcurrentfield{booktitle}%
\OR\ifcurrentfield{booksubtitle}%
\OR\ifcurrentfield{maintitle}\OR\ifcurrentfield{mainsubtitle}%
\OR\ifcurrentfield{journaltitle}%
\OR\ifcurrentfield{journalsubtitle}%
\OR\ifcurrentfield{issuetitle}%
\OR\ifcurrentfield{issuesubtitle}%
\OR\ifentrytype{book}%
\OR\ifentrytype{mvbook}%
\OR\ifentrytype{bookinbook}%
\OR\ifentrytype{booklet}%
\OR\ifentrytype{suppbook}%
\OR\ifentrytype{collection}%
\OR\ifentrytype{mvcollection}%
\OR\ifentrytype{suppcollection}%
\OR\ifentrytype{manual}%
\OR\ifentrytype{periodical}%
\OR\ifentrytype{suppperiodical}%
\OR\ifentrytype{proceedings}%
\OR\ifentrytype{mvproceedings}%
\OR\ifentrytype{reference}%
\OR\ifentrytype{mvreference}%
\OR\ifentrytype{report}%
\OR\ifentrytype{thesis}%
}
{#1}
{\MakeSentenceCase{#1}}%
}
% Journal title
\DeclareFieldFormat{journaltitle}{%
\mkbibemph{#1},%
}
% Chapter
\DeclareFieldFormat{chapter}{%
\bibstring{chapter}~#1%
}
% Volume
\DeclareFieldFormat[article]{volume}{#1}
% Number
\DeclareFieldFormat*{number}{\mkbibparens{#1}}
\DeclareFieldFormat[book,incollection,inproceedings,proceedings]{number}{%
\biblstring{number}~#1%
}
\DeclareFieldFormat[techreport,report]{number}{#1}
% Edition
\DeclareFieldFormat{edition}{%
\ifinteger{#1}%
{\mkbibordedition{#1}~\bibstring{edition}}%
{\MakeLowercase{#1}~\bibstring{edition}}%
}
% Series
\DeclareFieldFormat[book,inproceedings,proceedings]{series}{%
\mkbibemph{#1}%
}
% Pages
\DeclareFieldFormat*{pages}{\space#1\space}
\renewcommand*{\bibpagespunct}{\addspace}
% Year
\DeclareFieldFormat{date}{\textbf{#1}}
% URL
\DeclareFieldFormat{url}{URL:\space\url{#1}}
% ISSN / ISBN
\DeclareFieldFormat{issn}{ISSN:\space\url{#1}}
\DeclareFieldFormat{isbn}{ISBN:\space\url{#1}}
% DOI
\DeclareFieldFormat{doi}{%
DOI\addcolon\space
\ifhyperref
{\href{http://dx.doi.org/#1}{\nolinkurl{#1}}}
{\nolinkurl{#1}}%
}
% Item Separation
\setlength\bibitemsep{.5\baselineskip}
% Alignment
\AtBeginBibliography{\raggedright}
% Bibentrysetcount
\DeclareFieldFormat{bibentrysetcount}{\mkbibparens{\mknumalph{#1}}}
% Labelnumberwidth
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}
% Shorthandwidth
\DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}}
% In
\renewbibmacro*{in:}{%
\printtext{%
\bibstring{in}%
\printunit{\intitlepunct}%
}%
}
% %%%%%%%%%%%%
% Driver Setup
% %%%%%%%%%%%%
% Thesis
\DeclareBibliographyDriver{thesis}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\printfield{type}%
\newcommaunit
\usebibmacro{institution+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\usebibmacro{doi+eprint+url+issn}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}{%
\usebibmacro{related:init}%
\usebibmacro{related}%
}{}%
\usebibmacro{finentry}%
}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Redefinition of diverse Macros
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newbibmacro*{crossref:label}{%
\usebibmacro{maintitle+booktitle:noemph}%
\setunit{\addspace}%
\entrydata{\strfield{crossref}}{%
\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}%
}%
}%
}
\newbibmacro*{maintitle+booktitle:noemph}{%
\iffieldundef{maintitle}{}{%
\usebibmacro{maintitle:noemph}%
\newunit\newblock
\iffieldundef{volume}%
{}%
{\printfield{volume}%
\printfield{part}%
\setunit{\addcolon\space}}%
}%
\usebibmacro{booktitle:noemph}%
\newunit%
}
\newbibmacro*{maintitle:noemph}{%
\ifboolexpr{
test {\iffieldundef{maintitle}}
and
test {\iffieldundef{mainsubtitle}}
}%
{}%
{%
\printtext{%
\printfield[titlecase]{maintitle}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{mainsubtitle}%
}%
\newunit%
}%
\printfield{maintitleaddon}%
}
\newbibmacro*{booktitle:noemph}{%
\ifboolexpr{
test {\iffieldundef{booktitle}}
and
test {\iffieldundef{booksubtitle}}
}%
{}%
{%
\printtext{%
\printfield[titlecase]{booktitle}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{booksubtitle}%
}%
\newunit%
}%
\printfield{booktitleaddon}%
}
\newbibmacro*{inproc:crossref:full}{%
\ifboolexpr{
test {\ifnameundef{editor}}
and
test {\ifnameundef{editora}}
and
test {\ifnameundef{editorb}}
and
test {\ifnameundef{editorc}}
and
test {\ifnameundef{translator}}
}%
{}%
{%
\usebibmacro{byeditor+others}\newcommaunit%
}%
\usebibmacro{maintitle+booktitle}%
\newunit
\usebibmacro{event+venue+date}%
\newcommaunit
\iffieldundef{maintitle}{%
\printfield{volume}%
\printfield{part}%
\ifboolexpr{
test {\iffieldundef{volume}}
and
test {\iffieldundef{part}}
}%
{}%
{%
\setunit{\addspace\bibstring{ofseries}\addspace}%
}%
}%
{}%
\usebibmacro{series+number:emphcond}%
\newcommaunit
\iffieldundef{maintitle}{%
\printfield{volumes}%
\newcommaunit%
}%
{}%
}
\newbibmacro*{inproc:crossref:extra}{%
\newcommaunit
\printlist{location}%
\newcommaunit
\printfield{edition}%
\newunit
\printlist{organization}%
\newcommaunit*%
\printlist{publisher}%
\newcommaunit
\usebibmacro{date}%
\newunit\newblock
\usebibmacro{doi+eprint+url+issn}
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
}
\newbibmacro*{inproc:crossref:conditional}{%
\entrydata*{\strfield{crossref}}{%
\iffieldsequal{doi}{saveddoi}%
{\global\booltrue{bbxtrad:doisequal}}%
{\global\boolfalse{bbxtrad:doisequal}}%
\iffieldsequal{eprint}{savedeprint}%
{\global\booltrue{bbxtrad:eprintsequal}}%
{\global\boolfalse{bbxtrad:eprintsequal}}%
\iffieldsequal{url}{savedurl}%
{\global\booltrue{bbxtrad:urlsequal}}%
{\global\boolfalse{bbxtrad:urlsequal}}%
\iffieldsequal{note}{savednote}%
{\global\booltrue{bbxtrad:notesequal}}%
{\global\boolfalse{bbxtrad:notesequal}}%
\iffieldsequal{addendum}{savedaddendum}%
{\global\booltrue{bbxtrad:addendumsequal}}%
{\global\boolfalse{bbxtrad:addendumsequal}}%
}
\newunit\newblock
\iftoggle{bbx:doi}
{\ifbool{bbxtrad:doisequal}{}{\printfield{saveddoi}}}
{}%
\newunit\newblock
\iftoggle{bbx:eprint}
{\ifbool{bbxtrad:eprintsequal}{}{\usebibmacro{eprint}}}
{}%
\newunit\newblock
\iftoggle{bbx:url}
{\ifbool{bbxtrad:urlsequal}{}{\usebibmacro{url+urldate}}}
{}%
\newunit\newblock
\ifbool{bbxtrad:notesequal}{}{\printfield{note}}%
\newunit\newblock
\ifbool{bbxtrad:addendumsequal}{}{\printfield{addendum}}%
}
\newbibmacro*{journal+date+issuetitle}{%
\usebibmacro{journal}%
\usebibmacro{date}
\newcommaunit*%
\iffieldundef{series}
{}
{%
\newunit
\printfield{series}%
\setunit{\addcomma\space}%
}%
\usebibmacro{volume+number+pages+eid}%
\newcommaunit
% \setunit{\addspace}%
\usebibmacro{issue-parens}%
\setunit*{\addcolon\space}%
\usebibmacro{issue}%
\newunit%
}
\newbibmacro*{volume+number+pages+eid}{%
\printfield{volume}%
\setunit*{\volumenumberdelim}%
\printfield{number}%
\setunit{\addcolon}
\printfield{pages}%
\newcommaunit
\printfield{eid}%
}
\renewbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{%
\printnames[byeditor]{editor}%
\setunit{\addcomma\space}%
\usebibmacro{editorlstr}%
\clearname{editor}%
\newunit%
}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}%
}
\newbibmacro*{editorlstr}{%
\ifboolexpr{
test {\ifnumgreater{\value{editor}}{1}}
or
test {\ifandothers{editor}}
}%
{\biblstring{editors}}%
{\biblstring{editor}}%
}
\renewbibmacro*{series+number}{%
\printfield{number}%
\setunit*{\addspace\bibstring{inseries}\addspace}%
\printfield{series}%
\newunit%
}
\newbibmacro*{series+number:emphcond}{%
\printfield{number}%
\setunit*{\addspace\bibstring{inseries}\addspace}%
\ifboolexpr{
not test {\iffieldundef{volume}}
}%
{\printfield{series}}%
{%
\ifboolexpr{
test {\iffieldundef{volume}}
and
test {\iffieldundef{part}}
and
test {\iffieldundef{number}}
and
test {\ifentrytype{book}}
}%
{\newunit\newblock}%
{}%
\printfield[noformat]{series}%
}%
\newunit%
}
\newbibmacro*{book:series+number}{%
\iffieldundef{maintitle}%
{%
\printfield{volume}%
\printfield{part}%
\ifboolexpr{
test {\iffieldundef{volume}}
and
test {\iffieldundef{part}}
}%
{}%
{\setunit{\addspace\bibstring{ofseries}\addspace}}%
}%
{}%
\usebibmacro{series+number:emphcond}%
\newunit%
}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\setunit*{\volumenumberdelim}%
\printfield{number}%
\setunit{\addcomma\space}%
\printfield{eid}%
}
\renewbibmacro*{publisher+location+date}{%
\printlist{publisher}%
\newcommaunit*%
\printlist{location}%
\newcommaunit*%
\printfield{edition}%
\newcommaunit*%
\usebibmacro{date}%
\newunit%
}
\renewbibmacro*{institution+location+date}{%
\printlist{institution}%
\newcommaunit*%
\printlist{location}%
\printlist{location}%
\newcommaunit*%
\usebibmacro{date}%
\newunit%
}
\newbibmacro*{location+date+publisher}{%
\printlist{location}%
\newcommaunit*%
\printfield{edition}%
\newcommaunit*%
\usebibmacro{date}%
\newunit
\printlist{publisher}%
}
\newbibmacro*{issue-parens}{%
\printfield{issue}%
\newunit%
}
\newbibmacro*{doi+eprint+url+issn}{%
\iftoggle{bbx:doi}
{\printfield{doi}}
{%
\iftoggle{bbx:isbn}
{\printfield{issn}}
{%
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{%
\iftoggle{bbx:url}
{\usebibmacro{url+urldate}}
{}
}%
}%
}%
}
\endinput
\end{filecontents*}
\begin{filecontents*}{references.bib}
@phdthesis{Test2018,
author = {Doe, John},
school = {University of Foo},
department = {Department for eggs and bacon},
title = {{Studies on the cooking time of eggs and bacon, searching for the perfect symbiosis.}},
type = {Master's Thesis},
year = {2018}
}
\end{filecontents*}
\usepackage[backend = biber, style = custom-abbrv, citestyle = numeric-comp]{biblatex}
\addbibresource{references.bib}
\begin{document}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\cite{Test2018}
\printbibliography
\end{document}