1

This is a follow up question to Customizing the biblatex style authoryear.

For my work I need 3 more types of literature altered:

@inbook:

Last Name, First Name (year): Title. In Last BookauthorName, First BookauthorName (Hg): Booktitle, Pages. Location, Publisher.

Here, "In" and "(Hg)" should be hardcoded (it's German). I managed to undo the italic style for the booktitle and the parentheses of the title by:

\DeclareFieldFormat[inbook]{booktitle}{#1}
\DeclareFieldFormat[inbook]{title}{#1}

but that's about it.

@article:

Last Name, First Name (year): Title. Journaltitle, Number (Series), Pages.

@online:

Last Name, First Name (year): Title, (besucht am Date). Url.

here, "besucht am" should be hardcoded but is no problem since it's biblatex standard in German.

I can imagine that all of this isn't quite straight forward.. But any help would be greatly appreciated! Thanks a lot!

What I have thus far:

\usepackage[style=authoryear]{biblatex}
\addbibresource{sources.bib}

\DeclareFieldFormat[book]{title}{#1} %titel non-italic
\DeclareFieldFormat[inbook]{booktitle}{#1} %booktitle non-italic
\DeclareFieldFormat[inbook]{title}{#1} %title without ""
\DeclareFieldFormat[article]{title}{#1} %title without ""
\DeclareFieldFormat[article]{journaltitle}{#1} %journaltitle non-italic
\DeclareFieldFormat[online]{title}{#1} %title non-italic

\renewbibmacro*{publisher+location+date}{%
\printlist{location}%
\setunit{\addcomma\space}%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%
\newunit}

\renewcommand{\labelnamepunct}{\addcolon\space}

\begin{document}
\parencite{heybook}
\parencite{heyinbook}
\parencite{heyarticle}
\parencite{heyonline}
\printbibliography[heading=bibintoc]
\end{document}

My sources.bib file with examples looks the following:

@book{heybook,
author    ={Simon Beck},
title     ={Buchtitel},
publisher ={Verlag},
location  ={Ort},
date      ={2011} }

@inbook{heyinbook,
bookauthor={Simonbook Beckbook},
author    ={Simoninbook Beckinbook},
booktitle ={Buchtitel},
title     ={Kapiteltitel},
publisher ={Verlag},
location  ={Ort},
pages     ={123-124},
date      ={2012} }

@article{heyarticle,
author   ={Simonarticle Beckarticle},
title    ={Artikeltitel},
journaltitle={Zeitschrift},
number   ={12},
series    ={Jahrgang},
pages    ={123-124},
date     ={2013} }

@online{heyonline,
author   ={Simononline Beckonline},
title    ={Onlinetitle},
url      ={http://pes.ee.ethz.ch},
urldate  ={2014-04-12},
date     ={2014} }
5
  • We can help you faster, if you provide a compilable MWE including your bib-file. You can use the package filecontents for that: \begin{filecontents}{sources.bib}@book{...}\end{filecontents}
    – musicman
    Apr 30, 2014 at 9:37
  • Thanks for your help! How i do I provide a compilable MWE? I did not alter any other files besides my main .tex file as shown above. Please give me a minute to figure out how to use filecontents properly..;)
    – Simon Beck
    Apr 30, 2014 at 9:53
  • 1
    Okey, sadly, I didn't got filecontents to work.. but I included my sources.bib into my post. Hope this is helpful as well. Thanks!
    – Simon Beck
    Apr 30, 2014 at 10:17
  • Yes, I will work on an answer.
    – musicman
    Apr 30, 2014 at 10:18
  • Why exactly do you want to use series with @articles? The series field is intended for things like "new series", "neue Folge" etc.. Normally volume and number are enough. Do you have a real-life example when you might need series?
    – moewe
    Apr 30, 2014 at 17:05

1 Answer 1

5

Okay, look at your updated MWE:

\documentclass[a4 paper,12pt]{article}
\usepackage[style=authoryear,dashed=false]{biblatex}
\usepackage[ngerman]{babel} 

\begin{filecontents}{mybib.bib}
@book{heybook,
author    ={Simon Beck},
title     ={Buchtitel},
publisher ={Verlag},
location  ={Ort},
date      ={2011} }

@inbook{heyinbook,
% bookauthor={Simonbook Beckbook},
author    ={Simoninbook Beckinbook},
editor    ={Fritz HerausgeberGuy and Frieda HerausgeberGirl},
booktitle ={Buchtitel},
title     ={Kapiteltitel},
publisher ={Verlag},
location  ={Ort},
pages     ={123-124},
date      ={2012} }

@article{heyarticle,
author   ={Simonarticle Beckarticle},
title    ={Artikeltitel},
journaltitle={Zeitschrift},
number   ={12},
series    ={Jahrgang},
pages    ={123-124},
date     ={2013} }

@online{heyonline,
author   ={Simononline Beckonline},
title    ={Onlinetitle},
url      ={http://pes.ee.ethz.ch},
urldate  ={2014-04-12},
date     ={2014} }
\end{filecontents}


\addbibresource{mybib.bib}
\DeclareFieldFormat[book]{title}{#1} %titel non-italic
\DeclareFieldFormat[inbook]{booktitle}{#1} %booktitle non-italic


%my code:
\DeclareFieldFormat[inbook]{title}{#1} %title without ""
\DeclareFieldFormat[article]{journaltitle}{#1} %non-italic
\DeclareFieldFormat[online]{title}{#1} %non-italic
\DeclareFieldFormat[article]{title}{#1} %titel unquoted

\renewcommand{\intitlepunct}{}%no ":" after "in"

\DefineBibliographyStrings{german}{%redefine strings
editor= {Hg},%if you want to add a dot, add \adddot 
editors = {Hgg}
}


\renewbibmacro*{editor+others}{%from biblatex.def, parencites around editor
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
    {\printnames{editor}%
     \addspace%
     \mkbibparens{\usebibmacro{editor+othersstrg}}%add parens
     \clearname{editor}}
    {}}



\DeclareBibliographyDriver{inbook}{%from standard.bbx; macro "editor..." instead of "byeditor..."
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{bybookauthor}%
  \newunit\newblock
  \setunit{\addspace}\newblock%added
  \usebibmacro{editor+others}%added
  \setunit{\addcolon\addspace}%added
  \usebibmacro{maintitle+booktitle}%moved
  \setunit{\addcomma\addspace}\newblock%moved
  \usebibmacro{chapter+pages}%moved
  % \newunit\newblock
  % \usebibmacro{byeditor+others}%
  % \newunit\newblock
  % \printfield{edition}%maybe add again if needed
  \newunit
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}



\DeclareBibliographyDriver{article}{%from standard.bbx, removed macro "in:"
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{bytranslator+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit\newblock
  % \usebibmacro{in:}%
  \usebibmacro{journal+issuetitle}%
  \newunit
  \usebibmacro{byeditor+others}%
  \newunit
  \usebibmacro{note+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{issn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}   


 \newbibmacro*{journal+issuetitle}{%standard.bbx, rearranged, parencites
  \usebibmacro{journal}%
  \setunit*{\addcomma\addspace}%
  \printfield{number}%
  \setunit{\addspace}%
  %end
  \iffieldundef{series}
    {}
    {%\newunit
     \printfield[parens]{series}%
     % \setunit{\addspace}}%
     }  
  \setunit{\addspace}%
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}


\DeclareBibliographyDriver{online}{%arrange, deleted some macros
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \setunit{\addcomma\addspace}%modified
  \usebibmacro{url+urldate}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\renewbibmacro*{url+urldate}{%from biblatex.def, rearranged
  \iffieldundef{urlyear}
    {}
    {\printurldate}
  \setunit{\addperiod\addspace}%added
  \printfield{url}%moved
}


%your code
\renewbibmacro*{publisher+location+date}{%
\printlist{location}%
\setunit{\addcomma\space}%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%
\newunit}

\renewcommand{\labelnamepunct}{\addcolon\space}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

This is rather much code. There may be better ways to do what you want, but it gives you a start. I've commented the code; in some parts it may not be the best, and you have to modify it to your needs. A few notes:

  • You should use editor (Herausgeber) instead of bookauthor.
  • Your citation style is inconsistent, but that's not a LaTeX-problem...
  • If you want to cite an article out of a book, consider to put both in your bibtex-file and refer it in the article via crossref={key}. So you can seperate things better and don't have to write data again and again. For example booktitle, this will be automaticall inherited if you put in a title-field from a book-entry and use crossref in your article.
  • The updated MWE also includes the bibfile as a filecontent.


Output:

output

5
  • You're officially a genius! Thank you so much! May I ask how you learned all of this? I couldn't find any useful information on this topic on the web? Thanks again.
    – Simon Beck
    Apr 30, 2014 at 13:01
  • Oh I'm not a genius, you don't know the others ;) I've just learned like you: Try, ask and manuals.
    – musicman
    Apr 30, 2014 at 13:12
  • One more thing: If an answer solves your problem and you're okay with it, mark it as your accepted answer.
    – musicman
    Apr 30, 2014 at 13:22
  • 1
    Since the OP seems to want to have all titles in non-italic and not quotes, a single \DeclareFieldFormat*{title}{#1} and \DeclareFieldFormat*{booktitle}{#1} will make things a bit shorter.
    – moewe
    Apr 30, 2014 at 16:59
  • 2
    If the only purpose of the redefinition of the @article driver is to get rid of the in, you'd better go with Suppress “In:” biblatex. You could also move the editor macros in @inbook entries via xpatch as in Move names of editors followed by (Ed./Eds.) and a comma before title in biblatex, so you can avoid copying the whole driver from standard.bbx.
    – moewe
    Apr 30, 2014 at 17:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .