4

How do I control/remove the indentation automatically generated in the \leftbar environment?

\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}
0
5

The indentation is caused by \Framesep and the width of the left bar with the value of 3pt. Here \setlength{\FrameSep}{0pt} and \hspace{-3pt} in \FrameCommand are used to show that:

\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}

framed theorem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.