6

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}
7

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

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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