mdframed 環境内で \vspace{\stretch{1}} が機能しない問題

mdframed 環境内で \vspace{\stretch{1}} が機能しない問題

mdframed 環境内で \vspace{\stretch{1}} を使用する際に問題が発生しています。フレーム内の定理の後に垂直方向のスペースを追加しようとしていますが、 \vspace{\stretch{1}} コマンドが期待どおりに機能していないようです。

\vspace{x cm} を使用できることはわかっていますが、それを使いたくありません。ページを均等に分割したいのです。

私は持っている

ここに私が持っているものの最小限の例を示します:

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

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}

\begin{document}

\begin{mdframed}[
    linecolor=blue,
    linewidth=2pt,
    backgroundcolor=orange!20,
]
\begin{theorem}
  Some subtheorem.
\end{theorem}
\vspace{\stretch{1}}
\end{mdframed}

\end{document}

答え1

x\par\vfill x これは、ミニページまたは \parbox で使用する場合と同じ問題です。次の場合は機能しません:

\fbox{\begin{minipage}{3cm} x\par\vfill x \end{minipage}} 

なぜなら、ボックスを埋めたいのですが、どのくらい埋めるのでしょうか? ボックスの高さは事前に定義されていません。

ページに強制的な高さがあるため、メイン テキストでは機能します。何かに引き伸ばす場合にのみ引き伸ばされます。ミニページでは、ボックスの高さを固定することでこれを行うことができます。

\fbox{\begin{minipage}[c][3cm][c]{3cm} x\par\vfill x \end{minipage}} 

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

高さを固定するオプションを許可する mdframed の代わりにを使用する場合tcolorbox、これも機能しないことに注意してください。

\begin{tcolorbox}[height=3cm]  x\par  \vfill x \end{tcolorbox}

(これはバグではなく、機能です!)

ページを均等に分割したい

等しいボックスが必要な場合は、tcolorbox のラスター ライブラリを使用できます。これにより、各ボックスの高さは、高さの大きいボックスによって固定されます。

ムウェ2

\documentclass[twocolumn]{article}
\usepackage[raster]{tcolorbox}
\begin{document}

\begin{tcbraster}[raster columns=1, size=small, title={\sffamily\bfseries Free  height box No. \thetcbrasternum}]
\begin{tcolorbox}First box\end{tcolorbox}
\begin{tcolorbox}Second box\end{tcolorbox}
\begin{tcolorbox}This is a box\\with a second line \\ with a third line \\ with a fourth line  \end{tcolorbox}
\begin{tcolorbox}Another box\end{tcolorbox}
\begin{tcolorbox}A box\par \vspace{.3 cm} again\end{tcolorbox}
\end{tcbraster}

\newpage

\begin{tcbraster}[raster columns=1, size=small, raster equal height,
size=small,colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,coltitle=black,
title={\sffamily\bfseries Evenlized box No. \thetcbrasternum}]
\begin{tcolorbox}First box\end{tcolorbox}
\begin{tcolorbox}Second box\end{tcolorbox}
\begin{tcolorbox}This is a box\\with a second line \\ with a third line \\ with a fourth line  \end{tcolorbox}
\begin{tcolorbox}Another box\end{tcolorbox}
\begin{tcolorbox}A box\par \vspace{.3 cm} again\end{tcolorbox}
\end{tcbraster}
\end{document}

関連情報