Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I borrowed the following MWE from here but I would like to be able to create an empty environment to use for exercise answer with variable vspace. The exam class has the \makeemptybox{} option, but I wish to use the tufte-handout class and the mdframed package because it allows page breaks.

\documentclass{tufte-handout}
\usepackage{tikz}
\usepackage[framemethod=default]{mdframed}

\global\mdfdefinestyle{exampledefault}{%
linecolor=lightgray,linewidth=1pt,%
leftmargin=1cm,rightmargin=1cm,
}

\newenvironment{mymdframed}[1]{%
\mdfsetup{%
frametitle={\tikz\node[fill=white,rectangle,inner sep=0pt,outer sep=0pt]    {#1};},
frametitleaboveskip=-0.5\ht\strutbox,
frametitlealignment=\raggedright
}%
\begin{mdframed}[style=exampledefault]
}{\end{mdframed}}

\usepackage{blindtext}

\begin{document}

\section{Some text}

\blindtext\footnote{text ends here.}

\bigskip

\begin{fullwidth}
    \begin{mymdframed}{This empty frame} % requires a vertical space of 25cm
    \end{mymdframed}
\end{fullwidth}

\section{Another text\protect\footnote{to be continued after the empty frame with about 25cm}}

\blindtext

\blindtext

\end{document}
share|improve this question

1 Answer 1

up vote 6 down vote accepted

If you don't want to add text in the space reserved for solutions, then a command seems the best choice. The \solutionbox command reserves by default 25cm (change to suit).

The macro \fillwithspace works by dividing the requested space by \baselineskip, rounding the result to an integer n and producing n one line (but otherwise empty) paragraphs.

\documentclass{tufte-handout}
\usepackage{tikz}
\usepackage[framemethod=default]{mdframed}

\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\fillwithspace}{m}
 {
  \prg_replicate:nn { \fp_to_int:n { #1/\dim_to_fp:n { \baselineskip } } }
   {
    \mbox{}\par
   }
 }
\ExplSyntaxOff

\mdfdefinestyle{exampledefault}{%
  linecolor=lightgray,linewidth=1pt,%
  leftmargin=1cm,rightmargin=1cm,
}

\newcommand{\solutionbox}[2][25cm]{%
  \begin{fullwidth}
  \mdfsetup{%
    frametitle={\tikz\node[fill=white,rectangle,inner sep=0pt,outer sep=0pt]{#2};},
    frametitleaboveskip=-0.5\ht\strutbox,
    frametitlealignment=\raggedright
  }%
  \begin{mdframed}[style=exampledefault]
  \fillwithspace{#1}
  \end{mdframed}
  \end{fullwidth}%
}

\usepackage{blindtext}

\begin{document}

\section{Some text}

\blindtext\footnote{text ends here.}

\bigskip

\solutionbox[25cm]{This empty frame}

\section{Another text}

\blindtext

\blindtext

\end{document}

enter image description here

share|improve this answer
    
Indeed a clever solution, thanks. –  jotagah May 1 at 16:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.