Search code examples
latexbiblatex

biblatex: customizing bibliography entry


I'm currently struggeling with my BibLaTeX file. I wanna turn these two infos into bold.

example of my bib

I'm using the template below and cannot find the right place to insert a textbf or a mkbibbold property and even don't know if this is the right property in this use case. Every attempt is failing and / or crashing my whole project.

Here is a mre (Thanks to @samcarter_is_at_topanswers.xyz) The %%%%% area is where the magic happens..

regards and stay healthy!

\documentclass[12pt,oneside,titlepage]{scrartcl}

\newif\ifde
\newif\ifen
\newcommand{\langde}[1]{%
   \ifde\selectlanguage{ngerman}#1\fi}
\newcommand{\langen}[1]{%
   \ifen\selectlanguage{english}#1\fi}
\usepackage[utf8]{luainputenc}
\langde{\usepackage[babel,german=quotes]{csquotes}}
\langen{\usepackage[babel,english=british]{csquotes}}
\usepackage{footnote}

\usepackage{url}
\urlstyle{same}
\usepackage[
backend=biber,
style=ext-authoryear,
maxcitenames=3, % mindestens 3 Namen ausgeben bevor et. al. kommt
maxbibnames=999,
mergedate=false,
date=iso,
seconds=true, %werden nicht verwendet, so werden aber Warnungen unterdrückt.
urldate=iso,
innamebeforetitle,
dashed=false,
autocite=footnote,
doi=false,
useprefix=true, % 'von' im Namen beachten (beim Anzeigen)
mincrossrefs = 1
]{biblatex}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xpatch}

\setlength\bibhang{1cm}

\AtEveryBibitem{%
\ifentrytype{book}{
    \clearfield{issn}%
    \clearfield{doi}%
    \clearfield{isbn}%
    \clearfield{url}
    \clearfield{eprint}
}{}
\ifentrytype{collection}{
  \clearfield{issn}%
  \clearfield{doi}%
  \clearfield{isbn}%
  \clearfield{url}
  \clearfield{eprint}
}{}
\ifentrytype{incollection}{
  \clearfield{issn}%
  \clearfield{doi}%
  \clearfield{isbn}%
  \clearfield{url}
  \clearfield{eprint}
}{}
\ifentrytype{article}{
  \clearfield{issn}%
  \clearfield{doi}%
  \clearfield{isbn}%
  \clearfield{url}
  \clearfield{eprint}
}{}
\ifentrytype{inproceedings}{
  \clearfield{issn}%
  \clearfield{doi}%
  \clearfield{isbn}%
  \clearfield{url}
  \clearfield{eprint}
}{}
}

\renewcommand*{\finentrypunct}{}%Kein Punkt am ende des Literaturverzeichnisses

\renewcommand*{\newunitpunct}{\addcomma\space}
\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcolon\space}
\DeclareDelimFormat{titleyeardelim}{\newunitpunct}
%Namen kursiv schreiben
\renewcommand*{\mkbibnamefamily}{\mkbibemph}
\renewcommand*{\mkbibnamegiven}{\mkbibemph}
\renewcommand*{\mkbibnamesuffix}{\mkbibemph}
\renewcommand*{\mkbibnameprefix}{\mkbibemph}


\DeclareDelimAlias{finalnamedelim}{multinamedelim}

\DeclareNameAlias{default}{family-given}
\DeclareNameAlias{sortname}{default}  %Nach Namen sortieren


