ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Filling boxes
@ 2010-08-28 10:39 Cecil Westerhof
  2010-08-28 14:20 ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Cecil Westerhof @ 2010-08-28 10:39 UTC (permalink / raw)
  To: NTG ConTeXt mailing list

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/
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Filling boxes
  2010-08-28 10:39 Filling boxes Cecil Westerhof
@ 2010-08-28 14:20 ` Wolfgang Schuster
  2010-08-30 15:02   ` Cecil Westerhof
  2010-08-31  7:34   ` Cecil Westerhof
  0 siblings, 2 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2010-08-28 14:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Filling boxes
  2010-08-28 14:20 ` Wolfgang Schuster
@ 2010-08-30 15:02   ` Cecil Westerhof
  2010-08-31  7:34   ` Cecil Westerhof
  1 sibling, 0 replies; 4+ messages in thread
From: Cecil Westerhof @ 2010-08-30 15:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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/
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Filling boxes
  2010-08-28 14:20 ` Wolfgang Schuster
  2010-08-30 15:02   ` Cecil Westerhof
@ 2010-08-31  7:34   ` Cecil Westerhof
  1 sibling, 0 replies; 4+ messages in thread
From: Cecil Westerhof @ 2010-08-31  7:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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/
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-31  7:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-28 10:39 Filling boxes Cecil Westerhof
2010-08-28 14:20 ` Wolfgang Schuster
2010-08-30 15:02   ` Cecil Westerhof
2010-08-31  7:34   ` Cecil Westerhof

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).