在 csquotes 中创建自己的块环境

在 csquotes 中创建自己的块环境

我正在尝试在 csquotes 中创建自己的 blockquote 环境。

\blockquoteQ命令的行为应与普通\blockquote命令类似,但不是将文本排版为直立并放在引号中,而是将其排版为斜体且不带引号。\blockquoteQ然后,在我的文档中使用该命令排版来自古代资料的块引用,而原始命令\blockquote则用于排版来自文学的块引用。

MWE 仍然存在两个问题,而我不知道如何解决它们:

  1. 我需要在执行命令时\mkblockquote临时更改环境中命令的重新定义。目前两个环境都有引号smallquoteItalic\blockquoteQ
  2. \blockquoteQ如果可以有一个可选参数和一个强制参数,就像原来的一样,那就太好了\blockquote

平均能量损失

\documentclass{scrartcl}
\usepackage[]{csquotes, biblatex}

 \newenvironment*{smallquoteItalic}
   {\quote\small\itshape}
   {\endquote}
\newcommand{\blockquoteQ}[2]{{\SetBlockEnvironment{smallquoteItalic}\blockquote[#1][]{#2}}}

\renewcommand{\mkblockquote}[4]{\leavevmode\llap{,,}#1``#2#4#3}

 \newenvironment*{smallquote}
   {\quote\small}
   {\endquote}

  \SetBlockEnvironment{smallquote}

\begin{document}
     \blockquote[{\autocite[][]{}}]{A block quote of literature which should be set smaller, without italics but with quotation marks. A block quote of literature which should be set smaller, without italics but with quotation marks. A block quote of literature which should be set smaller, without italics but with quotation marks}

     \blockquoteQ{{\autocite[][]{}}}{A block quote of a source which should be set smaller and in italics but without quotation marks. A block quote of a source which should be set smaller and in italics but without quotation marks. A block quote of a source which should be set smaller and in italics but without quotation marks.}
\end{document}

答案1

似乎没有方便的界面来定义新的\blockquote类似命令csquotes

这里我们尝试使用尽可能多的通用代码,核心是我们使用一个toggle来在和\mkblockquote之间切换的定义。\blockquote\blockquoteQ

\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}

\addbibresource{biblatex-examples.bib}

\renewcommand{\mkcitation}[1]{\space#1}

\newenvironment*{smallquote}
  {\quote\small}
  {\endquote}

\SetBlockEnvironment{smallquote}

\newtoggle{csq@qquote}

\makeatletter
\renewcommand{\mkblockquote}[4]{%
  \leavevmode
  \begingroup
  \iftoggle{csq@qquote}
    {\itshape}
    {\advance\csq@qlevel\@ne
     \llap{\textooquote}}%
  #1%
  \iftoggle{csq@qquote}
    {}
    {\textcoquote}%
  \endgroup
  #2#4#3}

% copy the original definition of \blockquote
\let\csqq@blockquote\blockquote

% new \blockquotes with toggles
% would be nicer with grouping, but that would mess with argument grabbing
\renewcommand{\blockquote}{\togglefalse{csq@qquote}\csqq@blockquote}
\newcommand{\blockquoteQ}{\toggletrue{csq@qquote}\csqq@blockquote}
\makeatother


\begin{document}
  \blockquote[{\autocite[cf.][12]{sigfridsson}}]{A block \enquote{quote} of literature which should be set smaller, without italics but with quotation marks. A block quote of literature which should be set smaller, without italics but with quotation marks. A block quote of literature which should be set smaller, without italics but with quotation marks}

  \blockquoteQ[{\autocite[cf.][13]{sigfridsson}}]{A block \enquote{quote} of a source which should be set smaller and in italics but without quotation marks. A block quote of a source which should be set smaller and in italics but without quotation marks. A block quote of a source which should be set smaller and in italics but without quotation marks.}

  \blockquote[{\autocite[cf.][12]{sigfridsson}}]{A block \enquote{quote} of literature which should be set smaller, without italics but with quotation marks. A block quote of literature which should be set smaller, without italics but with quotation marks. A block quote of literature which should be set smaller, without italics but with quotation marks}
\end{document}

三个引文区块。区块一和区块三为直立字体,并带有引号。区块二为斜体,不带引号。

相关内容