我想更改\quote
整个文档中各个区域的样式。这三行就是我想到的。字体和边距更改会生效,但背景颜色不会。只有第一个字符的背景颜色会更改,而不是整个引文块。
\definecolor{block-gray}{gray}{0.85}
\newenvironment{myblock}
{\small \addtolength{\leftskip}{10mm} \addtolength{\rightskip}{10mm} \colorbox{block-gray} }
{\normalsize \addtolength{\leftskip}{0mm} \addtolength{\rightskip}{0mm}}
\renewcommand{\quote}{\myblock}
答案1
对于这样的工作,tcolorbox
更合适。这里的优点是盒子可以跨页分解。
\documentclass{article}
\usepackage{showframe,lipsum} %% just for demo
\usepackage[most]{tcolorbox}
\definecolor{block-gray}{gray}{0.85}
\newtcolorbox{myquote}{colback=block-gray,grow to right by=-10mm,grow to left by=-10mm,
boxrule=0pt,boxsep=0pt,breakable}
\begin{document}
\noindent
\begin{myquote}
\lipsum
\end{myquote}
\end{document}
在您的方法中,您最好使用environ
包。但是,这在页面之间是不可破坏的。
\documentclass{article}
\usepackage{xcolor,showframe}
\definecolor{block-gray}{gray}{0.85}
\usepackage{environ}
\NewEnviron{myblock}
{\colorbox{block-gray}{%
\parbox{\dimexpr\linewidth-2\fboxsep\relax}{%
\small\addtolength{\leftskip}{10mm}
\addtolength{\rightskip}{10mm}
\BODY}}
}
\renewcommand{\quote}{\myblock}
\renewcommand{\endquote}{\endmyblock}
\begin{document}
\noindent
\begin{quote}
The quote come here The quote come here The quote come here The quote come here The quote come hereThe quote come here The quote come here The quote come here The quote come here
\end{quote}
\end{document}