Biblatex:将动态比较命令与 '\citetitle' 命令相结合

Biblatex:将动态比较命令与 '\citetitle' 命令相结合

如何在 biblatex 中创建 \citejournal、\citebooktitle、\cite… 命令?Gonzalo Medina 和 Audrey 提供的代码的工作原理例如\citeauthor{}当您输入文档时它只会创建一本书或一个期刊的标题...该\citeauthor命令也会发生这个问题。

自动的是。& 自动引文缩进(取决于引文长度)lockstep 根据 lockstep 和 Martin Scharrer 之前的贡献创建了一个引用命令,

  1. 当输出超过一定行数(最好是 3 行)时,将会进行排版缩进。

  2. 引用将自动排版,不带“Vgl.”——无论是短格式还是长格式。

  3. 当输出是释义或摘要时(换句话说:当输出没有引用时),它会使用预注“Vgl”排版。

  4. 它在 biblatex 中起作用。

主要目的是实现藝術。(英语比较)和行缩进。

问题:不幸的是,当你把这两个代码结合起来时,预注藝術。将在输出中位于每个 等命令之前。您将\citeauthor获得\citetitle藝術。作者代替作者。有谁能从全球范围解决这个问题吗?

\documentclass{article}

\usepackage[ngerman]{babel}

\usepackage[style=authoryear,autocite=footnote,backend=bibtex]{biblatex} % Here, Philip added "autocite=footnote,backend=bibtex"

%-------------------
\NewBibliographyString{compare}
\DefineBibliographyStrings{ngerman}{%
  compare = {vgl\adddot},
}

\newbool{withintextquote}

\renewbibmacro*{multiprenote}{%
  \renewbibmacro*{prenote}{%
    \iffieldundef{prenote}
      {}
      {\printfield{prenote}%
       \setunit{\prenotedelim}}}%
  \iffieldundef{multiprenote}{%
    \ifbool{withintextquote}{%
    }{%
      \bibstring{compare}\addspace
    }%
    }
    {\printfield{multiprenote}%
     \setunit{\prenotedelim}}}

\renewbibmacro*{prenote}{%
  \iffieldundef{prenote}{%
    \ifbool{withintextquote}{%
    }{%
      \bibstring{compare}\addspace
    }%
    }
    {\printfield{prenote}%
     \setunit{\prenotedelim}}}