\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{editortypedelim}{\addspace}
\DeclareFieldFormat{translatortype}{\mkbibparens{#1}}
\DeclareDelimFormat{translatortypedelim}{\addspace}
\DeclareDelimFormat[bib,biblist]{innametitledelim}{\addcomma\space}

\DeclareFieldFormat*{citetitle}{#1}
\DeclareFieldFormat*{title}{#1}
\DeclareFieldFormat*{booktitle}{#1}
\DeclareFieldFormat*{journaltitle}{#1}

\xpatchbibdriver{online}
  {\usebibmacro{organization+location+date}\newunit\newblock}
  {}
  {}{}

\DeclareFieldFormat[online]{date}{\mkbibparens{#1}}
\DeclareFieldFormat{urltime}{\addspace #1\addspace \langde{Uhr}\langen{MEZ}}
\DeclareFieldFormat{urldate}{%urltime zu urldate hinzufügen
  [\langde{Zugriff}\langen{Access}\addcolon\addspace
  #1\printfield{urltime}]
}
\DeclareFieldFormat[online]{url}{<\url{#1}>}
\renewbibmacro*{url+urldate}{%
  \usebibmacro{url}%
  \ifentrytype{online}
    {\setunit*{\addspace}%
     \iffieldundef{year}
       {\printtext[date]{\langde{keine Datumsangabe}\langen{no Date} }}
       {\usebibmacro{date}}}%
    {}%
  \setunit*{\addspace}%
  \usebibmacro{urldate}
  }
\DeclareExtradate{
  \scope{
    \field{labelyear}
    \field{year}
    }
    \scope{
      \field{usera}
     }
}
\renewbibmacro*{date+extradate}{%
  \printtext[parens]{%
    \printfield{usera}%
    \setunit{\printdelim{titleyeardelim}}%
    \ifentrytype{online}
       {\setunit*{\addspace\addcomma\addspace}%
         \iffieldundef{year}
           {\bibstring{nodate}}
       {\printlabeldateextra}}%
       {\printlabeldateextra}}}

\renewbibmacro*{cite:labeldate+extradate}{%
    \ifentrytype{online}
       {\setunit*{\addspace\addcomma\addspace}%
         \iffieldundef{year}
           {\bibstring{nodate}}
       {\printlabeldateextra}}%
       {\printlabeldateextra}}


\DefineBibliographyStrings{german}{
  nodate    = {{}o.\adddot\addspace J\adddot},
  andothers = {et\addabbrvspace al\adddot}
}
\DefineBibliographyStrings{english}{
  nodate    = {{}n.\adddot\addspace d\adddot},
  andothers = {et\addabbrvspace al\adddot}
}
\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[notfield=translator, final]
      \step[notfield=editor, final]
      \step[fieldset=author, fieldvalue={{{\langde{o\noexpand\adddot\addspace V\noexpand\adddot}\langen{Anon}}}}]
    }
    \map{
      \pernottype{online}
      \step[fieldset=location, fieldvalue={\langde{o\noexpand\adddot\addspace O\noexpand\adddot}\langen{s\noexpand\adddot I\noexpand\adddot}}]
    }
  }
}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\printdelim{nonametitledelim}}}
       {\printnames{labelname}%
        \setunit{\printdelim{nametitledelim}}}%
     \printfield{usera}%
     \setunit{\printdelim{titleyeardelim}}%
     \usebibmacro{cite:labeldate+extradate}}
    {\usebibmacro{cite:shorthand}}}

    \renewcommand*{\jourvoldelim}{\addcomma\addspace}

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\jourvoldelim}%
  \iffieldundef{series}
    {}
    {\setunit*{\jourserdelim}%
     \printfield{series}%
     \setunit{\servoldelim}}%
  \iffieldundef{volume}
    {}
    {\printfield{volume}}
  \iffieldundef{labelyear}
  {}
  {
  (\thefield{year}) %Ansonsten wird wenn kein Volume angegeben ist ein Komma vorangestellt
  }
  \setunit*{\addcomma\addspace Nr\adddot\addspace}
  \printfield{number}
  \iffieldundef{eid}
  {}
  {\printfield{eid}}
}


\renewbibmacro*{postnote}{%
  \setunit{\postnotedelim}%
  \iffieldundef{postnote}
    {} %{\printtext{\langde{o.S\adddot}\langen{no page number}}}
    {\printfield{postnote}}}

\setlength{\bibinitsep}{0.75cm}

\DeclareDelimFormat{nonameyeardelim}{\addcomma\space}
\DeclareDelimFormat{nameyeardelim}{\addcomma\space}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\printdelim{nonameyeardelim}}}
      {\toggletrue{abx@bool@giveninits}
        \printnames[family-given]{labelname}%
        \setunit{\printdelim{nameyeardelim}}}%
      \printfield{usera}%
      \setunit{\printdelim{titleyeardelim}}%
     \usebibmacro{cite:labeldate+extradate}}
   {\usebibmacro{cite:shorthand}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\addbibresource{jobname.bib}



\begin{filecontents}{jobname.bib}
@book{ludi17,
  author = {Ludwig, Matthias and Oldenburg, Reinhard},
  year   = {2017},
  month  = {10},
  pages  = {149-160},
  title  = {Fußballergebnisse vorhersagen – mit Mathematik prognostizieren},
  isbn   = {978-3-658-11901-0},
  doi    = {10.1007/978-3-658-11902-7_12}
}
\end{filecontents}

\begin{document}
Lorem ipsum dolor sit amet\footcite{ludi17}, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

\printbibliography{}

\end{document}

Solution

  • As a quick hack, you could redefine:

      \renewbibmacro*{date+extradate}{%
        \mkbibbold{%
        \iffieldundef{labelyear}
          {}
          {\printtext[parens]{\printlabeldateextra}}}}%
    \DeclareNameAlias{sortname}{family-given/given-family-bold}
    \DeclareNameFormat{family-given/given-family-bold}{%
      \mkbibbold{%
      \ifnumequal{\value{listcount}}{1}
        {\ifgiveninits
           {\usebibmacro{name:family-given}
             {\namepartfamily}
             {\namepartgiveni}
             {\namepartprefix}
             {\namepartsuffix}}
           {\usebibmacro{name:family-given}
             {\namepartfamily}
             {\namepartgiven}
             {\namepartprefix}
             {\namepartsuffix}}%
         \ifboolexpe{%
           test {\ifdefvoid\namepartgiven}
           and
           test {\ifdefvoid\namepartprefix}}
           {}
           {\usebibmacro{name:revsdelim}}}
        {\ifgiveninits
           {\usebibmacro{name:given-family}
             {\namepartfamily}
             {\namepartgiveni}
             {\namepartprefix}
             {\namepartsuffix}}
           {\usebibmacro{name:given-family}
             {\namepartfamily}
             {\namepartgiven}
             {\namepartprefix}
             {\namepartsuffix}}}%
      \usebibmacro{name:andothers}}}
    

    Full MWE;

    \documentclass[12pt,oneside,titlepage]{scrartcl}
    
    \newif\ifde
    \newif\ifen
    \newcommand{\langde}[1]{%
       \ifde\selectlanguage{ngerman}#1\fi}
    \newcommand{\langen}[1]{%
       \ifen\selectlanguage{english}#1\fi}
    \usepackage[utf8]{luainputenc}
    \langde{\usepackage[babel,german=quotes]{csquotes}}
    \langen{\usepackage[babel,english=british]{csquotes}}
    \usepackage{footnote}
    
    \usepackage{url}
    \urlstyle{same}
    \usepackage[
    backend=biber,
    style=ext-authoryear,
    maxcitenames=3, % mindestens 3 Namen ausgeben bevor et. al. kommt
    maxbibnames=999,
    mergedate=false,
    date=iso,
    seconds=true, %werden nicht verwendet, so werden aber Warnungen unterdrückt.
    urldate=iso,
    innamebeforetitle,
    dashed=false,
    autocite=footnote,
    doi=false,
    useprefix=true, % 'von' im Namen beachten (beim Anzeigen)
    mincrossrefs = 1
    ]{biblatex}
    
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \usepackage{xpatch}
    
    \setlength\bibhang{1cm}
    
    \AtEveryBibitem{%
    \ifentrytype{book}{
        \clearfield{issn}%
        \clearfield{doi}%
        \clearfield{isbn}%
        \clearfield{url}
        \clearfield{eprint}
    }{}
    \ifentrytype{collection}{
      \clearfield{issn}%
      \clearfield{doi}%
      \clearfield{isbn}%
      \clearfield{url}
      \clearfield{eprint}
    }{}
    \ifentrytype{incollection}{
      \clearfield{issn}%
      \clearfield{doi}%
      \clearfield{isbn}%
      \clearfield{url}
      \clearfield{eprint}
    }{}
    \ifentrytype{article}{
      \clearfield{issn}%
      \clearfield{doi}%
      \clearfield{isbn}%
      \clearfield{url}
      \clearfield{eprint}
    }{}
    \ifentrytype{inproceedings}{
      \clearfield{issn}%
      \clearfield{doi}%
      \clearfield{isbn}%
      \clearfield{url}
      \clearfield{eprint}
    }{}
    }
    
    \renewcommand*{\finentrypunct}{}%Kein Punkt am ende des Literaturverzeichnisses
    
    \renewcommand*{\newunitpunct}{\addcomma\space}
    \DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcolon\space}
    \DeclareDelimFormat{titleyeardelim}{\newunitpunct}
    %Namen kursiv schreiben
    %\renewcommand*{\mkbibnamefamily}{\mkbibbold}
    %\renewcommand*{\mkbibnamegiven}{\mkbibbold}
    %\renewcommand*{\mkbibnamesuffix}{\mkbibbold}
    %\renewcommand*{\mkbibnameprefix}{\mkbibbold}
    
    \DeclareFieldFormat*{extradate}{\mkbibbold{#1}}
    
    \DeclareDelimAlias{finalnamedelim}{multinamedelim}
    
    \DeclareNameAlias{default}{family-given}
    \DeclareNameAlias{sortname}{default}  %Nach Namen sortieren
    
    
    \DeclareFieldFormat{editortype}{\mkbibparens{#1}}
    \DeclareDelimFormat{editortypedelim}{\addspace}
    \DeclareFieldFormat{translatortype}{\mkbibparens{#1}}
    \DeclareDelimFormat{translatortypedelim}{\addspace}
    \DeclareDelimFormat[bib,biblist]{innametitledelim}{\addcomma\space}
    
    \DeclareFieldFormat*{citetitle}{#1}
    \DeclareFieldFormat*{title}{#1}
    \DeclareFieldFormat*{booktitle}{#1}
    \DeclareFieldFormat*{journaltitle}{#1}
    
    \xpatchbibdriver{online}
      {\usebibmacro{organization+location+date}\newunit\newblock}
      {}
      {}{}
    
    \DeclareFieldFormat[online]{date}{\mkbibparens{#1}}
    \DeclareFieldFormat{urltime}{\addspace #1\addspace \langde{Uhr}\langen{MEZ}}
    \DeclareFieldFormat{urldate}{%urltime zu urldate hinzufügen
      [\langde{Zugriff}\langen{Access}\addcolon\addspace
      #1\printfield{urltime}]
    }
    \DeclareFieldFormat[online]{url}{<\url{#1}>}
    \renewbibmacro*{url+urldate}{%
      \usebibmacro{url}%
      \ifentrytype{online}
        {\setunit*{\addspace}%
         \iffieldundef{year}
           {\printtext[date]{\langde{keine Datumsangabe}\langen{no Date} }}
           {\usebibmacro{date}}}%
        {}%
      \setunit*{\addspace}%
      \usebibmacro{urldate}
      }
    \DeclareExtradate{
      \scope{
        \field{labelyear}
        \field{year}
        }
        \scope{
          \field{usera}
         }
    }
    \renewbibmacro*{date+extradate}{%
      \printtext[parens]{%
        \printfield{usera}%
        \setunit{\printdelim{titleyeardelim}}%
        \ifentrytype{online}
           {\setunit*{\addspace\addcomma\addspace}%
             \iffieldundef{year}
               {\bibstring{nodate}}
           {\printlabeldateextra}}%
           {\printlabeldateextra}}}
    
    \renewbibmacro*{cite:labeldate+extradate}{%
        \ifentrytype{online}
           {\setunit*{\addspace\addcomma\addspace}%
             \iffieldundef{year}
               {\bibstring{nodate}}
           {\printlabeldateextra}}%
           {\printlabeldateextra}}
    
    
    \DefineBibliographyStrings{german}{
      nodate    = {{}o.\adddot\addspace J\adddot},
      andothers = {et\addabbrvspace al\adddot}
    }
    \DefineBibliographyStrings{english}{
      nodate    = {{}n.\adddot\addspace d\adddot},
      andothers = {et\addabbrvspace al\adddot}
    }
    \DeclareSourcemap{
      \maps[datatype=bibtex]{
        \map{
          \step[notfield=translator, final]
          \step[notfield=editor, final]
          \step[fieldset=author, fieldvalue={{{\langde{o\noexpand\adddot\addspace V\noexpand\adddot}\langen{Anon}}}}]
        }
        \map{
          \pernottype{online}
          \step[fieldset=location, fieldvalue={\langde{o\noexpand\adddot\addspace O\noexpand\adddot}\langen{s\noexpand\adddot I\noexpand\adddot}}]
        }
      }
    }
    
    \renewbibmacro*{cite}{%
      \iffieldundef{shorthand}
        {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
           {\usebibmacro{cite:label}%
            \setunit{\printdelim{nonametitledelim}}}
           {\printnames{labelname}%
            \setunit{\printdelim{nametitledelim}}}%
         \printfield{usera}%
         \setunit{\printdelim{titleyeardelim}}%
         \usebibmacro{cite:labeldate+extradate}}
        {\usebibmacro{cite:shorthand}}}
    
        \renewcommand*{\jourvoldelim}{\addcomma\addspace}
    
    \renewbibmacro*{journal+issuetitle}{%
      \usebibmacro{journal}%
      \setunit*{\jourvoldelim}%
      \iffieldundef{series}
        {}
        {\setunit*{\jourserdelim}%
         \printfield{series}%
         \setunit{\servoldelim}}%
      \iffieldundef{volume}
        {}
        {\printfield{volume}}
      \iffieldundef{labelyear}
      {}
      {
      (\thefield{year}) %Ansonsten wird wenn kein Volume angegeben ist ein Komma vorangestellt
      }
      \setunit*{\addcomma\addspace Nr\adddot\addspace}
      \printfield{number}
      \iffieldundef{eid}
      {}
      {\printfield{eid}}
    }
    
    
    \renewbibmacro*{postnote}{%
      \setunit{\postnotedelim}%
      \iffieldundef{postnote}
        {} %{\printtext{\langde{o.S\adddot}\langen{no page number}}}
        {\printfield{postnote}}}
    
    \setlength{\bibinitsep}{0.75cm}
    
    \DeclareDelimFormat{nonameyeardelim}{\addcomma\space}
    \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
    
    \renewbibmacro*{cite}{%
      \iffieldundef{shorthand}
        {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
           {\usebibmacro{cite:label}%
            \setunit{\printdelim{nonameyeardelim}}}
          {\toggletrue{abx@bool@giveninits}
            \printnames[family-given]{labelname}%
            \setunit{\printdelim{nameyeardelim}}}%
          \printfield{usera}%
          \setunit{\printdelim{titleyeardelim}}%
         \usebibmacro{cite:labeldate+extradate}}
       {\usebibmacro{cite:shorthand}}}
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
    
    \begin{filecontents}{\jobname.bib}
    @book{ludi17,
      author = {Ludwig, Matthias and Oldenburg, Reinhard},
      year   = {2017},
      month  = {10},
      pages  = {149-160},
      title  = {Fußballergebnisse vorhersagen – mit Mathematik prognostizieren},
      isbn   = {978-3-658-11901-0},
      doi    = {10.1007/978-3-658-11902-7_12}
    }
    \end{filecontents}
    
    \addbibresource{\jobname.bib}
    
      \renewbibmacro*{date+extradate}{%
        \mkbibbold{%
        \iffieldundef{labelyear}
          {}
          {\printtext[parens]{\printlabeldateextra}}}}%
    \DeclareNameAlias{sortname}{family-given/given-family-bold}
    \DeclareNameFormat{family-given/given-family-bold}{%
      \mkbibbold{%
      \ifnumequal{\value{listcount}}{1}
        {\ifgiveninits
           {\usebibmacro{name:family-given}
             {\namepartfamily}
             {\namepartgiveni}
             {\namepartprefix}
             {\namepartsuffix}}
           {\usebibmacro{name:family-given}
             {\namepartfamily}
             {\namepartgiven}
             {\namepartprefix}
             {\namepartsuffix}}%
         \ifboolexpe{%
           test {\ifdefvoid\namepartgiven}
           and
           test {\ifdefvoid\namepartprefix}}
           {}
           {\usebibmacro{name:revsdelim}}}
        {\ifgiveninits
           {\usebibmacro{name:given-family}
             {\namepartfamily}
             {\namepartgiveni}
             {\namepartprefix}
             {\namepartsuffix}}
           {\usebibmacro{name:given-family}
             {\namepartfamily}
             {\namepartgiven}
             {\namepartprefix}
             {\namepartsuffix}}}%
      \usebibmacro{name:andothers}}}
    
    \begin{document}
    Lorem ipsum dolor sit amet\footcite{ludi17}, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
    invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
    
    \printbibliography{}
    
    \end{document}
    

    enter image description here