I'm working with an existing environment (exercise) provided by the svmono documentstyle (springer monographs) and sometimes it is unclear where an exercise ends and the next paragraph begins.

To solve this, I am trying to add a vertical line to the left of the text. I am using the framed package for this, using a modification of leftbar. I'm not quite sure where I got this from, but a problem I have is that the bar extends about a line too high and to low on either side of the exercise. Thus the exercise now takes up too much vertical space. Here is an example using amsthm for the environment rather than the provided version.




        {\hspace{-0.5ex}\vrule width 0.5pt}%
        \hspace{0ex}%must no space.

\def\exercise{\begingroup \begin{leftbar}\oldexercise}
\def\endexercise{\oldendexercise \end{leftbar}\endgroup}

some text
here is exercise 1. 
more text

Is there a way to modify this so that the bar does not cause the environment to take up extra vertical space? (alternately - since this may be an XY problem - is there a better alternative to make the exercise clearly distinct from the rest of the text?)

  • Could you post a fully compilable, yet minimal, code, that we can play with? – Bernard Jun 12 '16 at 1:08
  • @bernard - A bit hard because it relies on an existing environment, but I'll build one. Give me a few minutes – Joel Jun 12 '16 at 1:14
  • OK. B.t.w., if the exercise environment is based on amsthm, you might use a customised version of \qedhere or/and a \small font size. – Bernard Jun 12 '16 at 1:19
  • @Bernard Got the example in. It uses amsthm for the sample. I don't want to play with font sizes/shapes. – Joel Jun 12 '16 at 1:23

I propose a solution based on mdframed, which is easy to customise. Hope it's close to what you want:


\newmdtheoremenv[linewidth=0.5pt, topline=false, bottomline=false, rightline=false,%
leftmargin=0pt, innerleftmargin=0.4em, rightmargin=0pt, innerrightmargin=0pt, innertopmargin=-5pt ,%
innerbottommargin=3pt, splittopskip=\topskip, splitbottomskip=0.3\topskip, %


Here is exercise 1. You must answer the following question:  why is it that
    \[ 1 + 1 = 2  \]%
more text


enter image description here

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.