1

I am struggling putting the bibliography in the required format. More precisely, a MWE of my code is

 \documentclass[12pt,a4paper]{article}
 \usepackage[utf8]{inputenc}
 \usepackage[T1]{fontenc}
 \usepackage{graphicx}
 \PassOptionsToPackage{hyphens}{url}
 \usepackage[hidelinks]{hyperref}
 \usepackage[ngerman]{babel}
 \usepackage[
 backend=biber,
 style=authoryear,
 citestyle=authoryear,
 ]{biblatex}
 \addbibresource{test.bib}
 \begin{filecontents}{test.bib}
     @Book{Behrbohm2012,
        author    = {Behrbohm, Hans and Kaschke, Oliver and Nawka, Tadeus},
        title     = {Kurzlehrbuch Hals-Nasen-Ohren-Heil\-kunde},
        year      = {2012},
        edition   = {2. Auflage},
        publisher = {Thieme},
        location  = {Stuttgart},
     }
     @WWW{VisuellesDenken,
         author  = {Fritsche, Olaf},
         title   = {Visuelles Denken},
        year    = {2018},
        url     = {http://www.visuelles-denken.de},
        urldate = {2018-04-08},
     }
 \end{filecontents}
 \renewcommand{\labelnamepunct}{\addcolon\space}
 \DeclareNameAlias{sortname}{last-first}
 \DeclareNameAlias{author}{sortname}
 \DeclareNameAlias{editor}{sortname}
 \DeclareNameAlias{translator}{sortname}
 \renewcommand*{\multinamedelim}{\addnbthinspace\slash\addthinspace}
 \renewcommand*{\finalnamedelim}{\multinamedelim}
 \AtEveryBibitem{%
    \clearfield{month}%
    \ifentrytype{article}
    {\clearfield{volume}
        \clearfield{number}}
    {}
 }
 \renewbibmacro*{publisher+location+date}{%
    \setunit{\addcomma\space}
    \printlist{publisher}
     \setunit{\addcomma\space}%
     \printlist{location}%
     \setunit*{\addspace}%
     \usebibmacro{date}%
     \newunit}

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

 \renewbibmacro*{journal+issuetitle}{%
    \usebibmacro{journal}%
    \setunit*{\addspace}%
    \iffieldundef{series}
    {}
    {\newunit
        \printfield{series}%
        \setunit{\addspace}}%
    \usebibmacro{volume+number+eid}%
    \setunit{\addcomma\space}%
    \usebibmacro{issue+date}%
    \setunit{\addcolon\space}%
    \usebibmacro{issue}%
    \newunit}

 \renewbibmacro*{issue+date}{%
    \printfield{issue}%
    \setunit*{\addspace}%
     \usebibmacro{date}%
     \newunit}

 \renewbibmacro*{series+number}{%
     \iffieldundef{series}
     {}
     {\printtext[parens]{%
            \printfield{series}%
            \setunit*{\addspace}%
            \printfield{number}}}}

 \setlength{\bibhang}{0pt}
 \newcommand\blfootnote[1]{%
    \begingroup
    \renewcommand\thefootnote{}\footnote{#1}%
    \addtocounter{footnote}{-1}%
    \endgroup
 }
 \DeclareFieldFormat[article]{title}{{#1}}
 \DeclareFieldFormat[thesis]{title}{{#1}}
 \setlength{\parindent}{0pt}

 \DeclareFieldFormat{url}{\url{#1}}
 \setlength{\bibitemsep}{\baselineskip}


 \expandafter\def\expandafter\UrlBreaks\expandafter{\UrlBreaks%  save the      current one
    \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j%
    \do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t%
     \do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D%
     \do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N%
     \do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X%
     \do\Y\do\Z}
 %\DefineBibliographyStrings{german}{% 
 %  urlseen = {}, 
 %}
 \DeclareFieldFormat{urldate}{(Stand: #1)}
 \renewcommand*{\nameyeardelim}{\addcomma\space}
 \begin{document}
        \nocite{*}
        \printbibliography
 \end{document}

This produces

Behrbohm, Hans / Kaschke, Oliver / Nawka, Tadeus (2012): Kurzlehrbuch Hals- Nasen-Ohren-Heilkunde. 2. Auflage, Thieme, Stuttgart.

Fritsche, Olaf (2018): Visuelles Denken. http://www.visuelles-denken.de (Stand: 08. 04. 2018).

But what I am after is

Behrbohm, Hans / Kaschke, Oliver / Nawka, Tadeus (2012): Kurzlehrbuch Hals- Nasen-Ohren-Heilkunde, 2. Auflage, Thieme, Stuttgart.

Fritsche, Olaf (2018): Visuelles Denken, (http://www.visuelles-denken.de; Stand: 08. 04. 2018).

Thanks for your help.

  • 1
    \renewcommand*{\newunitpunct}{\addcomma\space} should help with the full stop vs comma issue. – moewe Sep 29 '18 at 7:57
  • yeah, in fact \renewcommand*{\newunitpunct}{\addcomma\space} did the job. – julian Sep 29 '18 at 8:00
  • 1
    What version of biblatex (check your .log file to find out, or report the Biber version) are you using? – moewe Sep 29 '18 at 8:00
  • I am using biber 2.5. – julian Sep 29 '18 at 8:01
  • 1
    That version is quite old. (The current version is Biber 2.11. Biber 2.5 was released almost two and a half years ago.) Any chance of an update? (Do remember that biblatex and Biber must be updated at the same time and that you should not update packages from CTAN manually. You should use the facilities provided by your TeX distribution.) – moewe Sep 29 '18 at 8:02
2

You can get commas instead of full stops in many places with

\renewcommand*{\newunitpunct}{\addcomma\space}

For the URL I would use

\DefineBibliographyStrings{german}{
  urlfrom = {Stand},
}

\DeclareFieldFormat{outerurl}{\mkbibparens{#1}}
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{urldate}{\bibstring{urlfrom}\addcolon\space#1}

\renewbibmacro*{url+urldate}{%
  \iffieldundef{url}
    {}
    {\printtext[outerurl]{%
       \usebibmacro{url}%
       \iffieldundef{urlyear}
         {}
         {\setunit*{\addcomma\space}%
          \usebibmacro{urldate}}}}}

You should also be able to do away with the redefinition of \UrlBreaks if you just use the URL penalties instead as explained in the second half of Audrey's answer to URL line breaks with biblatex. hyperref should be loaded last.

MWE (modernised for current versions of biblatex)

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[
  backend=biber,
  style=authoryear,
]{biblatex}
\usepackage[hidelinks]{hyperref}

\renewcommand*{\newunitpunct}{\addcomma\space}

\DeclareNameAlias{sortname}{family-given}
\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{editor}{sortname}
\DeclareNameAlias{translator}{sortname}

\DeclareDelimFormat{multinamedelim}{\addnbthinspace\slash\addthinspace}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}

\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcolon\space}
\DeclareDelimFormat{nameyeardelim}{\addcomma\space}

\AtEveryBibitem{%
  \clearfield{month}%
  \ifentrytype{article}
    {\clearfield{volume}
     \clearfield{number}}
    {}}

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

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

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addspace}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \usebibmacro{volume+number+eid}%
  \setunit{\addcomma\space}%
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}

\renewbibmacro*{issue+date}{%
  \printfield{issue}%
  \setunit*{\addspace}%
  \usebibmacro{date}%
  \newunit}

\renewbibmacro*{series+number}{%
  \iffieldundef{series}
    {}
    {\printtext[parens]{%
       \printfield{series}%
       \setunit*{\addspace}%
       \printfield{number}}}}

\setlength{\bibhang}{0pt}
\newcommand\blfootnote[1]{%
  \begingroup
  \renewcommand\thefootnote{}\footnote{#1}%
  \addtocounter{footnote}{-1}%
  \endgroup
}
\DeclareFieldFormat[article,thesis]{title}{#1}

\DefineBibliographyStrings{german}{
  urlfrom = {Stand},
}

\DeclareFieldFormat{outerurl}{\mkbibparens{#1}}
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{urldate}{\bibstring{urlfrom}\addcolon\space#1}

\renewbibmacro*{url+urldate}{%
  \iffieldundef{url}
    {}
    {\printtext[outerurl]{%
       \usebibmacro{url}%
       \iffieldundef{urlyear}
         {}
         {\setunit*{\addcomma\space}%
          \usebibmacro{urldate}}}}}

\setlength{\bibitemsep}{\baselineskip}

\setlength{\parindent}{0pt}


\begin{filecontents}{\jobname.bib}
@Book{Behrbohm2012,
  author    = {Behrbohm, Hans and Kaschke, Oliver and Nawka, Tadeus},
  title     = {Kurzlehrbuch Hals-Nasen-Ohren-Heil\-kunde},
  year      = {2012},
  edition   = {2. Auflage},
  publisher = {Thieme},
  location  = {Stuttgart},
}
@WWW{VisuellesDenken,
  author  = {Fritsche, Olaf},
  title   = {Visuelles Denken},
  year    = {2018},
  url     = {http://www.visuelles-denken.de},
  urldate = {2018-04-08},
}
\end{filecontents}
\addbibresource{\jobname.bib}

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

Behrbohm, Hans/Kaschke, Oliver/Nawka, Tadeus (2012): Kurzlehrbuch Hals-Nasen-Ohren-Heilkunde, 2. Auflage, Thieme, Stuttgart.//Fritsche, Olaf (2018): Visuelles Denken, (http://www.visuelles-denken.de, Stand: 08.04.2018).

I would also not set the hanging indent in the bibliography to zero, the hanging indent makes it much easier to navigate the bibliography. I also can not recommend setting \parindent to zero, see https://komascript.de/node/2199 (in German, since your document is in German I assume you can read German, if not I apologize).

  • 1
    Ugh, I just realised there is a comma between the URL and the urldate and not a semicolon as desired: Let's say we leave the semicolon as an exercise to the reader. If you have trouble finding the right spot in the code to modify, just comment here. – moewe Sep 29 '18 at 8:19
  • I find the right place. Many thanks for your help. – julian Sep 29 '18 at 8:24

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.