如何更改报价环境中的默认字体大小和文本颜色?

如何更改报价环境中的默认字体大小和文本颜色?

如何在“引用”环境中改变文本的字体大小和颜色?

答案1

使用最新的 LaTeX 系统(2020-10-01 或更高版本发布),这非常容易:

\documentclass{article}
\usepackage{xcolor}

\usepackage{lipsum} % for mock text

\AddToHook{env/quote/begin}{\small\color{blue!70}}

\begin{document}

\lipsum[3][1-4]
\begin{quote}
\lipsum[4][1-4]
\end{quote}
\lipsum[4][1-4]

\end{document}

在此处输入图片描述

答案2

如果你看一下article.cls(如果你使用不同的类,情况类似),quote它的定义是

\newenvironment{quote}
               {\list{}{\rightmargin\leftmargin}%
                \item\relax}
               {\endlist}

因此您可以在文档中使用

\renewenvironment{quote}
               {\list{}{\rightmargin\leftmargin}%
                \item\relax\large\color{red}}
               {\endlist}

答案3

我不确定您想要什么样的用户界面,但下面为您提供了几个选项。

% quoteprob.tex  SE 605141
\documentclass{article}
\usepackage{lipsum}
\usepackage{comment}

\newenvironment{myquote}%  %%% using the \Large font
  {\begin{list}{}%
    {\setlength\rightmargin{\leftmargin}}%
  %% set the font size (and color?)
  \Large
  \item[]\makebox[0pt]{}%[r]{``}
     \ignorespaces}%
 {\unskip\makebox[0pt]{}%[l]{''}
  \end{list}}

\begin{document}

Some random words just to see the width of the textblock.
Plus some more random words just to see the width of the textblock.


\begin{quote}
  This is in a regular \verb!quote! environment. Have a look at the font size
  compared with the normal font size.
\end{quote}

Some random words just to see the width of the textblock.
Plus some more random words just to see the width of the textblock.

\begin{quote}
  \footnotesize
  This is in a regular \verb!quote! environment with \verb!\footnotesize!. Have a look at the font size
  compared with the normal font size.
\end{quote}


Some random words just to see the width of the textblock.
Plus some more random words just to see the width of the textblock.



\begin{myquote}
  This is in a \verb!myquote! environment. Have a look at the font size
  compared with the normal font size.
\end{myquote}

Some random words just to see the width of the textblock.
Plus some more random words just to see the width of the textblock.


\end{document}

在此处输入图片描述

因此,您可以使用常规quote环境并每次指定文本的外观,或者您可以(重新)定义环境,quote以便myquote提供固定的文本外观。更深入地说,您可以定义一个环境版本quote,该版本采用一个指定文本外观的参数。

相关内容