如果有预注,Biblatex 同上,小写

如果有预注,Biblatex 同上,小写

我已经定义了自己的 biblatex 样式(参见 MWE),它使用脚注中的引文。我已经修补了命令prenote,因为否则 biblatex 会以小写形式写入预注文本(注意:我不想在 autocite 命令中以大写形式写入预注,因为我希望能够切换回文本引文)。

但现在我对使用缩写的第三条引文有疑问cf.。下面的 ibid 应该像第二条引文一样以小写字母打印(修补之前,ibid 是用小写字母书写的,cf. 也是如此)。如果没有预注,则 ibid 应该像第四条引文一样打印。

我怎样才能实现所需的行为并摆脱修补,因为它有点慢。

梅威瑟:

\documentclass{article}
\usepackage[style=alphabetic, autocite=footnote,backend=biber,ibidtracker=constrict]{biblatex}
\usepackage{xpatch}
\usepackage{xstring}

\begin{filecontents*}{bibliography.bib}
@BOOK{ABC,
    author = {Cornelisse, J. W. and Schöyer, H. Ferry R. and Wakker, Karel F.},
    title = {Rocket Propulsion and Spaceflight Dynamics},
    year = {1979},
    publisher = {Pitman},
}
\end{filecontents*}

 \providecommand*{\mkibid}[1]{#1}
 \newbool{cbx:loccit}

 \DeclareBibliographyOption{ibidpage}[true]{%
    \ifstrequal{#1}{true}
     {\ExecuteBibliographyOptions{loccittracker=constrict}}
     {\ExecuteBibliographyOptions{loccittracker=false}}}

 \ExecuteBibliographyOptions{ibidpage = true}

 \newbibmacro*{cite:ibid}{%
    \global\boolfalse{cbx:loccit}%
    \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}%
    \ifloccit
     {\global\booltrue{cbx:loccit}}
     {}}

     \newbibmacro*{cite:postnote}{%
     \ifbool{cbx:loccit}
        {}
        {\usebibmacro{postnote}}}

    \newbibmacro*{cite:prenote}{%
     \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
        {\usebibmacro{prenote}}
        {\usebibmacro{prenote}}}

 \DeclareCiteCommand{\smartcite}[\iffootnote\mkbibparens\mkbibfootnote]
    {\usebibmacro{cite:prenote}}
    {\usebibmacro{citeindex}%
     \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
     {\usebibmacro{cite:ibid}\usebibmacro{cite:postnote}}
     {\printtext[brackets]{\usebibmacro{cite}\usebibmacro{postnote}}}}
    {\multicitedelim}
    {}

     \DeclareAutoCiteCommand{footnote}[f]{\smartcite}{\smartcites}

     \DeclareFieldFormat{sentencecase}{\StrLeft{#1}{1}[\firstchar]\StrLen{#1}[\textlaenge]\StrMid{#1}{2}{\textlaenge}[\restchars]\autocap{\firstchar}\restchars}
     \xpatchbibmacro{prenote}{\printfield{prenote}}{\printfield[sentencecase]{prenote}}{}{}
     \xpatchbibmacro{multiprenote}{\printfield{multiprenote}}{\printfield[sentencecase]{multiprenote}}{}{}

\bibliography{bibliography.bib}

\begin{document}
     Work\autocite[see][20]{ABC}.\\
     Same work with a prenote without a punctation\autocite[see][20]{ABC}.\\
     Same work with a prenote with punctation\autocite[cf.][20]{ABC}.\\
     Same work and no prenote\autocite[][20]{ABC}.
\end{document}

答案1

prenote字段格式的标准定义是\DeclareFieldFormat{prenote}{#1\isdot},预注中的 any.被视为缩写点(之后我们不开始新的句子,因此不大写)。但是当您定义时sentencecase没有\isdot,因此 every.被视为句号,之后我们会将其大写。

我们可以使用以下定义

\DeclareFieldFormat{prenote}{%
  \StrLeft{#1}{1}[\firstchar]%
  \StrLen{#1}[\textlaenge]%
  \StrMid{#1}{2}{\textlaenge}[\restchars]%
  \autocap{\firstchar}\restchars\isdot}
\DeclareFieldAlias{multiprenote}{prenote}

那么就不需要使用xpatch修补prenote宏了,因为我们直接更改字段格式。

平均能量损失

\documentclass{article}
\usepackage[style=alphabetic, autocite=footnote,backend=biber,ibidtracker=constrict]{biblatex}
\usepackage{xstring}


 \providecommand*{\mkibid}[1]{#1}
 \newbool{cbx:loccit}

 \DeclareBibliographyOption{ibidpage}[true]{%
    \ifstrequal{#1}{true}
     {\ExecuteBibliographyOptions{loccittracker=constrict}}
     {\ExecuteBibliographyOptions{loccittracker=false}}}

 \ExecuteBibliographyOptions{ibidpage = true}

 \newbibmacro*{cite:ibid}{%
    \global\boolfalse{cbx:loccit}%
    \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}%
    \ifloccit
     {\global\booltrue{cbx:loccit}}
     {}}

     \newbibmacro*{cite:postnote}{%
     \ifbool{cbx:loccit}
        {}
        {\usebibmacro{postnote}}}

    \newbibmacro*{cite:prenote}{%
     \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
        {\usebibmacro{prenote}}
        {\usebibmacro{prenote}}}

 \DeclareCiteCommand{\smartcite}[\iffootnote\mkbibparens\mkbibfootnote]
    {\usebibmacro{cite:prenote}}
    {\usebibmacro{citeindex}%
     \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
     {\usebibmacro{cite:ibid}\usebibmacro{cite:postnote}}
     {\printtext[brackets]{\usebibmacro{cite}\usebibmacro{postnote}}}}
    {\multicitedelim}
    {}

\DeclareAutoCiteCommand{footnote}[f]{\smartcite}{\smartcites}

\DeclareFieldFormat{prenote}{%
  \StrLeft{#1}{1}[\firstchar]%
  \StrLen{#1}[\textlaenge]%
  \StrMid{#1}{2}{\textlaenge}[\restchars]%
  \autocap{\firstchar}\restchars\isdot}
\DeclareFieldAlias{multiprenote}{prenote}


\bibliography{biblatex-examples.bib}

\begin{document}
     Work\autocite[see][20]{sigfridsson}.\\
     Same work with a prenote without a punctation\autocite[see][20]{sigfridsson}.\\
     Same work with a prenote with punctation\autocite[cf.][20]{sigfridsson}.\\
     Same work and no prenote\autocite[][20]{sigfridsson}.
\end{document}

在此处输入图片描述

相关内容