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 learned of the samepage environment based from this link Unbreakable block so i tried it on my case but i think this isn't what I am looking for. My problem is: with the exam class, i have created a test question true or false. The questions would rather continue to the next page without knowing the exact number of questions that is only allowed. These should not be the case. What I want is, a command that will prevent question continuation to the next page and pops out an error notification that the question will break. Is there any suggested variables which should i include in my command.

Code

\documentclass{exam}

\newcounter{tfno}
\renewcommand\arraystretch{2}
\newcommand{\nbox}{\resizebox{.5cm}{!}{\raisebox{-.5ex}{$\Box$}}}

\newenvironment{truefalse}{%
\setcounter{tfno}{0}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\begin{longtable}{>{\stepcounter{tfno}\thetfno.}cp{.5   
\textwidth}@{\extracolsep{\fill}}cc}
\multicolumn{1}{r}{}&  & \fbox{\parbox{.75cm}{True}} & \fbox{\parbox{.75cm}   
{False}}    \\
}{%
\end{longtable} 
}
\newcommand\tfquestion[1]{ & #1 & \nbox  & \nbox  \\}

\begin{document}
\begin{truefalse}
\tfquestion{Is this the first question?}
\tfquestion{2nd question}
\tfquestion{this series of questions for the true or false, if it reach the  
 nextpage, the command should prevent it.}
  \end{document}

this is an example image:

enter image description here

As you can see the next page was the continuation of the question. What should I do to prevent this. I'd rather be favor of making a command for this error but i dont know how. pls help.. :(

share|improve this question

closed as too localized by Marco Daniel, Claudio Fiandrino, Andrew Swann, Stefan Kottwitz Mar 3 '13 at 14:22

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
It seems that the whole question doesn't fit in a page, so what do you propose? –  egreg Feb 18 '13 at 13:29
    
if the question doesn't fit on one page, so the command would notify that the question will not be allowed to proceed to the next page. –  Kayla Feb 18 '13 at 13:46
2  
Hand checking/tweaking required anyway... Smaller interline spacing? Wider margins? Less space between text and the check boxes? Reword some alternatives (or the question) to make them shorter? Designing such a test is a lot of work, and just cutting off stuff for visual layout would be my very last option. –  vonbrand Feb 18 '13 at 17:20
2  
@Kayla minipage does that because this is what TeX does. Once something doesn't fit on "this page", it is typeset on "next page", no matter whether it does fit or not. And you are notified, by a warning in the .log file and in the compilation log: Overfull \vbox (<spill-length>pt too high) has occurred while \output is active [<page number>], where <spill-length> tells how much too large it is (1 line is 12--14pt) and <page-number> is a number of the page where it happened. –  tohecz Feb 19 '13 at 14:25
3  
TeX is a machine, it does what you say it to do. And if you say it to do something impossible (fit 40 cm in 25 cm), it goes a bit crazy. –  tohecz Feb 19 '13 at 14:36

Browse other questions tagged or ask your own question.