[Tex/LaTex] How to add the name of the supervisor in a @thesis field

biblatex

In the biblatex doc, it says ( Version 1.7, p.11):

thesis

A thesis written for an educational institution to satisfy the
requirements for a degree. Use the type field to specify the type of
thesis.

Required fields: author, title, type, institution, year/date

Optional fields: subtitle, titleaddon, language, note, location,
month, isbn, chapter, pages, pagetotal, addendum, pubstate, doi,
eprint, eprintclass, eprinttype, url, urldate

I would like to know if there is any "canonical" way to add the name of the supervisor(s) in a field of the .bib file (no .bbl manipulation please, I want my bibliography to be usable "as it" in several documents).

The expect result could be something like :

Meand Myself. “A brilliant result, explained”. PhD thesis**, under the
joint supervision of Pr. Toto and Pr. Tata**. Université Paris 24,
Nov. 2013.

The "under the (joint) supervision" could be a string that would be declined in four ways:

  • under the supervision of
  • under the joint supervision of
  • and the abridged forms

Best Answer

By default, biblatex does not seem to support a supervisor, so some changes have to be made, but we can keep these changes to a minimum.

Firstly, we define the new name list supervisor via a new datamodel (thesis.dbx)

\ProvidesFile{thesis.dbx}[2014/06/14 supervisor for theses]
\RequireBiber[3]
\DeclareDatamodelFields[type=list,datatype=name]{supervisor}
\DeclareDatamodelEntryfields[thesis]{supervisor}

Save the lines above in a file called thesis.dbx and put it somewhere LaTeX can find it. In the MWE below, this is done automatically via filecontents.

The datamodel needs to be loaded via the datamodel option (datamodel=thesis, e.g. \usepackage[style=authoryear,backend=biber,datamodel=thesis]{biblatex}).

Secondly, we need to declare the new strings you asked for in an .lbx file (the file should be called english-thesis.lbx)

  \ProvidesFile{english-thesis.lbx}[2014/06/14 english for thesis]
  \InheritBibliographyExtras{english}
  \NewBibliographyString{supervision,jointsupervision}
  \DeclareBibliographyStrings{%
    inherit           = {english},
    supervision       = {{under the supervision of}{under sup\adddotspace of}},
    jointsupervision  = {{under the joint supervision of}{under joint sup\adddotspace of}},
  }

Make sure to save the file somewhere LaTeX can find it (as above: in the MWE below, the file is created with filecontents).

We then employ this language variant via \DeclareLanguageMapping{english}{english-thesis}.

Finally, we define a new bibmacro

\newbibmacro*{thesissupervisor}{%
  \ifnameundef{supervisor}{}{%
    \ifnumgreater{\value{supervisor}}{1}
      {\bibstring{jointsupervision}}
      {\bibstring{supervision}}
    \printnames{supervisor}}}

that prints the supervisor and the introducing string depending on the number of supervisors.

We then patch the @thesis driver to use our new macro (that is done with the awesome xpatch package).

\xpatchbibdriver{thesis}
  {\printfield{type}}
  {\printfield{type}
   \newunit
   \usebibmacro{thesissupervisor}}
  {\typeout{yep}}
  {\typeout{no}}

The supervisor is now simply added to the supervisor field like so

@thesis{geer,
  author       = {de Geer, Ingrid},
  title        = {Earl, Saint, Bishop, Skald~-- and Music},
  type         = {phdthesis},
  institution  = {Uppsala Universitet},
  date         = 1985,
  subtitle     = {The Orkney Earldom of the Twelfth Century. A Musicological
                  Study},
  location     = {Uppsala},
  supervisor   = {James Oint and Stan Upervisor},
}

MWE

