1

How can I customize BibLaTeXso that I get the following?:

  • N.N. (or O.V.) when no author is given in my .bib-file
  • n.d. (or o.J.) when no year is given in my .bib-file
  • authors in small caps in citations

So the result should be:

[NNnd] or [OVOJ]

as well as:

[REG17]


\documentclass[12pt,a4paper,twoside,openright]{report}

%Schriftart Arial - ACHTUNG: Compile with XeLaTeX (not PDFLaTeX)!
\usepackage{fontspec}
\defaultfontfeatures{Scale = MatchLowercase}
\setmainfont{Arial}[Scale = 1.0]

%Seitenlayout
\usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry} %showframe

%Deutsche Umlaute, Englisch
\usepackage[main=ngerman, english]{babel}

%Anführungszeichen
\usepackage[german=quotes]{csquotes}

%Literaturverzeichnis
\usepackage[style       = alphabetic-verb,
            backend     = biber,
            maxbibnames     = 2,
            minbibnames     = 2,
            maxalphanames   = 1,
            minalphanames   = 1,
            useeditor       = false,
            giveninits      = true
            ]{biblatex}

%Name, V.
\DeclareNameAlias{default}{family-given} 

%Doppelpunkt nach letztem Verfasser
\renewcommand*{\labelnamepunct}{\addcolon\addspace} 

%Änderungen von Strings
\DefineBibliographyStrings{ngerman}{
                andothers={et\addabbrvspace al\adddot}, %et al.
                urlseen = {Abruf\addcolon} %Anpassung in "Abruf:" bei URLs
                }

%Kapitälchen Nachame und Vorname von Autoren in Bibliography
\renewcommand*{\mkbibnamefamily}[1]{\ifmknamesc{\textsc{#1}}{#1}}
\renewcommand*{\mkbibnamegiven}[1]{\ifmknamesc{\textsc{#1}}{#1}}
\def\ifmknamesc{%
  \ifboolexpr{ test {\ifcurrentname{author}}
               or ( test {\ifnameundef{author}} and test {\ifcurrentname{editor}} )                    }}

%Komma bei mehreren Quellen
\renewcommand*{\multicitedelim}{\addcomma\space}

%Semikolon bei mehreren Autoren
\renewcommand*{\multinamedelim}{\addsemicolon\space}
\renewcommand*{\finalnamedelim}{\addsemicolon\space}

%Formatierung von Regular Types
\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished,suppbook,suppcollection,suppperiodical]
  {title}{\textit{#1\isdot}}

%Formatierung bei mehreren Autoren
\renewcommand*{\labelalphaothers}{}



\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@misc{ruhr,
  author = {{Regionalverband Ruhr}},
  title = {Marketingstrategie 2017-2022 der Ruhr Tourismus GmbH},
  year = {2017},
  keywords = {nosc}
}
@book{book05,
title = {Planen, Steuern, Entwickeln: über den Beitrag öffentlicher Akteure zur Entwicklung von Stadt und Land},
publisher = {Edition Stadt-Entwicklung},
location = {Dortmund}
}
\end{filecontents*}


\addbibresource{\jobname.bib}
\usepackage{citeall}

\begin{document}

\citeall
\printbibliography[heading=bibintoc, title={Literaturverzeichnis}] 

\end{document}

EDIT: I would like "N.N. (or O.V.)" and "n.d. (or o.J.)" to show up in my bibliography as well (not just in citations as OV/ -OJ).


EDIT 2: I decided to close this question and to open a new one for the last missing piece: Customize BibLaTeX: Automatically generate N.N./ O.V. (no author) and n.d./ o.J. (no date) in bibliography (style alphabetic-verb)

1 Answer 1

2

You can add 'fallback' label values with \literal in \DeclareLabelalphaTemplate.

\DeclareLabelalphaTemplate{
  \labelelement{
    \field[final]{shorthand}
    \field{label}
    \field[strwidth=3,strside=left,ifnames=1]{labelname}
    \field[strwidth=1,strside=left]{labelname}
    \literal{NN}
  }
  \labelelement{
    \field[strwidth=2,strside=right]{year}
    \literal{-OJ}
  }
}

will print NN for missing author names and -OJ for a missing year.

I'm not quite sure what you are after w.r.t. the small caps for author names. Do you mean something like

\DeclareFieldFormat{labelalpha}{\textsc{#1}}

Maybe you can ask a new question about that.

\documentclass{article}
\usepackage[main=ngerman, english]{babel}
\usepackage[german=quotes]{csquotes}
\usepackage[style       = alphabetic-verb,
            backend     = biber,
            maxbibnames     = 2,
            minbibnames     = 2,
            maxalphanames   = 1,
            minalphanames   = 1,
            useeditor       = false,
            giveninits      = true
            ]{biblatex}


\DeclareNameAlias{default}{family-given} 

\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\addspace} 

\DefineBibliographyStrings{ngerman}{
  andothers    = {et\addabbrvspace al\adddot},
  urlseen      = {Abruf\addcolon},
  references   = {Literaturverzeichnis},
  bibliography = {Literaturverzeichnis},
}

\renewcommand*{\mkbibnamefamily}[1]{\ifmknamesc{\textsc{#1}}{#1}}
\renewcommand*{\mkbibnamegiven}[1]{\ifmknamesc{\textsc{#1}}{#1}}
\def\ifmknamesc{%
  \ifboolexpr{test {\ifcurrentname{author}}
               or (test {\ifnameundef{author}}
                   and test {\ifcurrentname{editor}})}}


\renewcommand*{\multicitedelim}{\addcomma\space}

\DeclareDelimFormat{multinamedelim}{\addsemicolon\space}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}

\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished,suppbook,suppcollection,suppperiodical]
  {title}{\textit{#1\isdot}}

\renewcommand*{\labelalphaothers}{}

\DeclareLabelalphaTemplate{
  \labelelement{
    \field[final]{shorthand}
    \field{label}
    \field[strwidth=3,strside=left,ifnames=1]{labelname}
    \field[strwidth=1,strside=left]{labelname}
    \literal{NN}
  }
  \labelelement{
    \field[strwidth=2,strside=right]{year}
    \literal{-OJ}
  }
}

\DeclareFieldFormat{labelalpha}{\textsc{#1}}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@misc{ruhr,
  author   = {{Regionalverband Ruhr}},
  title    = {Marketingstrategie 2017-2022 der Ruhr Tourismus GmbH},
  year     = {2017},
  keywords = {nosc}
}
@book{book05,
  title     = {Planen, Steuern, Entwickeln:
               über den Beitrag öffentlicher Akteure zur Entwicklung
               von Stadt und Land},
  publisher = {Edition Stadt-Entwicklung},
  location  = {Dortmund}
}
\end{filecontents*}

\addbibresource{\jobname.bib}
\usepackage{citeall}

\begin{document}
\citeall
\printbibliography[heading=bibintoc] 
\end{document}

[NN-OJ]//[Reg17]

2
  • Thanks a lot! Small caps and OV/ -OJ are working in citations now, perfect! But I figured that I was unprecise in my question: Do you also know a way to show O.V./ -O.J. in the bibliography as well? I edited my original question for that. Thanks again!
    – TeXlearner
    Jun 20, 2019 at 13:39
  • I decided to edit my question again and to export my additional question to a new one. Thanks again for the help!
    – TeXlearner
    Jun 22, 2019 at 22:06

You must log in to answer this question.

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