5

My document (LuaLaTeX):

\documentclass[a4paper,oneside,12pt]{scrreprt}
\usepackage{fontspec}
\usepackage[backend=biber,firstinits=true,sorting=nyt,maxbibnames=3]{biblatex} 
\usepackage[ngerman]{babel}
\addbibresource{lit.bib}
\begin{document}
\cite{schmidt14}
\printbibliography
\end{document}

The file "lit.bib":

@phdthesis{schmidt14,
  author = {Schmidt, Johannes},
  title = {Testtest},
  school = {Test Univ.},
  year = {2014},
}

But there is no comma between "Diss." (German abbreviation for a PhD thesis) and the school:

enter image description here

What can I do? How can I modify the default style? Other styles put a comma there.

(btw, the \usepackage[ngerman]{babel} doesn't matter, same problem with English. I included it nonetheless for the minimal example. The document is written in German.)

Thanks for any help!

4
5

Unfortunately, the type field is not printed within a macro but in the driver directly, so we will have to modify the @thesis driver. We can do this quite neatly with the xpatch package.

\xpatchbibdriver{thesis}
  {\printfield{type}%
   \newunit}
  {\printfield{type}%
   \setunit{\addcomma\space}}
  {}{}

We simply add an explicit \setunit{\addcomma\space} after the type field instead of the normal \newunit.

\documentclass{article}
\usepackage{filecontents}
\usepackage[backend=biber,firstinits=true,sorting=nyt,maxbibnames=3]{biblatex} 
\usepackage[ngerman]{babel}
\begin{filecontents*}{\jobname.bib}
@phdthesis{schmidt14,
  author = {Schmidt, Johannes},
  title = {Testtest},
  school = {Test Univ.},
  year = {2014},
}
\end{filecontents*}
\usepackage{xpatch}

\xpatchbibdriver{thesis}
  {\printfield{type}%
   \newunit}
  {\printfield{type}%
   \setunit{\addcomma\space}}
  {}{}

\addbibresource{\jobname.bib}
\begin{document}
  \cite{schmidt14}
  \printbibliography
\end{document}

enter image description here

2
  • Great answer! Thank you! There is sadly still one problem: It doesn't work if the "type" field in the .bib-file is used. – Ystar Jul 30 '14 at 14:21
  • 1
    @user3629500 It should work in that case as well, but if your type fields ends in a period, you will have to add \isdot just after that dot, like type = {PhD diss.\isdot}. We could circumvent this by adding \DeclareFieldFormat{type}{\ifbibstring{#1}{\bibstring{#1}}{#1}\isdot} to the preamble. (See this related question). – moewe Jul 30 '14 at 16:04
1

Add these lines to your preamble:

\usepackage{xpatch} 
\xpatchbibdriver{thesis}{%
  \printfield{type}%
  \newunit
}
{%
  \printfield{type}%
  \setunit{\addcomma\space}
}{}{}

enter image description here

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.