[NTG-context] need help with creating a grid with context

Peter Rolf indiego at gmx.net
Wed Oct 10 10:54:19 CEST 2007


Hi Peter,

MASON Peter J schrieb:
> I'm trying to layout a grid of bullets. The results isn't the expected
> one. Perhaps someone could offer help here? Thanks.
> 
> Here's the sort of thing I'm doing ....
> 
> \setuplayout[leftmargin=0pt, leftmargindistance=0pt, backspace=0pt,
> rightmargin=0pt, rightmargindistance=0pt, cutspace=0pt, width=middle,
> topspace=0pt, header=0pt, headerdistance=0pt, footer=0pt,
> footerdistance=0pt, bottomspace=0pt, height=middle]
> 
> %\showlayout
> 
> \starttext
> \setuppositioning[unit=cm]
> \startpositioning
>         \newcount\Row
> 
>         \Row    = 0
>         \loop
>                 {
                   ^^
>                         \newcount\Col
> 
 ^^
>                         \Col = 0
>                         \loop
>                                 \position(\Col, \Row) {$\bullet$}
>                                 \ifnum\Col < 14
>                                         \advance\Col by 1
>                         \repeat
>                 }
                   ^^
>                 \ifnum\Row < 36
>                         \advance\Row by 1
>         \repeat
> \stoppositioning
> \stoptext
>
You introduce "spurious spaces" (line break sometimes adds a space) in
you loops. See

http://tug.ctan.org/tex-archive/info/texbytopic/

if you want to learn more about it.


\starttext
\setuppositioning[unit=cm]
\startpositioning
\newcount\Row
\newcount\Col

\Row=0
\dorecurse{36}
  {\Col=0
   \dorecurse{14}
     {\position(\Col,\Row){$\bullet$}
      \advance\Col by 1
     }%
   \advance\Row by 1
  }
\stoppositioning
\stoptext


Remove the comment sign behind the inner loop and see what happens.

Also see

http://wiki.contextgarden.net/System_Macros/Loops_and_Recursion

for the nicer ConTeXt loop macros.


Best wishes, Peter

>  
> 
> Before printing, please consider the environment.
> 
> IMPORTANT NOTICE: This e-mail and any attachment to it are intended only
> to be read or used by the named addressee. It is confidential and may
> contain legally privileged information. No confidentiality or privilege
> is waived or lost by any mistaken transmission to you. The RTA is not
> responsible for any unauthorised alterations to this e-mail or
> attachment to it. Views expressed in this message are those of the
> individual sender, and are not necessarily the views of the RTA. If you
> receive this e-mail in error, please immediately delete it from your
> system and notify the sender. You must not disclose, copy or use any
> part of this e-mail if you are not the intended recipient.
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________



More information about the ntg-context mailing list