我正在尝试在 csquotes 中创建自己的 blockquote 环境。
该\blockquoteQ
命令的行为应与普通\blockquote
命令类似,但不是将文本排版为直立并放在引号中,而是将其排版为斜体且不带引号。\blockquoteQ
然后,在我的文档中使用该命令排版来自古代资料的块引用,而原始命令\blockquote
则用于排版来自文学的块引用。
MWE 仍然存在两个问题,而我不知道如何解决它们:
- 我需要在执行命令时
\mkblockquote
临时更改环境中命令的重新定义。目前两个环境都有引号smallquoteItalic
\blockquoteQ
\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}