5

I know of the option firstinits=true to abbreviate the first and all middle names in biblatex. What I would like to achieve is to only abbreviate the middle names. So e.g. author = {Smith, John Ethan Jacob} should be printed as Smith, John E. J.

Please see the MWE based on the answer of Jonathan from this post at the end of this question. I get the following output:

[SD95] Smith, John E. J./Doe, Jain L. Some book title. A Publisher, 1995.

But what I would like to see as output is:

[SD95] Smith, John E. J. ; Doe, Jain L: Some book title. A Publisher, 1995.

The ; between the author names and the : between the author names and the book title are specific to the bib style (custom made) I use. But the solution below doesn't respect this custom style. Any idea how to achieve the desired abbreviation, but don't loose the bib style?

MWE:

\documentclass{article}
\usepackage[backend=biber,style=din, autocite=footnote]{biblatex}

\begin{filecontents*}{bibliography.bib}
@BOOK{SD1995,
  author = {Smith, John Ethan Jacob and Doe, Jain Lauren},
  title = {Some book title},
  year = {1995},
  publisher = {A Publisher}
}
\end{filecontents*}

\addbibresource{bibliography.bib}

\usepackage[T1]{fontenc}

\def\bibnamedelima{ }%
\def\bibnamedelimb{ }%
\DeclareNameFormat{author}{%
  \ifblank{#5}{}{#5\addspace}% prefix if applicable
  #1% last name
  \edef\firstname{#3}%
  \ifblank{#3}{}{\addcomma\addspace\expandafter\first{\firstname}}%
  \ifthenelse{\value{listcount}<\value{liststop}}%
   {\addslash}{}%
}

\DeclareNameFormat{labelname}{%
  \ifblank{#5}{}{#5\addspace}% prefix if applicable
  #1% last name
  \edef\firstname{#3}%
  \ifblank{#3}{}{\addcomma\addspace\expandafter\first{\firstname}}%
  \ifthenelse{\value{listcount}<\value{liststop}}%
   {\addslash}{}%
}

\makeatletter
\def\@empty{}
\def\first#1{\expandafter\@first#1 \@nil}
\def\@first#1 #2\@nil{#1\addspace%
  \if\relax\detokenize{#2}\relax\else\@initials#2\@nil\fi}
\def\initials#1{\expandafter\@initials#1 \@nil}
\def\@initials#1 #2\@nil{%
  \initial{#1}%
  \def\NextName{#2}%
  \ifx\@empty\NextName\relax%
  \else\@initials#2\@nil\fi}
\def\initial#1{\expandafter\@initial#1\@nil}
\def\@initial#1#2\@nil{#1.\addspace}
\makeatother



\begin{document}
\null
\vfill

How the citation look like: \cite{SD1995}

\clearpage
\printbibliography
\end{document}

Edit Please look here for the din style I'm using in the MWE. With this style I get two white spaces between the first author and the separating ;, when I use the modification by Andrew Swann. Without the modification there is only one white space. I'm now looking for a solution to this problem.

  • @cmhughes Nearly, but it changes the styles of my bibstyle. So for example in the style the last names are in small caps and the delimiter between multiple authors is a ' ; ' not '/'. Do you know how to change it? – user2653422 Jul 2 '14 at 20:21
  • @cmhughes And if the last name of the authors list is one with a middle name the ':' between its name and the title of the book is missing. For Example: Smith, John: The handbook of but Smith, John E. The handbook of – user2653422 Jul 7 '14 at 6:34
  • Please provide a MWE. – musicman Jul 7 '14 at 6:48
  • @musicman I added the MWE in my initial post. I hope it is clear what I mean, even without my custom bib style. – user2653422 Jul 7 '14 at 8:07
5

Here is something less invasive than the solution you have tried. It relies on adjusting the macro \mkbibnamefirst which is called to format the first and middle names rather than completely rewriting the name format:

Sample output

\documentclass{article}
\usepackage[backend=biber,style=alphabetic,autocite=footnote]{biblatex}

\begin{filecontents*}{bibliography.bib}
@BOOK{SD1995,
  author = {Smith, John Ethan Jacob and Doe, Jain Lauren},
  title = {Some book title},
  year = {1995},
  publisher = {A Publisher}
}
\end{filecontents*}

\addbibresource{bibliography.bib}

\usepackage[T1]{fontenc}

\renewcommand*{\mkbibnamefirst}[1]{\edef\firstname{#1}\expandafter\first{\firstname}}

\def\bibnamedelima{ }%
\def\bibnamedelimb{ }%

\makeatletter
\def\@empty{}
\def\first#1{\expandafter\@first#1 \@nil}
\def\@first#1 #2\@nil{#1\addspace%
  \if\relax\detokenize{#2}\relax\else\@initials#2\@nil\fi}
\def\initials#1{\expandafter\@initials#1 \@nil}
\def\@initials#1 #2\@nil{%
  \initial{#1}%
  \def\NextName{#2}%
  \ifx\@empty\NextName\relax%
  \else\bibinitdelim \@initials#2\@nil\fi}
\def\initial#1{\expandafter\@initial#1\@nil}
\def\@initial#1#2\@nil{#1\bibinitperiod}
\makeatother

\begin{document}
How the citations appear: \cite{SD1995}.

\printbibliography
\end{document} 

Update with the din style you point to in your update you should add

\AtBeginBibliography{\renewcommand*{\multinamedelim}{\addsemicolon\addspace}}

to your preamble. The din style contains the definition

\renewcommand*{\multinamedelim}{\mbox{ }\addspace\addsemicolon\addspace}

which adds a single space before the semicolon. Another way to get a single space would be

\AtBeginBibliography{\renewcommand*{\multinamedelim}{\addspace;\addspace}}
  • Thank you, nearly perfect. One little thing between the abbreviated J. (Jacob) of the first author and the separating ; I have now two white spaces (without the modification there is only one). It does not happen in your solution with the alphabetic style, because there the separator is the word and. Do you have an idea why this happen or how I can provide my custom style here so it becomes clear what I'm talking about ;) – user2653422 Jul 7 '14 at 18:43
  • You can add your custom style to your question. The most obvious question is how are you adding spaces and punctuation? In particular do you use biblatex's macros such as \addspace etc. – Andrew Swann Jul 8 '14 at 7:12
  • Sorry for the late response. The style I'm using is basically this one (just modified it a little) The problem with the ; can be reproduced with the original style from domhardt, but I don't know where to look for it. I updated my original post with this style and a link to the github rep. – user2653422 Jul 10 '14 at 11:36
  • Thanks for the update. With the modification the white space is gone completely so now it's J.; Doe. What I would like to have is a single white space before and after the semicolon like J. ; Doe. I tried \AtBeginBibliography{\renewcommand*{\multinamedelim}{\addspace\addsemicolon\addspace}} so without the mbox{} of the original style but it didn't work. – user2653422 Jul 10 '14 at 12:08
  • I think there is only one space there - anyway I have added another way to get a space. – Andrew Swann Jul 10 '14 at 12:56

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.