\leftbar 环境中的缩进

\leftbar 环境中的缩进

如何控制/删除\leftbar环境中自动生成的缩进?

\documentclass[11pt,letterpaper]{amsbook}
\usepackage{xcolor}
\definecolor{lightgray}{gray}{0.90}

\newtheorem{theorem}{Theorem}

\usepackage{framed}
\renewenvironment{leftbar}[1][\hsize]
{% 
\def\FrameCommand 
{%

    {\color{black}\vrule width 3pt}%
    \hspace{0pt}%must no space.
    \fboxsep=\FrameSep\colorbox{lightgray}%
}%
\MakeFramed{\hsize#1\advance\hsize-\width\FrameRestore}%
}
{\endMakeFramed}

\begin{document}

\begin{leftbar}
\begin{theorem}
Fun Math
\end{theorem}
\end{leftbar}
\end{document}

答案1

缩进由 引起\Framesep,并且左侧栏的宽度为 ,其值为3pt。这里使用\setlength{\FrameSep}{0pt}\hspace{-3pt}\FrameCommand表示:

\documentclass[11pt,letterpaper]{amsbook}
\usepackage{xcolor}
\definecolor{lightgray}{gray}{0.90}
\newtheorem{theorem}{Theorem}
\usepackage{framed}
\renewenvironment{leftbar}[1][\hsize]
{% 
\def\FrameCommand 
{%

    {\hspace{-3pt}\color{black}\vrule width 3pt}%
    \hspace{0pt}%must no space.
    \fboxsep=\FrameSep\colorbox{lightgray}%
}%
\MakeFramed{\hsize#1\advance\hsize-\width\FrameRestore}%
}
{\endMakeFramed}
\setlength{\FrameSep}{0pt}
\begin{document}
\begin{leftbar}
\begin{theorem}
Fun Math
\end{theorem}
\end{leftbar}
\begin{theorem}
Fun Math
\end{theorem}
\end{document}

框架定理

相关内容