In this case, it's a not a bug but a feature. The inner text box is decoupled from the fixed height setting for a number of reasons, e.g. lower box part support and breakability. Therefore, you cannot use \vfill
, because the inner text box has no fixed height.
But, you can use a minipage
with a fixed height inside the tcolorbox
. You can put this minipage into the box setting options:
\documentclass[]{scrartcl}
\usepackage[many]{tcolorbox}
\newtcolorbox{bilety}
{ enhanced,
space to upper,
%height=5cm,
segmentation style={black, solid, opacity=0, line width=0pt},
colback = black!5!white,
colframe = black!15!white,
sharpish corners,
before upper={\begin{minipage}[t][4cm]{\linewidth}},
after upper={\end{minipage}},
}
\begin{document}
\begin{bilety}
some text
\par\vfill
some other text
\end{bilety}
\end{document}
Update (16-Nov-2018):
Alternatively, the option text fill
can be used to automatically insert a minipage
with adapted fixed height:
\documentclass[]{scrartcl}
\usepackage[many]{tcolorbox}
\newtcolorbox{bilety}
{ enhanced,
%space to upper,
height=5cm,
%segmentation style={black, solid, opacity=0, line width=0pt},
colback = black!5!white,
colframe = black!15!white,
sharpish corners,
text fill,
}
\begin{document}
\begin{bilety}
some text
\par\vfill
some other text
\end{bilety}
\end{document}
Load theorems
library (I do it with class option most
) and use ams
or any other maths options.
ams
set upper and lower parts to mathematical mode with \displaystyle
. You don't need equation
environments is these boxes. And you don't need valign
.
\documentclass{beamer}
\usepackage[most]{tcolorbox}
\newtcolorbox{equationframe}{
math
}
\begin{document}
\begin{frame}
\begin{itemize}
\item[]
\begin{equationframe}
p(x,y)=\begin{cases}
\min\{q(x,y),\frac{\pi({y})q(y,{x})}{\pi(x)}\}, \quad x\neq y\\
1-\int_{x\neq y} p(x,y)
\end{cases}
\end{equationframe}
\begin{equationframe}
\pi(x)p(x,y)=\min\{\pi(x)q(x,y),\pi(y)q(y,x)\}=\pi(y)p(y,x)%
\end{equationframe}
\end{itemize}
\end{frame}
\end{document}
Update: ams equation*
, ams align*
:
Instead of math
, tcolorbox
also offers some other mathematical boxes: ams equation
, ams align
, ams gather
, ...
\documentclass{beamer}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{frame}
\begin{tcolorbox}[ams equation*]
p(x,y)=\begin{cases}
\min\{q(x,y),\frac{\pi({y})q(y,{x})}{\pi(x)}\}, \quad x\neq y\\
1-\int_{x\neq y} p(x,y)
\end{cases}
\end{tcolorbox}
\begin{tcolorbox}[ams nodisplayskip, ams align*]
\pi(x)p(x,y) & =\min\{\pi(x)q(x,y),\pi(y)q(y,x)\}\\
& =\pi(y)p(y,x)%
\end{tcolorbox}
\end{frame}
\end{document}
Best Answer
Two options; the first one uses a manual adjustment made using the
baseline
key for thetcolorbox
es, and the second one uses the optionvalign=c
for an\adjustbox
from theadjustbox
package; the setting is done automatically usingbefore
andafter
:The complete code with both possibilities: