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!

Ystar
  • 386
  • If you are interested in german help, you should check out TeXwelt. – Johannes_B Jul 28 '14 at 15:10
  • A lot of different bib styles are available. Have you gone through them yet? http://www.univie.ac.at/nuhag-php/bibtex/bibstyles.pdf – 1010011010 Jul 28 '14 at 15:22
  • Does this: http://tex.stackexchange.com/questions/170547/in-biblatex-treat-periods-in-journal-as-abbreviation-dots help? – darthbith Jul 28 '14 at 16:07
  • Biblatex not bibtex. Also I don't want to use another style. I just want to know the command like \nametitledelim for type and school. – Ystar Jul 28 '14 at 16:08

2 Answers2

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

moewe
  • 175,683
  • 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

Bernard
  • 271,350