I would like to define tcolorboxes including a user specified blank space (purpose: having a question/answer box for students to fill) that can be broken. For example, here is what I would like to have :
----------------- % Begin of tcolorbox
Some preliminary text \lipsum[1]
%%% exactly X cm blank vertical space below (may it be broken or not) %%%
----------------- % End of tcolorbox
The difficulty comes when the breakable tcolorbox gets broken: I've tried to use \vspace{}
after \tcbbreak
or tcblower
, specify an explicit height
to the tcolorbox's parameters (that fails because of the breakable
option), use height fixed for
... but no option seems valid for having exactly the desired height.
Either specifying the blank space height of the total tcolorbox height would be fine.
Does anyone would have an idea on how to achieve this?
MRE:
\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\begin{document}
\newtcolorbox{box_test}{enhanced,breakable,title={Title}}
\lipsum[1-3]
\begin{box_test}
\lipsum[1]
\vspace{10cm}
Exactly 10cm empty space above wanted across page break.
\end{box_test}
\begin{box_test}
\lipsum[1]
\vspace{10cm}
Exactly 10cm empty space above obtained without page break.
\end{box_test}
\end{document}
I would like to define tcolorboxes including a user specified blank space (purpose: having a question/answer box for students to fill) that can be broken. For example, here is what I would like to have :
----------------- % Begin of tcolorbox
Some preliminary text \lipsum[1]
%%% exactly X cm blank vertical space below (may it be broken or not) %%%
----------------- % End of tcolorbox
The difficulty comes when the breakable tcolorbox gets broken: I've tried to use \vspace{}
after \tcbbreak
or tcblower
, specify an explicit height
to the tcolorbox's parameters (that fails because of the breakable
option), use height fixed for
... but no option seems valid for having exactly the desired height.
Either specifying the blank space height of the total tcolorbox height would be fine.
Does anyone would have an idea on how to achieve this?
MRE:
\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\begin{document}
\newtcolorbox{box_test}{enhanced,breakable,title={Title}}
\lipsum[1-3]
\begin{box_test}
\lipsum[1]
\vspace{10cm}
Exactly 10cm empty space above wanted across page break.
\end{box_test}
\begin{box_test}
\lipsum[1]
\vspace{10cm}
Exactly 10cm empty space above obtained without page break.
\end{box_test}
\end{document}
Share
Improve this question
edited Mar 20 at 14:39
Mathieu Coquerelle
asked Mar 20 at 11:05
Mathieu CoquerelleMathieu Coquerelle
1015 bronze badges
1
- Did you check this tex.stackexchange/questions/194427/… – Naveed Ahmed Commented Mar 20 at 11:17
1 Answer
Reset to default 0You could add empty lines instead of just one fixed space (adjust the number of lines to whatever gives you the desired amount of space):
\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\begin{document}
\newtcolorbox{box_test}{enhanced,breakable,title={Title}}
\lipsum[1-3]
\begin{box_test}
\lipsum[1]
\foreach \macro in {1,...,20}{\mbox{}\par}
Exactly 10cm empty space above wanted across page break.
\end{box_test}
\begin{box_test}
\lipsum[1]
\foreach \macro in {1,...,20}{\mbox{}\par}
Exactly 10cm empty space above obtained without page break.
\end{box_test}
\end{document}