Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

1 Answer

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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