# Formatting/searching special bibliographystyle using natbib package

I'm searching for a special bibliographystyle to meet the following requirements (I post one example):

LÜTKEPOHL H., KRÄTZIG M. (2004).

Applied Time Series Econometrics. Cambridge University Press, Cambridge.

So names should be in upper case; format: last name and then initials of first name (with or without a following dot), year in brackets (with or without a following dot), followed by a line-break, the titel should be displayed italic.

I use the natbib package because I want to have author-year citation in the text (e.g. Lütkepohl and Krätzig (2004)), which is working fine already.

By the way the entry in the reference list should begin directly with the last name of the author, i.e. without numbering or acronym in front (I think this will be achieved automatically by means of using the natbib package?).

I'm using \documentclass[a4paper]{article} and JabRef as reference manager.

Would be very happy if someone can help me! Thank you very much!

• Do you want to use natbib or are you OK with biblatex as well? Unfortunately, the information you provide is quite limited. What about @article entries, @online, etc. pp.? ISBN, URL ...? – moewe Sep 27 '13 at 14:42
• I'm not familiar with biblatex and it appeared to be more complicated than the natbib package to me. I don't need entries of the type ISBN, URL... I only need authors, year, title, publisher, edition. Does this information help enough? – Dani84 Sep 27 '13 at 14:48
• Off the top of my head, I would say what you want can be easily achieved with biblatex (it might be quite daunting to begin with, but is actually quite easy to use What to do to switch to biblatex? and biblatex for idiots). I'm still not sure what format for @articles you like, these normally do not have publisher and edition, but journal, number, issue etc. – moewe Sep 27 '13 at 15:04
• note: I only need URL, if there is no book or article to cite and the source is only available via internet. But there are no demands for a special ordering of this entries, if you wanted to know this – Dani84 Sep 27 '13 at 15:04
• ah ok, for article I like the entries author, title, journal, year, volume, pages – Dani84 Sep 27 '13 at 15:08

This can be quite easily be done with biblatex.

Just load biblatex with style=authoryear and firstinits=true (the latter is - you guessed it, to display only initials), and add the following to your preamble. For some of the following patches you will need the awesome xpatch.

\DeclareNameAlias{sortname}{last-first}
\DeclareFieldFormat[incollection,article]{title}{\mkbibemph{#1}}
\DeclareFieldFormat[incollection,article]{citetitle}{\mkbibemph{#1}}

\renewbibmacro{in:}{%
\ifentrytype{article}{}{%
\printtext{\bibstring{in}\intitlepunct}}}

\DefineBibliographyStrings{german}{%
bibliography     = {Literaturverzeichnis},
references       = {Literaturverzeichnis},
}

\AtBeginBibliography{%
\renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}%
\renewcommand*{\labelnamepunct}{\\}%
\renewbibmacro*{title}{%
\ifboolexpr{
test {\iffieldundef{title}}
and
test {\iffieldundef{subtitle}}
}
{}
{\printtext[title]{%
\printfield[titlecase]{title}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}%
\newunit}%
\printunit{\newunitpunct\\}}%
}

\newbibmacro*{ineditor+others}{%
\ifboolexpr{
test \ifuseeditor
and
not test {\ifnameundef{editor}}
}
{\printnames{editor}%
\clearname{editor}}
{}}

\xpatchbibdriver{incollection}
{\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}
{\usebibmacro{ineditor+others}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}%
{\typeout{replaced \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{incollection}}}
{\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{incollection}}}%

\xpatchbibdriver{inbook}
{\usebibmacro{bybookauthor}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}
{\usebibmacro{ineditor+others}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}%
{\typeout{replaced \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{inbook}}}
{\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{inbook}}}%

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\xpatchbibmacro{editor}%
}
}
{\typeout{patched bibmacro{editor}}}
{\typeout{failed to patch bibmacro{editor}. Note that this is not necessarily bad if bibmacro{bbx:editor} was succesfully patched}}

% bibmacro{bbx:editor} is specially defined by authortitle and friends for some internal fun
\xpatchbibmacro{bbx:editor}%
}
}
{\typeout{patched bibmacro{bbx:editor}}}
{\typeout{failed to patch bibmacro{bbx:editor}, note that this is not necessarily bad if bibmacro{editor} was succesfully patched}}

\renewrobustcmd*{\bibinitperiod}{}
\renewrobustcmd*{\bibinitdelim}{}
\renewrobustcmd*{\bibinithyphendelim}{}
\renewcommand*{\revsdnamepunct}{}


