I'm using the mdframed package to highlight a paragraph with rules on both sides. However, the mdframed-environment creates a box for the paragraph inside of it and so the spacing around it is different form the spacing of a normal paragraph.
The following code shows the problem:
\documentclass{article}
\usepackage{mdframed}
\parindent=0pt
\newenvironment{note}{%
\begin{mdframed}[leftmargin=\dimexpr-0.5em-3pt, innerleftmargin=0.5em,
rightmargin=\dimexpr-0.5em-3pt, innerrightmargin=0.5em,
linewidth=3pt,linecolor=red, topline=false, bottomline=false]%
}{\end{mdframed}}
\begin{document}
\Huge XYZ
XYZ
\begin{note}
XYZ
\end{note}
XYZ
xyz
\begin{note}
xyz
\end{note}
xyz
\end{document}
I guess the problem can be fixed with adjusting the inner margin/skip options for the mdframed environment, but it seems rather tricky to find the correct values to make it behave exactly like a normal paragraph. Any ideas how to get the natural paragraph spacing for that?
EDIT: To make it more clear, the prolematic part is the line-spacing before and after the framed paragraph. You can see the problem best when selecting a big font size and short paragraphs. In my example the framed block starts right at the bottom of text in the paragraph before it, but there should be some additional space/glue between both.
The opposite problem occurs at the bottom of the framed paragraph, there's too much space between it and the following paragraph.





leftmarginto a negative combination of thelinewidthandinnerleftmargin; similarly for therightmargin. What am I missing? – A.Ellett Dec 29 '12 at 16:55lipsumpackage to insert some sample text – cmhughes Dec 29 '12 at 17:26