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'm creating a document where I want to leave white space of varying heights, e.g. for handwritten answers to questions.

It doesn't matter whether this empty space is bordered or not.

The key thing is that it needs to break across pages, so if I asked for a space of height 6in, but there was only 3in left on the page, I would get 3in on the first page and 3in on the next.

For instance I saw someone use this code here

\def\boxpar[#1]#2#3{{\setlength{\fboxsep}{-\fboxrule}\fbox{\parbox[][#2][t]{#1}{\mbox{}\\[-.125\baselineskip]\mbox{}~#3}}}}

\boxpar[\hsize]{6in}{}

which will create a bordered box 6in tall and the width of the page as required, but if there is not enough space on the first page it will move the whole thing to the next page.

share|improve this question
    
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Jubobs May 1 '13 at 8:20
add comment

3 Answers 3

up vote 8 down vote accepted

Just produce paragraphs, that don't disappear. In order to specify any dimension, just make many of them.

\documentclass{article}
\usepackage{lipsum}

\newcommand{\answerspace}[2][n]{%
  \par\smallskip
  \begingroup
  \if#1r\hrule\fi
  \baselineskip=\dimexpr#2/100\relax
  \lineskip=0pt \parindent=0pt
  \count255=0
  \loop\ifnum\count255<100
    \advance\count255 by 1
    \leavevmode\vbox to\baselineskip{}
    \if#1r\vrule\hfill\vrule\fi\endgraf
  \repeat
  \if#1r\hrule\fi
  \smallskip
  \endgroup
}

\begin{document}
\lipsum[1]

\answerspace[r]{2in}

\lipsum[2]

\answerspace{6in}

\lipsum[3]
\end{document}

With \answerspace[r]{<length>} rules are made.

enter image description here

share|improve this answer
    
Exactly what I was looking for and I appreciate the option to rule or not. –  James May 1 '13 at 11:28
add comment

Let try to answer the question using the package mdframed. (Github-version: https://github.com/marcodaniel/mdframed -- newer)

The provided command \boxpar has the following syntax:

\boxpar[<number of lines>]{Text}[<width of the box>]

You can the the number and the width are optional.

mdframed cant split across pages using a simple\vspace`. Therefor the loop is needed.

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}

\newcounter{tempcount}
\NewDocumentCommand \boxpar {  O{3} m O{\linewidth} }{%
 \begin{mdframed}[align=center,innertopmargin=.4cm,userdefinedwidth=#3]
     \setcounter{tempcount}{0}
     \loop\ifnum\value{tempcount}<#1
        \rule{0pt}{\baselineskip}\\[2pt]      
       \stepcounter{tempcount}
     \repeat
     \ifx\relax#2\relax\else#2\fi
  \end{mdframed}%
}
\begin{document}
\lipsum[1]

\boxpar{}

\lipsum[2]

\boxpar[10]{}[8cm]


\boxpar[6]{3 Points}[8cm]
\end{document}

enter image description here

If you want to modify the style of the frame you can do this by options of mdframed

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}
\mdfdefinestyle{boxpar}{linewidth=2pt,backgroundcolor=gray!10,roundcorner=10pt,}
\usepackage{lipsum}

\newcounter{tempcount}
\NewDocumentCommand \boxpar {  O{3} m O{\linewidth} }{%
 \begin{mdframed}[align=center,innertopmargin=.4cm,userdefinedwidth=#3,style=boxpar]
     \setcounter{tempcount}{0}
     \loop\ifnum\value{tempcount}<#1
        \rule{0pt}{\baselineskip}\\[2pt]      
       \stepcounter{tempcount}
     \repeat
     \ifx\relax#2\relax\else#2\fi
  \end{mdframed}%
}
\begin{document}
\lipsum[1]

\boxpar{}

\lipsum[2]

\boxpar[10]{}[8cm]


\boxpar[6]{3 Points}[8cm]
\end{document}

If you want horizontal lines you can use:

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}
\mdfdefinestyle{boxpar}{linewidth=2pt,backgroundcolor=gray!10,roundcorner=10pt,}
\usepackage{lipsum}

\newcounter{tempcount}
\NewDocumentCommand \boxpar {  O{3} m O{\linewidth} }{%
 \begin{mdframed}[align=center,innertopmargin=.4cm,userdefinedwidth=#3,style=boxpar]
     \setcounter{tempcount}{1}
     \loop\ifnum\value{tempcount}<\numexpr#1+1\relax
 %       \rule{0pt}{\baselineskip}\\[2pt]      
       \the\value{tempcount}\rule{\linewidth}{.8pt}\\[2pt]
       \stepcounter{tempcount}
     \repeat
     \ifx\relax#2\relax\else#2\fi
  \end{mdframed}%
}
\begin{document}
\lipsum[1]

\boxpar{}

\lipsum[2]

\boxpar[10]{}[8cm]


\boxpar[6]{3 Points}[8cm]
\end{document}

enter image description here


You can also add a title:

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}
\mdfdefinestyle{boxpar}{linewidth=2pt,backgroundcolor=gray!10,roundcorner=10pt,frametitle=Room for your answer,frametitlerule=true}
\usepackage{lipsum}

\newcounter{tempcount}
\NewDocumentCommand \boxpar {  O{3} m O{\linewidth} }{%
 \begin{mdframed}[align=center,innertopmargin=.4cm,userdefinedwidth=#3,style=boxpar]
    \setcounter{tempcount}{0}
     \loop\ifnum\value{tempcount}<#1
        \rule{0pt}{\baselineskip}\\[2pt]      
       \stepcounter{tempcount}
     \repeat
     \ifx\relax#2\relax\else#2\fi
  \end{mdframed}%
}
\begin{document}
\lipsum[1]

\boxpar{}

\lipsum[2]

\boxpar[5]{}[8cm]


\boxpar[6]{3 Points}[8cm]
\end{document}

enter image description here

share|improve this answer
    
Thanks for this answer as well, tried using mdframed earlier but struggled with it, so this is a helpful example for future reference! –  James May 1 '13 at 11:25
    
@James: If you have any trouble you can contact the author ;-) -- me ;-) –  Marco Daniel May 1 '13 at 11:32
add comment

enter image description here

Remove the \vrule\strut\hfill\vrule If you don't want the lines either side.

\documentclass{article}

\def\blanklines#1{%
\ifnum#1>0
\par\noindent\mbox{}\vrule\strut\hfill\vrule\par%
\expandafter\blanklines\expandafter{%
  \the\numexpr#1-1\expandafter\relax\expandafter}%
\fi
}

\begin{document}

stuff

more stuff\par more stuff\par more stuff\par more stuff\par more stuff\par


\blanklines{16}

more stuff\par more stuff\par more stuff\par more stuff\par more stuff\par

\blanklines{25}

more stuff\par more stuff\par more stuff\par more stuff\par more stuff\par

\end{document}
share|improve this answer
add comment

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.