我正在使用 snugshade 环境来绘制引文框,但是它有点太宽并且与两边的文本不齐平。
我完全不知道我是否可以在这种环境下解决这个问题,或者我是否必须使用其他东西——我并不喜欢这种解决方案。
梅威瑟:
\documentclass[12pt,a4paper]{scrbook}
\usepackage[svgnames]{xcolor}
\definecolor{lightgray}{gray}{0.95}
\definecolor{quoteColor}{gray}{0.15}
\usepackage{libertine}
\usepackage{graphicx}
\usepackage{framed}
\usepackage{lipsum}
\newcommand*\openquote{\makebox(0,-45){\scalebox{5}{``}}}
\newcommand*\closequote{\makebox(0, -5){\scalebox{5}{''}}}
\colorlet{shadecolor}{lightgray}
\makeatletter
\newif\if@right
\def\shadequote{\@righttrue\shadequote@i}
\def\shadequote@i{\begin{snugshade}\begin{quote}\openquote}
\def\endshadequote{%
\if@right\hfill\fi\closequote\end{quote}\end{snugshade}}
\@namedef{shadequote*}{\@rightfalse\shadequote@i}
\@namedef{endshadequote*}{\endshadequote}
\makeatother
\begin{document}
\lipsum[3]
\color{quoteColor}
\begin{shadequote}
\begin{quote}
\lipsum[4]
\end{quote}
\end{shadequote}
\lipsum[5]
\end{document}
图片:
答案1
的定义存在错误snugshade
:
\documentclass[12pt,a4paper]{scrbook}
\usepackage[svgnames]{xcolor}
\definecolor{lightgray}{gray}{0.95}
\definecolor{quoteColor}{gray}{0.15}
\usepackage{libertine}
\usepackage{graphicx}
\usepackage{framed}
\usepackage{lipsum}
\newcommand*\openquote{\makebox(0,-45){\scalebox{5}{``}}}
\newcommand*\closequote{\makebox(0, -5){\scalebox{5}{''}}}
\colorlet{shadecolor}{lightgray}
\makeatletter
\renewenvironment{snugshade}{%
\def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
\colorbox{shadecolor}{##1}\hskip-\fboxsep
% There is no \@totalrightmargin, so:
\hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
\MakeFramed {\advance\hsize-\width
\advance\hsize-2\fboxsep %%%%%%%%%%%%% <------ ADDED
\@totalleftmargin\z@ \linewidth\hsize
\@setminipage}%
}{\par\unskip\@minipagefalse\endMakeFramed}
\newif\if@right
\def\shadequote{\@righttrue\shadequote@i}
\def\shadequote@i{\begin{snugshade}\begin{quote}\openquote}
\def\endshadequote{%
\if@right\hfill\fi\closequote\end{quote}\end{snugshade}}
\@namedef{shadequote*}{\@rightfalse\shadequote@i}
\@namedef{endshadequote*}{\endshadequote}
\makeatother
\begin{document}
\lipsum[3]
\begin{shadequote}
\begin{quote}
\lipsum[4]
\end{quote}
\end{shadequote}
\hbox to \textwidth{\kern-.4pt\smash{\vrule height 5cm}\hfill\smash{\vrule height 5cm}\kern-.4pt}
\nointerlineskip
\lipsum[5]
\end{document}
这\hbox to \textwidth{...}
只是提供显示边距的两条规则。