Am 28.08.10 12:39, schrieb Cecil Westerhof:
I have (a long time ago) made the following .tex file: % christmasTree.tex: creates a to-do Christmas tree % Copyright 2009 Cecil Westerhof, Decebal Computing % You are free to use this code when you keep my copyright % This file should be processed with ConTeXt (texexec file)
\usemodule[defaults]
\setupoutput[pdf]
\setuplayout[header=0cm, footer=0.25cm]
\defineframed [action][width=5cm, height=3cm, offset=none] \defineframed [base] [width=3cm, height=2cm, offset=none, topframe=off]
\starttext
\setupheader[state=high]
\setupfootertexts[\hfill {\switchtobodyfont[6pt]\copyright Decebal Computing, http://www.decebal.nl} \hfill][] [][]
\setupalign[middle]\offinterlineskip
{\bold\switchtobodyfont[32pt]De taken kerstboom\switchtobodyfont[16pt]\blank}
\noindent\action[bottomframe=off]{}
\noindent\action[bottomframe=off, rightframe=off]{}% \action[bottomframe=off]{}
\noindent\dorecurse{2}{% \action[rightframe=off]{}% }% \action{}
\dorecurse{7}{ \noindent \base{}
}
\stoptext
It makes a 'Christmas tree' made of boxes. What I would like is to put some text, which are given as parameters, into the 13 boxes. But when a text does not fit into it's box, I do not want the PDF to be generated and receive an error code. Is this possible?
\setuplayout[header=0cm,footer=0.25cm] \defineframed [action] [width=5cm,height=3cm,offset=none,frameoffset=.5\linewidth] \defineframed [base] [width=3cm,height=2cm,offset=none,frameoffset=.5\linewidth] \setupfooter[style={\switchtobodyfont[6pt]}] \newcounter\treecounter \setvariables [tree] [1=One, 2=Two, 3=Three, 4=Four, 4={\switchtobodyfont[9pt]\input ward }, 5=Five, 6=Six, 7=Seven] \def\CheckBoxContent {\begingroup \setbox\scratchbox\vbox{\getvariable{tree}{\treecounter}}% \ifdim\ht\scratchbox>\vsize \forcequitjob{tree}% \else \box\scratchbox \fi \endgroup} \starttext \setupfootertexts[\copyright Decebal Computing, http://www.decebal.nl] \setupalign[middle]\offinterlineskip {\definedfont[Bold at 32pt]De taken kerstboom} \blank \dorecurse{3} {\noindent\dorecurse\recurselevel {\increment\treecounter \action{\CheckBoxContent}}\par} \dorecurse{7} {\increment\treecounter\noindent\base{\CheckBoxContent}\par} \stoptext Wolfgang