8

DIN 1505 requires breakable interword spaces in front of punctuation. A bibliography entry is supposed to look like this:

Lastname1, Firstname1 ; Lastname2, Firstname2: Title : Subtitle [...]

                                     ^                                                    ^

I tried to accomplish this by redefining the \multinamedelim and \subtitlepunct commands. Unfortunately the \addspace in front of \addsemicolon respectively \addcolon doesn't show up in the resulting file. The reason for this is the \unspace command, which removes preceding whitespaces. It is implicitly executed by \addspace.

MWE:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[
style=alphabetic,
backend=biber,
]{biblatex}
\addbibresource{test.bib}

\begin{filecontents}{test.bib}
@BOOK{Author2001,
  author = {Alastname, Afirstname},
  title = {Title},
    subtitle = {Subtitle},
  year = {2001},
}
\end{filecontents}

% Setup bibliography
\DeclareNameAlias{default}{last-first}
\renewcommand*{\multinamedelim}{\addspace\addsemicolon\addspace}
\renewcommand*{\finalnamedelim}{\addspace\addsemicolon\addspace}
\renewcommand*{\multilistdelim}{\addspace\addsemicolon\addspace}
\renewcommand*{\finallistdelim}{\addspace\addsemicolon\addspace}
\renewcommand*{\labelnamepunct}{\addcolon\addspace}
\renewcommand*{\subtitlepunct}{\addspace\addcolon\addspace}
\renewcommand*{\finentrypunct}{}

\begin{document}
Filler text \cite{Author2001}

\printbibliography
\end{document}

MWE

I found an example of a DIN 1505 style (see here). The author substituted \addspace with \mbox{ }. Unfortunately this is not officially supported by biblatex. Does anyone know a better solution?

  • In front of the colons and semicolons? This seems strange. However, the places where you'd like to have spaces are difficult to tell from your example; can you use a fixed width font for better showing them? – egreg Aug 28 '13 at 9:16
  • 1
    This looks really strange and I have not seen any journal using this format. DIN 1505 is supposed to be replaced with DIN ISO 690 which does not seem to include this format, so I would recommend using the updated version instead. – Alexander Aug 28 '13 at 11:29
  • Yes, I meant the spaces in front of the colons and semicolons. I formated my example as code. That way a fixed font width is used and hopefully things become clearer. – FrogThomas Aug 28 '13 at 13:46
  • @Alexander I think the style DIN 1505 is not all that unpopular. For example bibsonomy.org is able to export it. Anyway, I'm supposed to us this style and not ISO 690. By the way, ISO 690 also has spaces in front of colons and semicolons! – FrogThomas Aug 28 '13 at 13:49
6

You could just replace the \addsemicolon/\addcolon etc. commands by a plain ; or : respectively, so \DeclareDelimFormat{multinamedelim}{\addspace\addsemicolon\addspace} becomes \DeclareDelimFormat{multinamedelim}{\addspace;\addspace}. That way biblatex does not check for space preceding the punctuation mark, but neither will it check for preceding punctuation symbols as \addsemicolon would.

We can also delve a little bit deeper into the internals of biblatex and try and define our own space-preserving macros \addsp<punct>. Those macros are defined via \blx@addsppunct, which is essentially the macro \blx@addpunct with the \unspace commented out.

You now use \addspsemicolon and \addspcolon instead of \addsemicolon and \addcolon whenever you do not want the preceding space to disappear.

MWE

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[
  style=alphabetic,
  backend=biber,
]{biblatex}

\makeatletter
% see biblatex.sty for these macros
\blx@regimcs{%
  \addspsemicolon \addspcolon \addspcomma}
\def\blx@addsppunct#1{% <---- new name for spaced punctuation
  %\unspace <----- commented out
  \ifnum\blx@spacefactor<\blx@sf@threshold@low
    \csuse{blx@qp@#1}\csuse{abx@#1}%
  \else
    \ifnum\blx@spacefactor>\blx@sf@threshold@high
      \csuse{blx@qp@#1}\csuse{abx@#1}%
    \else
      \ifcsdef{blx@pp@\the\csname blx@sf@#1\endcsname @\blx@spacefactor}
        {\csuse{blx@qp@#1}\csuse{abx@#1}}
        {\csuse{blx@qp@#1}}%
    \fi
  \fi
  \csuse{blx@pq@#1}}

\protected\def\blx@imc@addspsemicolon{\blx@addsppunct{semicolon}}
\protected\def\blx@imc@addspcolon{\blx@addsppunct{colon}}
\protected\def\blx@imc@addspcomma{\blx@addsppunct{comma}}
\makeatother

% Set up bibliography
\DeclareNameAlias{default}{family-given}

\DeclareDelimFormat{multinamedelim}{\addspace\addspsemicolon\space}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}

\DeclareDelimFormat{multilistdelim}{\addspace\addspsemicolon\space}
\DeclareDelimAlias{finallistdelim}{multilistdelim}

\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space}

\renewcommand*{\subtitlepunct}{\addspace\addspcolon\space}

\renewcommand*{\finentrypunct}{}

\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{sigfridsson,worman}

\printbibliography
\end{document}

Sigfridsson, Emma ; Ryde, Ulf: „Comparison of methods for deriving atomic charges from the electrostatic potential and moments“. In: Journal of Computational Chemistry 19.4 (1998), S. 377–395. doi: 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P//Worman, Nancy: The Cast of Character : Style in Greek Literature. Austin: University of Texas Press, 2002

edit Code modernised for biblatex 3.8 and newer. See the edit history for older versions.

  • I actually hoped that there is a switch in BibLaTeX in order to temporarily switch off the \unspace-cycle. Unfortunately it seems like there isn't. Nevertheless THANKS for the coding you did. Under these circumstances, your solution of defining new macros, is the best possible one. – FrogThomas Aug 28 '13 at 19:22
  • @FrogThomas Well you could \let\oldunspace\unspace \newcommand{\nounspace}{\let\unspace\relax} \newcommand{\dounspace}{\let\unspace\oldunspace} and then use \nounspace and \dounspace to switch off all \unspace temporarily. Use it as in \renewcommand*{\multinamedelim}{\addspace\nounspace\addsemicolon\dounspace\adds‌​pace}. You can then also define \newcommand{\addspsemicolon}{\nounspace\addsemicolon\dounspace} and use \addspsemicolon as above. This is essentially the poor man's version of a switch. – moewe Aug 28 '13 at 20:46
  • Using egrep origtitle * in the biblatex folder finds the mention in biblatex1 but not biblatex2. Is this on purpose or just missed? – Johannes_B Mar 7 '16 at 17:16
  • @Johannes_B Mhh, you will find that \abx@dofields looks different in biblatex1 and biblatex2. In the former, all fields are listed, while in the latter we are referred to \def\abx@dofields{\dolistcsloop{blx@biber@datamodel@fields}}. I suppose biblatex2's origtitle lives in biblatex-dm.def. – moewe Mar 7 '16 at 17:23
  • Yes, it is. Ah, all the internals are confusing. Working on the wikibook page on bibliographies right now. – Johannes_B Mar 7 '16 at 17:25

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.