練習問題の横に縦線を引く

練習問題の横に縦線を引く

私は svmono ドキュメントスタイル (springer monographs) によって提供される既存の環境 (演習) で作業していますが、演習がどこで終了し、次の段落がどこで始まるのかが不明瞭な場合があります。

これを解決するために、テキストの左側に垂直線を追加しようとしています。framedの修正を使用して、このためにパッケージを使用していますleftbar。 どこから入手したのかよくわかりませんが、バーが演習の両側で約 1 行分高すぎるか低すぎるかに伸びているという問題があります。 そのため、演習が垂直方向のスペースを占有しすぎています。 提供されているバージョンではなく、環境に amsthm を使用した例を次に示します。

\documentclass{article}

\usepackage{amsthm}
\newtheorem{exercise}{Exercise}

\usepackage{framed}

\renewenvironment{leftbar}[1][\hsize]
{%
    \def\FrameCommand
    {%
        {\hspace{-0.5ex}\vrule width 0.5pt}%
        \hspace{0ex}%must no space.
        \fboxsep=\FrameSep%
    }%
    \MakeFramed{\hsize#1\advance\hsize-\width\FrameRestore}%
}
{\endMakeFramed}

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

\begin{document}
some text
\begin{exercise}
here is exercise 1. 
\end{exercise}
more text
\end{document}

バーによって環境が余分な垂直スペースを占有しないように、これを修正する方法はありますか?(または、これはXY問題- 演習をテキストの残りの部分と明確に区​​別するためのより良い代替手段はありますか?

答え1

カスタマイズしやすいに基づいたソリューションを提案しますmdframed。ご希望に近いものになることを願っています。

\documentclass{article}
\usepackage{amsthm}
\usepackage{mdframed}
\usepackage{lipsum}

\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, %
skipabove=0.6\topsep]%
{exercise}{Exercise}%

\begin{document}

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

\end{document} 

ここに画像の説明を入力してください

関連情報