Biblatex:更改“prenote”字段的顺序

Biblatex:更改“prenote”字段的顺序

我正在尝试更改仅针对特定 的\footcite使用顺序。例如,如果我尝试对 执行此操作,我该如何实现。我想要以下顺序:biblatexentrytype\ifentrytype{commentary}

shorthand,,prenotepostnote 在此处输入图片描述

\usebibmacro{prenote}我的想法是战争来改变\DeclareCiteCommand{\footcite}

参见附件示例:

\documentclass[12pt,ngerman]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%
\usepackage[%
citestyle=authoryear,%
bibstyle=authortitle,%
backend=biber%
]{biblatex}
%
\usepackage{lipsum}
\usepackage{fontspec}
\setmainfont{Times New Roman}
%
\usepackage{verbatim}
% =======================================================
% =======================================================
\DeclareBibliographyDriver{commentary}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{maintitle+title}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{edition}
  \newunit
  \usebibmacro{location+date}%
  \newunit\newblock
  \usebibmacro{finentry}}
% =======================================================
\AtEveryCite{
\ifentrytype{commentary}{%
\DeclareCiteCommand{\footcite}%
  %{\usebibmacro{prenote}}% OLD
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
   {\usebibmacro{prenote}}% NEW moved the prenote
  {\multicitedelim}
  {\usebibmacro{postnote}}
}{}%
}
% =======================================================
% =======================================================
% =======================================================

\addbibresource{\jobname.bib}
%
\begin{filecontents}{\jobname.bib}
    @commentary{citekey,
    maintitle={M{\"u}nchener Kommentar zum B{\"u}rgerlichen Gesetzbuch},
    editor={S{\"a}cker, Franz},
    volume={1},
    title={Allgemeiner Teil},
    edition={7},
    address={M{\"u}nchen},
    year={2015},
    shorthand={M{\"u}nchKomm},
}
\end{filecontents}

\begin{document}
% =======================================================

% =======================================================
The idea was to just change the position of \verb|\usebibmacro{prenote}|
\footcite[Armbrüster][§ 138 Rn. 11]{citekey}\\
But sadly it doesn't change anything.


\printbibliography[title=Bibliography]
\end{document}

知道如何实现如图所示的顺序吗?

答案1

实际上不起作用\AtEveryCite,因为您无法在已经执行引用命令的位置重新定义它。因此重新定义必须在 之外进行\AtEveryCite

另一方面,\ifentrytype必须在知道所处理条目的条目类型时执行。如果我们只是执行,情况就不是这样了\ifentrytype{commentary}{...redefine \footcite here...}{...keep the original definition...},所以这也行不通。一个可能的解决方案是

\DeclareCiteCommand{\footcite}%
  {\ifentrytype{commentary}{}{\usebibmacro{prenote}}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}%
   \ifentrytype{commentary}{\usebibmacro{prenote}}{}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

但这样你就无法为类型添加真正的预注。所以我认为以这种方式@commentary滥用论点的想法在概念上是有缺陷的。prenote

相反,你可以考虑类似的解决方案biblatex \cite 中另一个可选参数内的可选参数。这个想法不是滥用参数,而是可以通过圆括号prenote将另一个可选值传递给命令: 。postnote\autocite[(Armbrüster)§ 138 Rn. 11]{citekey}

\documentclass[12pt,ngerman]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[
  citestyle=authoryear,
  bibstyle=authortitle,
  backend=biber,
  autocite=footnote,
]{biblatex}

\DeclareBibliographyDriver{commentary}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{maintitle+title}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{edition}
  \newunit
  \usebibmacro{location+date}%
  \newunit\newblock
  \usebibmacro{finentry}}

\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

%\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@commentary{citekey,
  maintitle  = {Münchener Kommentar zum Bürgerlichen Gesetzbuch},
  editor     = {Säcker, Franz},
  volume     = {1},
  title      = {Allgemeiner Teil},
  edition    = {7},
  address    = {München},
  year       = {2015},
  shorthand  = {MünchKomm},
}
\end{filecontents}

\let\oldpostnotedelim\postnotedelim
\renewcommand*{\postnotedelim}{\ifentrytype{commentary}{}{\oldpostnotedelim}}
\DeclareFieldFormat{postnote:stem}{\oldpostnotedelim\mkpageprefix[pagination][\mknormrange]{#1}}
\DeclareFieldFormat{postnote:prefix}{\addslash\mkbibemph{#1}}
\DeclareFieldFormat{postnote}{\mkpostnote{#1}}

\makeatletter
\newrobustcmd*{\mkpostnote}[1]{\mkpostnote@i#1&}

\def\mkpostnote@i{%
  \@ifnextchar(%)
    {\mkpostnote@ii}
    {\mkpostnote@ii()}}

\def\mkpostnote@ii(#1)#2&{%
  \ifblank{#1}{}{%
    \blx@getformat\cbx@postnote@prefix@fmt{ffd}{}{postnote:prefix}%
    \cbx@postnote@prefix@fmt{#1}}%
  \ifblank{#2}{}{%
    \blx@getformat\cbx@postnote@stem@fmt{ffd}{}{postnote:stem}%
    \cbx@postnote@stem@fmt{#2}}%
  }
\def\cbx@postnote@stem@fmt{}
\def\cbx@postnote@prefix@fmt{}
\makeatother

\begin{document}
Lorem\autocite[(Armbrüster)§ 138 Rn. 11]{citekey}
ipsum\autocite[cf.][380]{sigfridsson}
dolor\autocite[cf.][(Armbrüster)§ 138 Rn. 11]{citekey}
sit\autocite[cf.][§ 138 Rn. 11]{citekey}
sit\autocite[(Armbrüster)]{citekey}
\printbibliography[title=Bibliography]
\end{document}

在此处输入图片描述

相关内容