以下 LaTeX 代码创建了一个类似引号的环境(“答案”),其左侧有一个竖线。如何重新定义该环境,使其跨越分页符?
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{lipsum}
\usepackage[height=4in]{geometry} % keep pages small for demo
\newsavebox{\mybox}
\newlength{\mydepth}
\newlength{\myheight}
\newenvironment{answer}%
{\vspace*{3pt}\par\begin{lrbox}{\mybox}\quad\begin{minipage}{.89\linewidth}\color{black}\setlength{\parskip}{10pt plus 1pt minus 1pt}\vspace*{-.7\baselineskip}}%
{\vspace*{.3\baselineskip}\end{minipage}\end{lrbox}%
\settodepth{\mydepth}{\usebox{\mybox}}%
\settoheight{\myheight}{\usebox{\mybox}}%
\addtolength{\myheight}{\mydepth}%
\noindent\makebox[0pt]{%
\color{black}\hspace{-0pt}\rule[-\mydepth]{1pt}{\myheight}}%
\usebox{\mybox}%
\vspace*{3pt}}
\begin{document}
\lipsum[1]
\begin{answer}
\lipsum[2-3]
\end{answer}
\end{document}
答案1
该changebar
计划确实提供了所需的解决方案。
\documentclass{article}
\usepackage{color}
\usepackage{lipsum}
\usepackage[xcolor,leftbars]{changebar}
\usepackage[height=3in]{geometry}
\cbcolor{red}
\newenvironment{answer}%
{\begin{quote}%
\begin{changebar}\cbcolor{gray}\color{black}}%
{\end{changebar}%
\end{quote}}
\begin{document}
\lipsum[1]\
\begin{answer}
\lipsum[2-3]
\end{answer}
\end{document}