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? -- Cecil Westerhof M CLDWesterhof@gmail.com O< ascii ribbon campaign - stop html mail - www.asciiribbon.org Please do not send me Microsoft Office/Apple iWork documents. Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
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
Op zaterdag 28 aug 2010 16:20 CEST schreef Wolfgang Schuster:
\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]
Changed this to: \setvariables [tree] [1='Some very long text to try to get to much text for the box to fit in. There is a lot of room. Just some other text to finish it of. With this line added, there is to much text.', 2=Two, 3=Three, 4=Four, 5=Five, 6=Six, 7=Seven, 8=Eight, 9=Nine, 10=Ten, 11=Eleven, 12=Twelf, 13=Thirtheen ] That comes quit a bit to what I want. When I use this and then I execute: texexec --batchmode --purge --silent testTree.tex an error is signalled. When I remove the last sentence from the first parameter, it signals success. My only remaining problem is that I want to use parameters to input the values for the boxes. How would I do that?
\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
-- Cecil Westerhof M CLDWesterhof@gmail.com O< ascii ribbon campaign - stop html mail - www.asciiribbon.org Please do not send me Microsoft Office/Apple iWork documents. Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
Op zaterdag 28 aug 2010 16:20 CEST schreef Wolfgang Schuster:
\def\CheckBoxContent {\begingroup \setbox\scratchbox\vbox{\getvariable{tree}{\treecounter}}% \ifdim\ht\scratchbox>\vsize \forcequitjob{tree}% \else \box\scratchbox \fi \endgroup}
I have a solution for the parameters. I work with Linux, so I just could make a BASH script, which generates the tex file with the filled in parameters. There is only one problem left. I want to know what the (first) parameter which is wrong. I could determine the first wrong one with 4 new calls to texexec (starting with a call where only the first seven parameters are filled), but is there a way to give back a return value that signifies which parameter was wrong? I could not find documentation about \forcequitjob. Is there no documentation, or did I look wrong? -- Cecil Westerhof M CLDWesterhof@gmail.com O< ascii ribbon campaign - stop html mail - www.asciiribbon.org Please do not send me Microsoft Office/Apple iWork documents. Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
participants (2)
-
Cecil Westerhof
-
Wolfgang Schuster