\documentclass[british,12pt,a4paper]{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@thesis{geer,
  author       = {de Geer, Ingrid},
  title        = {Earl, Saint, Bishop, Skald~-- and Music},
  type         = {phdthesis},
  institution  = {Uppsala Universitet},
  date         = 1985,
  subtitle     = {The Orkney Earldom of the Twelfth Century. A Musicological
                  Study},
  location     = {Uppsala},
  supervisor   = {James Oint and Stan Upervisor},
}

@thesis{loh,
  author       = {Loh, Nin C.},
  title        = {High-Resolution Micromachined Interferometric Accelerometer},
  type         = {mathesis},
  institution  = {Massachusetts Institute of Technology},
  date         = 1992,
  location     = {Cambridge, Mass.},
  supervisor   = {Stan Upervisor},
}
\end{filecontents*}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{xpatch}
\usepackage[style=authoryear,backend=biber,datamodel=thesis]{biblatex}
\usepackage{hyperref}

\begin{filecontents*}{thesis.dbx}
  \ProvidesFile{thesis.dbx}[2014/06/14 supervisor for theses]
  \RequireBiber[3]
  \DeclareDatamodelFields[type=list,datatype=name]{supervisor}
  \DeclareDatamodelEntryfields[thesis]{supervisor}
\end{filecontents*}

\begin{filecontents*}{english-thesis.lbx}
  \ProvidesFile{english-thesis.lbx}[2014/06/14 english for thesis]
  \InheritBibliographyExtras{english}
  \NewBibliographyString{supervision,jointsupervision}
  \DeclareBibliographyStrings{%
    inherit           = {english},
    supervision       = {{under the supervision of}{under sup\adddotspace of}},
    jointsupervision  = {{under the joint supervision of}{under joint sup\adddotspace of}},
  }
\end{filecontents*}

\DeclareLanguageMapping{english}{english-thesis}

\newbibmacro*{thesissupervisor}{%
  \ifnameundef{supervisor}{}{%
    \ifnumgreater{\value{supervisor}}{1}
      {\bibstring{jointsupervision}}
      {\bibstring{supervision}}
    \printnames{supervisor}}}

\xpatchbibdriver{thesis}
  {\printfield{type}}
  {\printfield{type}
   \newunit
   \usebibmacro{thesissupervisor}}
  {\typeout{yep}}
  {\typeout{no}}

\addbibresource{\jobname.bib}
\nocite{*}
\begin{document}
  \printbibliography
\end{document}

enter image description here


If you cannot create the new name list supervisor, you could try and abuse the editor field, then there is no need for the .dbx file. This solution should work with BibTeX as well.

The macros thesissupervisor becomes

\newbibmacro*{thesissupervisor}{%
  \ifnameundef{editor}{}{%
    \ifnumgreater{\value{editor}}{1}
      {\bibstring{jointsupervision}}
      {\bibstring{supervision}}
    \printnames{editor}}}

You then give the supervisor in the editor field in the bib entry like so

@thesis{geer,
  author       = {de Geer, Ingrid},
  title        = {Earl, Saint, Bishop, Skald~-- and Music},
  type         = {phdthesis},
  institution  = {Uppsala Universitet},
  date         = 1985,
  subtitle     = {The Orkney Earldom of the Twelfth Century. A Musicological
                  Study},
  location     = {Uppsala},
  editor       = {James Oint and Stan Upervisor},
}

MWE

\documentclass[british,12pt,a4paper]{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@thesis{geer,
  author       = {de Geer, Ingrid},
  title        = {Earl, Saint, Bishop, Skald~-- and Music},
  type         = {phdthesis},
  institution  = {Uppsala Universitet},
  date         = 1985,
  subtitle     = {The Orkney Earldom of the Twelfth Century. A Musicological
                  Study},
  location     = {Uppsala},
  editor       = {James Oint and Stan Upervisor},
}

@thesis{loh,
  author       = {Loh, Nin C.},
  title        = {High-Resolution Micromachined Interferometric Accelerometer},
  type         = {mathesis},
  institution  = {Massachusetts Institute of Technology},
  date         = 1992,
  location     = {Cambridge, Mass.},
  editor       = {Stan Upervisor},
}
\end{filecontents*}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{xpatch}
\usepackage[style=authoryear,backend=bibtex]{biblatex}
\usepackage{hyperref}


\begin{filecontents*}{english-thesis.lbx}
  \ProvidesFile{english-thesis.lbx}[2014/06/14 english for thesis]
  \InheritBibliographyExtras{english}
  \NewBibliographyString{supervision,jointsupervision}
  \DeclareBibliographyStrings{%
    inherit           = {english},
    supervision       = {{under the supervision of}{under sup\adddotspace of}},
    jointsupervision  = {{under the joint supervision of}{under joint sup\adddotspace of}},
  }
\end{filecontents*}

\DeclareLanguageMapping{english}{english-thesis}

\newbibmacro*{thesissupervisor}{%
  \ifnameundef{editor}{}{%
    \ifnumgreater{\value{editor}}{1}
      {\bibstring{jointsupervision}}
      {\bibstring{supervision}}
    \printnames{editor}}}

\xpatchbibdriver{thesis}
  {\printfield{type}}
  {\printfield{type}
   \newunit
   \usebibmacro{thesissupervisor}}
  {\typeout{yep}}
  {\typeout{no}}

\addbibresource{\jobname.bib}
\nocite{*}
\begin{document}
  \printbibliography
\end{document}
Related Question