\makeatletter
\newcommand{\cquotation}[1]{%
    \begingroup
    \booltrue{withintextquote}%
    % \settowidth doesn't like paragraphs
    \setbox\@tempboxa\hbox{%
        \def\par{\hspace{3\linewidth}}% If a paragraph is included force long form
        %\let\par\space  % Ignore paragraphs
        \let\footnote\@empty% make sure autocite does not do anything here; this is new
        \let\autocite\@empty
        #1}%
    \ifdim\wd\@tempboxa>3\linewidth
        \begin{quote}
            \itshape
            #1
        \end{quote}
    \else
        {\itshape #1}%
    \fi
    \endgroup}
\makeatother

%-------------------

\DeclareCiteCommand{\citejournal}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
    \usebibmacro{journal}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citebooktitle}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
    \usebibmacro{booktitle}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeintitle}% Based on \citetitle from biblatex.def
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexfield{indextitle}}
     {}%
   \iffieldundef{journaltitle}
     {\iffieldundef{booktitle}
        {\iffieldundef{maintitle}
          {\printfield[citetitle]{labeltitle}}% Behave like \citetitle if no "main" title
          {\printtext[maintitle]{\printfield[titlecase]{maintitle}}}}
        {\printtext[booktitle]{\printfield[titlecase]{booktitle}}}}
     {\printtext[journaltitle]{\printfield[titlecase]{journaltitle}}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

  \usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@Article{yoon,
  author = {Yoon, Myeong S. and Ryu, Dowook and Kim, Jeongryul and Ahn, Kyo Han},
  title = {Palladium pincer complexes with reduced bond angle strain: efficient catalysts
    for the Heck reaction},
  journaltitle = {Organometallics},
  volume = {25},
  number = {10},
  date = {2006},
  pages = {2409--2411}}
@InProceedings{salam,
  author = {Salam, Abdus},
  editor = {Svartholm, Nils},
  title = {Weak and Electromagnetic Interactions},
  booktitle = {Elementary Particle Theory},
  booksubtitle = {Relativistic Groups and Analyticity},
  booktitleaddon = {Proceedings of the Eighth Nobel Symposium},
  eventdate = {1968-05-19/1968-05-25},
  venue = {Aspen{\"a}sgarden, Lerum},
  publisher = {Almquist \& Wiksell},
  location = {Stockholm},
  date = {1968},
  pages = {367--377}}
@InProceedings{moraux,
  author = {Moraux, Paul},
  editor = {Lloyd, G. E. R. and Owen, G. E. L.},
  title = {Le \emph{De Anima} dans la tradition gr{\`e}cque},
  subtitle = {Quelques aspects de l'interpretation du trait{\'e}, de Theophraste {\`a}
    Themistius},
  shorttitle = {\emph{De Anima} dans la tradition gr{\`e}cque},
  booktitle = {Aristotle on Mind and the Senses},
  booktitleaddon = {Proceedings of the Seventh Symposium Aristotelicum},
  eventdate = {1975},
  publisher = cup,
  location = {Cambridge},
  date = {1979},
  pages = {281--324}}
@InCollection{pines,
  author = {Pines, Shlomo},
  editor = {Twersky, Isadore},
  indextitle = {Limitations of Human Knowledge According to Al-Farabi, ibn Bajja, and
    Maimonides, The},
  title = {The Limitations of Human Knowledge According to Al-Farabi, ibn Bajja, and
    Maimonides},
  shorttitle = {Limitations of Human Knowledge},
  booktitle = {Studies in Medieval Jewish History and Literature},
  publisher = hup,
  location = {Cambridge, Mass.},
  date = {1979},
  pages = {82--109}}
\end{filecontents}

\begin{document}

This is a paraphrase \autocites{yoon}{yoon} % Added by Philip

This is a paraphrase \autocites{yoon}{yoon} % Added by Philip

\cquotation{This is a short direct quotation. \autocite{yoon}}

\cquotation{This is a long direct quotation. This is a long direct
    quotation. This is a long direct quotation. This is a long direct
    quotation. This is a long direct quotation. This is a long direct
    quotation. This is a long direct quotation. This is a long direct
    quotation.\autocite{yoon}}

This is a paraphrase \autocite{yoon}

This is a paraphrase with prenote \autocite[siehe hierzu auch][]{yoon}

This is a paraphrase \autocite{yoon}
This is a paraphrase \autocite{yoon}

This is a paraphrase \autocites{yoon}{yoon} % Added by Philip

This is a paraphrase \autocites{yoon}{yoon} % Added by Philip

\cquotation{This is a short direct quotation. \autocite{yoon}}
This is a paraphrase \autocite{yoon}

\noindent
\citeintitle{yoon} versus \citejournal{yoon} \\\\
\citeintitle{salam} versus \citebooktitle{salam} \\\\
\citeintitle{moraux} versus \citebooktitle{moraux} \\\\
\citeintitle{pines} versus \citebooktitle{pines}
\printbibliography

\end{document}

注1:藝術。这里使用的代码是 moewe 根据 lockstep 版本稍微改进的。它避免了奇怪的编号和不想要的预注输出藝術。autocite=footnotebiblatex 中设置(链接Biblatex:问题藝術。动态引用命令中的编号)。

注2:对于 ,\citeauthor{}可以通过将命令替换为 来修复该问题\citeauthor[\unspace][]{}。由于这会影响可读性,因此最好采用全局解决方案。但是,也许全局解决方案可以在此基础上建立。

答案1

您可以定义一个新的\newbibmacro*{simp:prenote},它从不打印任何“vgl”/比较内容

\newbibmacro*{simp:prenote}{%
  \iffieldundef{prenote}
    {}
    {\printfield{prenote}%
     \setunit{\prenotedelim}}}

(顺便说一下,这是 的标准定义bibmacro{prenote}biblatex.def

然后我们在所有\citetitle/\citeauthor和相关宏中使用这个简单的 bib 宏

我们必须重新定义要使用的标准\citeauthor/\citetitlesimp:prenote

\DeclareCiteCommand{\citeauthor}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printnames{labelname}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\citeauthor}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printnames[][1-1]{labelname}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citetitle}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\ifciteindex
     {\indexfield{indextitle}}
     {}%
   \printfield[citetitle]{labeltitle}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\citetitle}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\ifciteindex
     {\indexfield{indextitle}}
     {}%
   \printfield[citetitle]{title}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeyear}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\printfield{year}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\citeyear}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\printfield{year}\printfield{extrayear}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citedate}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\printdate}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\citedate}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\printdateextra}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeurl}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\printfield[citeurl]{url}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\notecite}
  {\printfield{simp:prenote}%
   \setunit*{\prenotedelim}}
  {\nocite{\thefield{entrykey}}}
  {}
  {\printfield{postnote}}

\DeclareCiteCommand{\citejournal}
  {\usebibmacro{simp:prenote}}
  {\usebibmacro{citeindex}%
    \usebibmacro{journal}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citebooktitle}
  {\usebibmacro{simp:prenote}}
  {\usebibmacro{citeindex}%
    \usebibmacro{booktitle}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeintitle}% Based on \citetitle from biblatex.def
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\ifciteindex
     {\indexfield{indextitle}}
     {}%
   \iffieldundef{journaltitle}
     {\iffieldundef{booktitle}
        {\iffieldundef{maintitle}
          {\printfield[citetitle]{labeltitle}}% Behave like \citetitle if no "main" title
          {\printtext[maintitle]{\printfield[titlecase]{maintitle}}}}
        {\printtext[booktitle]{\printfield[titlecase]{booktitle}}}}
     {\printtext[journaltitle]{\printfield[titlecase]{journaltitle}}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

这是相当多的代码,但是相当简单。

平均能量损失

\documentclass{article}

\usepackage[ngerman]{babel}

\usepackage[style=authoryear,autocite=footnote,backend=bibtex]{biblatex} % Here, Philip added "autocite=footnote,backend=bibtex"

%-------------------
\NewBibliographyString{compare}
\DefineBibliographyStrings{ngerman}{%
  compare = {vgl\adddot},
}

\newbool{withintextquote}

\renewbibmacro*{multiprenote}{%
  \renewbibmacro*{prenote}{%
    \iffieldundef{prenote}
      {}
      {\printfield{prenote}%
       \setunit{\prenotedelim}}}%
  \iffieldundef{multiprenote}{%
    \ifbool{withintextquote}{%
    }{%
      \bibstring{compare}\addspace
    }%
    }
    {\printfield{multiprenote}%
     \setunit{\prenotedelim}}}

\renewbibmacro*{prenote}{%
  \iffieldundef{prenote}{%
    \ifbool{withintextquote}{%
    }{%
      \bibstring{compare}\addspace
    }%
    }
    {\printfield{prenote}%
     \setunit{\prenotedelim}}}

\newbibmacro*{simp:prenote}{%
  \iffieldundef{prenote}
    {}
    {\printfield{prenote}%
     \setunit{\prenotedelim}}}

\makeatletter
\newcommand{\cquotation}[1]{%
    \begingroup
    \booltrue{withintextquote}%
    % \settowidth doesn't like paragraphs
    \setbox\@tempboxa\hbox{%
        \def\par{\hspace{3\linewidth}}% If a paragraph is included force long form
        %\let\par\space  % Ignore paragraphs
        \let\footnote\@empty% make sure autocite does not do anything here; this is new
        \let\autocite\@empty
        #1}%
    \ifdim\wd\@tempboxa>3\linewidth
        \begin{quote}
            \itshape
            #1
        \end{quote}
    \else
        {\itshape #1}%
    \fi
    \endgroup}
\makeatother

%-------------------

\DeclareCiteCommand{\citeauthor}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printnames{labelname}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\citeauthor}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printnames[][1-1]{labelname}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citetitle}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\ifciteindex
     {\indexfield{indextitle}}
     {}%
   \printfield[citetitle]{labeltitle}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\citetitle}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\ifciteindex
     {\indexfield{indextitle}}
     {}%
   \printfield[citetitle]{title}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeyear}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\printfield{year}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\citeyear}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\printfield{year}\printfield{extrayear}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citedate}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\printdate}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\citedate}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\printdateextra}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeurl}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\printfield[citeurl]{url}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\notecite}
  {\printfield{simp:prenote}%
   \setunit*{\prenotedelim}}
  {\nocite{\thefield{entrykey}}}
  {}
  {\printfield{postnote}}

\DeclareCiteCommand{\citejournal}
  {\usebibmacro{simp:prenote}}
  {\usebibmacro{citeindex}%
    \usebibmacro{journal}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citebooktitle}
  {\usebibmacro{simp:prenote}}
  {\usebibmacro{citeindex}%
    \usebibmacro{booktitle}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeintitle}% Based on \citetitle from biblatex.def
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{simp:prenote}}
  {\ifciteindex
     {\indexfield{indextitle}}
     {}%
   \iffieldundef{journaltitle}
     {\iffieldundef{booktitle}
        {\iffieldundef{maintitle}
          {\printfield[citetitle]{labeltitle}}% Behave like \citetitle if no "main" title
          {\printtext[maintitle]{\printfield[titlecase]{maintitle}}}}
        {\printtext[booktitle]{\printfield[titlecase]{booktitle}}}}
     {\printtext[journaltitle]{\printfield[titlecase]{journaltitle}}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

  \usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@Article{yoon,
  author = {Yoon, Myeong S. and Ryu, Dowook and Kim, Jeongryul and Ahn, Kyo Han},
  title = {Palladium pincer complexes with reduced bond angle strain: efficient catalysts
    for the Heck reaction},
  journaltitle = {Organometallics},
  volume = {25},
  number = {10},
  date = {2006},
  pages = {2409--2411}}
@InProceedings{salam,
  author = {Salam, Abdus},
  editor = {Svartholm, Nils},
  title = {Weak and Electromagnetic Interactions},
  booktitle = {Elementary Particle Theory},
  booksubtitle = {Relativistic Groups and Analyticity},
  booktitleaddon = {Proceedings of the Eighth Nobel Symposium},
  eventdate = {1968-05-19/1968-05-25},
  venue = {Aspen{\"a}sgarden, Lerum},
  publisher = {Almquist \& Wiksell},
  location = {Stockholm},
  date = {1968},
  pages = {367--377}}
@InProceedings{moraux,
  author = {Moraux, Paul},
  editor = {Lloyd, G. E. R. and Owen, G. E. L.},
  title = {Le \emph{De Anima} dans la tradition gr{\`e}cque},
  subtitle = {Quelques aspects de l'interpretation du trait{\'e}, de Theophraste {\`a}
    Themistius},
  shorttitle = {\emph{De Anima} dans la tradition gr{\`e}cque},
  booktitle = {Aristotle on Mind and the Senses},
  booktitleaddon = {Proceedings of the Seventh Symposium Aristotelicum},
  eventdate = {1975},
  publisher = cup,
  location = {Cambridge},
  date = {1979},
  pages = {281--324}}
@InCollection{pines,
  author = {Pines, Shlomo},
  editor = {Twersky, Isadore},
  indextitle = {Limitations of Human Knowledge According to Al-Farabi, ibn Bajja, and
    Maimonides, The},
  title = {The Limitations of Human Knowledge According to Al-Farabi, ibn Bajja, and
    Maimonides},
  shorttitle = {Limitations of Human Knowledge},
  booktitle = {Studies in Medieval Jewish History and Literature},
  publisher = hup,
  location = {Cambridge, Mass.},
  date = {1979},
  pages = {82--109}}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

This is a paraphrase \autocites{yoon}{yoon} % Added by Philip

This is a paraphrase \autocites{yoon}{yoon} % Added by Philip

\cquotation{This is a short direct quotation. \autocite{yoon}}

\cquotation{This is a long direct quotation. This is a long direct
    quotation. This is a long direct quotation. This is a long direct
    quotation. This is a long direct quotation. This is a long direct
    quotation. This is a long direct quotation. This is a long direct
    quotation.\autocite{yoon}}

This is a paraphrase \autocite{yoon}

This is a paraphrase with prenote \autocite[siehe hierzu auch][]{yoon}

This is a paraphrase \autocite{yoon}
This is a paraphrase \autocite{yoon}

This is a paraphrase \autocites{yoon}{yoon} % Added by Philip

This is a paraphrase \autocites{yoon}{yoon} % Added by Philip

\cquotation{This is a short direct quotation. \autocite{yoon}}
This is a paraphrase \autocite{yoon}

\noindent
\citeauthor{yoon} versus \citetitle{yoon} \\\\
\citeintitle{yoon} versus \citejournal{yoon} \\\\
\citeintitle{salam} versus \citebooktitle{salam} \\\\
\citeintitle{moraux} versus \citebooktitle{moraux} \\\\
\citeintitle{pines} versus \citebooktitle{pines}
\printbibliography

\end{document}

相关内容