自定义 BibLaTeX:无作者、无日期、引用中的小写字母(样式字母动词)

自定义 BibLaTeX:无作者、无日期、引用中的小写字母(样式字母动词)

我如何定制BibLaTeX才能获得以下内容?:

  • 当我的 .bib 文件中没有给出作者时,则为 NN(或 OV)
  • 当我的 .bib 文件中没有给出年份时,则为 nd (或 oJ)
  • 引文中作者采用小写字母

所以结果应该是:

[NNnd] 或 [OVOJ]

也:

[规则 17]


\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}

编辑: 我希望“NN(或 OV)”和“nd(或 oJ)”也出现在我的参考书目中(而不仅仅是以 OV/-OJ 的形式出现在引用中)。


编辑2: 我决定关闭这个问题,并针对最后一个缺失的部分提出一个新问题:自定义 BibLaTeX:在参考书目中自动生成 NN/OV(无作者)和 nd/oJ(无日期)(字母动词样式)

答案1

您可以在\literal中添加“后备”标签值\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}
  }
}

将打印NN缺失的作者姓名和-OJ缺失的年份。

我不太清楚你为什么想要用小写字母来表示作者姓名。你是指

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

也许您可以就此提出一个新问题。

\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]

相关内容