Biblatex:改进动态引用命令

Biblatex:改进动态引用命令

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

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

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

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

  4. 它在 biblatex 中起作用。

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

问题

  1. 是否可以将超出 3 行的版本更改为单倍行距(同时使用\usepackage{setspace}\onehalfspacing)?
  2. 是否有可能生成比超过 3 行的版本中的“正确”文本略小的文本?
  3. 在 中使用footnote{},当脚注文本超过3行时,是否可以调整其大小?
  4. 有人能做到吗?

代码:

\documentclass{article}

\usepackage[ngerman]{babel}

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

\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


\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

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

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

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

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

This is a paraphrase \autocite{A01}

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

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

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

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

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

\footnote{This is aThis is aThis is aThis is aThis is aThis is aThis is aThis is aThis is   aThis is aThis is a \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{A01}} This is aThis is aThis is aThis is aThis is aThis is aThis   is aThis is aThis is aThis is aThis is a }

\printbibliography

\end{document}

注意:藝術。这里使用的代码是 moewe 根据 lockstep 版本稍微改进的。它避免了奇怪的编号和不想要的预注输出藝術。autocite=footnotebiblatex 中设置(链接Biblatex:问题藝術。动态引用命令中的编号)。此外,您还可以找到\newbibmacro*{simp:prenote}{...moewe 的命令以避免与其他命令混淆(请参阅Biblatex:将动态比较命令与 '\citetitle' 命令相结合)。并且,我添加了\usepackage{setspace}and \onehalfspacing

答案1

以下重新定义\cquotation可能会有所帮助。

\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}
            \singlespacing
            \smaller
            \itshape
            #1
        \end{quote}
    \else
        {\blx@blxinit\iffootnote{\smaller}{}\itshape #1}%
    \fi
    \endgroup}
\makeatother

\singlespacing较长的引文(超过 3 行的文本)将以较小的尺寸打印(该\smaller命令由 Donald Arseneau 提供)relsize包,因此我们加载\usepackage{relsize})。

而仅当短格式出现在脚注中时,其打印尺寸才会较小;为了检测脚注,我们使用\iffootnotebiblatex该命令仅在发出 后才可用\blx@blxinit

请注意,尺寸计算是在双倍行距和正常字体大小下完成的。

平均能量损失

\documentclass{article}

\usepackage[ngerman]{babel}

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

\usepackage{setspace}
\usepackage{relsize}
\onehalfspacing
\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}
            \singlespacing
            \itshape
            #1
        \end{quote}
    \else
        {\blx@blxinit\iffootnote{\smaller}{}\itshape #1}%
    \fi
    \endgroup}
\makeatother


\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

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

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

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

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

    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.

This is a paraphrase \autocite{A01}

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

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

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

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

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

\footnote{This is aThis is aThis is aThis is aThis is aThis is aThis is aThis is aThis is   aThis is aThis is a \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{A01}} This is aThis is aThis is aThis is aThis is aThis is aThis   is aThis is aThis is aThis is aThis is a }

\printbibliography

\end{document}

相关内容