This makes sure names in the bibliography are "last, first" and there are no quotation marks for @incollection. Note though that this change is quite inconsistent, as normally the "main work" is emphasised (that would be the @collection) and the specific part (the @incollection) is in quotation marks. Also the heading (for German documents) is changed to "Literaturverzeichnis". The \AtBeginBibliography{...} portion makes sure that only in the bibliography names are small caps, there is a new line after the author and year and after the title as well. We then define a new macro (this is necessary so we do not get any dashes) for the editor of "in ..."-works. The bibliography drivers for @incollection and @inbook are patched to include the editor before the title. Finally, we make sure the editor string ("eds."/"Hrsg." etc.) is printed in parentheses without any preceding comma. The last chunk of code formats names and initials. There are no periods after the initial, neither are there spaces between two initials. Hyphenated names are treated like non-hyphenated ones and there is no comma between the last name and the initials of the first name

The MWE

\documentclass[ngerman]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear, maxnames=999, maxcitenames=3, firstinits=true]{biblatex}
\usepackage{xpatch}
\usepackage{hyperref}

\DeclareNameAlias{sortname}{last-first}
\DeclareFieldFormat[incollection,article]{title}{\mkbibemph{#1}}
\DeclareFieldFormat[incollection,article]{citetitle}{\mkbibemph{#1}}

\renewbibmacro{in:}{%
\ifentrytype{article}{}{%
\printtext{\bibstring{in}\intitlepunct}}}

\DefineBibliographyStrings{german}{%
bibliography     = {Literaturverzeichnis},
references       = {Literaturverzeichnis},
}

\AtBeginBibliography{%
\renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}%
\renewcommand*{\labelnamepunct}{\\}%
\renewbibmacro*{title}{%
\ifboolexpr{
test {\iffieldundef{title}}
and
test {\iffieldundef{subtitle}}
}
{}
{\printtext[title]{%
\printfield[titlecase]{title}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}%
\newunit}%
\printunit{\newunitpunct\\}}%
}

\newbibmacro*{ineditor+others}{%
\ifboolexpr{
test \ifuseeditor
and
not test {\ifnameundef{editor}}
}
{\printnames{editor}%
\clearname{editor}}
{}}

\xpatchbibdriver{incollection}
{\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}
{\usebibmacro{ineditor+others}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}%
{\typeout{replaced \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{incollection}}}
{\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{incollection}}}%

\xpatchbibdriver{inbook}
{\usebibmacro{bybookauthor}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}
{\usebibmacro{ineditor+others}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}%
{\typeout{replaced \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{inbook}}}
{\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{inbook}}}%

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\xpatchbibmacro{editor}%
}
}
{\typeout{patched bibmacro{editor}}}
{\typeout{failed to patch bibmacro{editor}. Note that this is not necessarily bad if bibmacro{bbx:editor} was succesfully patched}}

% bibmacro{bbx:editor} is specially defined by authortitle and friends for some internal fun
\xpatchbibmacro{bbx:editor}%
}
}
{\typeout{patched bibmacro{bbx:editor}}}
{\typeout{failed to patch bibmacro{bbx:editor}, note that this is not necessarily bad if bibmacro{editor} was succesfully patched}}

\renewrobustcmd*{\bibinitperiod}{}
\renewrobustcmd*{\bibinitdelim}{}
\renewrobustcmd*{\bibinithyphendelim}{}
\renewcommand*{\revsdnamepunct}{}

\begin{document}
\nocite{murray,brandt,hyman,wilde,westfahl:space,aristotle:anima,herrmann,baez/article}

\printbibliography
\end{document}


gives

Feel free to comment, in case your requirements specify things differently.

• Thank you so much for you support moewe. Most of it works. But I've got a few more questions: How can I add the line break again after the title? How can I get rid of the "" in case of incollections? And how is it possible to show the authornames in the text itself not in upper case (only in the reference)? And I used "\renewcommand{\refname}{Literaturverzeichnis}" for changing the title of the reference list, but it doesn't work anymore. There was a problem that I had to write backend=bibtex8 for the citation to work. I hope, this is ok. – Dani84 Sep 27 '13 at 17:19
• @Dani84 You might want to have a look at the edited answer. Regarding backend=bibtex8, if it works for you that is fine; biber does support some for features though, so you might want to install it on your system. – moewe Sep 28 '13 at 7:22
• Thank you sooo much, Moewe! It works. But I still like to know: how can I get rid of the "" that are still present for the title of articles? And I want to have these titles also in italics and there should be no IN: in front of the journal... hope you understand, what I mean. And it would be more suitable for Incollections to be in this format: In: authors (Hrsg.): title and so on. [Hrsg. means editors in german] Sorry for so much detailed questions, but I'm not getting familiar with codes in biblatex :( – Dani84 Sep 30 '13 at 11:13
• @Dani84 See the edit. There is quite some modification to be done, sou you will need xpatch. – moewe Sep 30 '13 at 11:50
• @Dani84 You will have to install l3kernel, l3packages, l3experimental and, of course, xpatch. What TeX distribution do you use? – moewe Sep 30 '13 at 14:37