ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: need help with creating a grid with context
@ 2007-10-10  1:06 MASON Peter J
  2007-10-10 10:08 ` Mojca Miklavec
  0 siblings, 1 reply; 9+ messages in thread
From: MASON Peter J @ 2007-10-10  1:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 952 bytes --]

Perhaps I ought to tell what I'm expecting :-) ...
 
Hope to create a regular (1cm spacing) grid on page, of bullets. Ultimately over the whole page.
 
The context code supplied produces successive rows with an offset to the right.
 
Have I missed something obvious?

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.

[-- Attachment #1.2: Type: text/html, Size: 2018 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: need help with creating a grid with context
  2007-10-10  1:06 need help with creating a grid with context MASON Peter J
@ 2007-10-10 10:08 ` Mojca Miklavec
  2007-10-10 13:02   ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Mojca Miklavec @ 2007-10-10 10:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 10/10/07, MASON Peter J wrote:

> Hope to create a regular (1cm spacing) grid on page, of bullets. Ultimately
> over the whole page.

Why not using MetaPost?

\starttext
\startMPcode % or \startMPpage
for i=0 upto 10:
   for j=0 upto 20:
      fill fullcircle scaled 1mm shifted ((i,j) scaled 1cm);
   endfor;
endfor;
\stopMPcode
\stoptext

Mojca
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: need help with creating a grid with context
  2007-10-10 10:08 ` Mojca Miklavec
@ 2007-10-10 13:02   ` Wolfgang Schuster
  2007-10-10 19:33     ` Mojca Miklavec
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2007-10-10 13:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/10/10, Mojca Miklavec <mojca.miklavec.lists@gmail.com>:
> On 10/10/07, MASON Peter J wrote:
>
> > Hope to create a regular (1cm spacing) grid on page, of bullets. Ultimately
> > over the whole page.
>
> Why not using MetaPost?
>
> \starttext
> \startMPcode % or \startMPpage
> for i=0 upto 10:
>   for j=0 upto 20:
>      fill fullcircle scaled 1mm shifted ((i,j) scaled 1cm);
>   endfor;
> endfor;
> \stopMPcode
> \stoptext
>
> Mojca

Because TeX is faster in this situation and it takes more time to write
the Metapost code in external file, process this file, convert it into a PDF
file and include it into the document etc.

I know what I say because this was one of the reasons why the sgf module
place the field within TeX and not with Metapost, a matter of speed and you
can reuse the objects.

You should also replace the fullcircle with drawdot in your example, drawdot
renders better on screen and looks better.

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: need help with creating a grid with context
  2007-10-10 13:02   ` Wolfgang Schuster
@ 2007-10-10 19:33     ` Mojca Miklavec
  2007-10-11  7:43       ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Mojca Miklavec @ 2007-10-10 19:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 10/10/07, Wolfgang Schuster wrote:
> 2007/10/10, Mojca Miklavec:
> > On 10/10/07, MASON Peter J wrote:
> >
> > > Hope to create a regular (1cm spacing) grid on page, of bullets. Ultimately
> > > over the whole page.
> >
> > Why not using MetaPost?
> >
> > \starttext
> > \startMPcode % or \startMPpage
> > for i=0 upto 10:
> >   for j=0 upto 20:
> >      fill fullcircle scaled 1mm shifted ((i,j) scaled 1cm);
> >   endfor;
> > endfor;
> > \stopMPcode
> > \stoptext
> >
> > Mojca
>
> Because TeX is faster in this situation and it takes more time to write
> the Metapost code in external file, process this file, convert it into a PDF
> file and include it into the document etc.
>
> I know what I say because this was one of the reasons why the sgf module
> place the field within TeX and not with Metapost, a matter of speed and you
> can reuse the objects.

OK, that's a good point, and I fully agree with it. It's only that I
would probably use something like that for really simple, short,
one-page documents, where I would be concerned about the speed I need
to come to a solution, not with the speed of document processing -
half a second more or less.

With the route tex -> .plt file -> gnuplot -> tex (metafun) ->
metapost (-> mpto or \sometxt) -> pdf, which I frequently use, the
situation is much much worse, but it's still acceptable. ConTeXt
became at least 10 times faster during the last three or four years.
(Or at least that's my impression.)

> You should also replace the fullcircle with drawdot in your example, drawdot
> renders better on screen and looks better.

Thanks. I always use fill fullcircle for some reason. Perhaps I should
changle my habit :)

Mojca
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: need help with creating a grid with context
  2007-10-10 19:33     ` Mojca Miklavec
@ 2007-10-11  7:43       ` Wolfgang Schuster
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Schuster @ 2007-10-11  7:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/10/10, Mojca Miklavec <mojca.miklavec.lists@gmail.com>:
> On 10/10/07, Wolfgang Schuster wrote:
> > 2007/10/10, Mojca Miklavec:
> > > On 10/10/07, MASON Peter J wrote:
> > >
> > > > Hope to create a regular (1cm spacing) grid on page, of bullets. Ultimately
> > > > over the whole page.
> > >
> > > Why not using MetaPost?
> > >
> > > \starttext
> > > \startMPcode % or \startMPpage
> > > for i=0 upto 10:
> > >   for j=0 upto 20:
> > >      fill fullcircle scaled 1mm shifted ((i,j) scaled 1cm);
> > >   endfor;
> > > endfor;
> > > \stopMPcode
> > > \stoptext
> > >
> > > Mojca
> >
> > Because TeX is faster in this situation and it takes more time to write
> > the Metapost code in external file, process this file, convert it into a PDF
> > file and include it into the document etc.
> >
> > I know what I say because this was one of the reasons why the sgf module
> > place the field within TeX and not with Metapost, a matter of speed and you
> > can reuse the objects.
>
> OK, that's a good point, and I fully agree with it. It's only that I
> would probably use something like that for really simple, short,
> one-page documents, where I would be concerned about the speed I need
> to come to a solution, not with the speed of document processing -
> half a second more or less.

This was in my case also a one page document but I created over hundret
full page graphics (needed for fieldstacks) and it is a real problem in this
case, the other problem for this solution was, I had to pass dozen graphic
position to Metapost and it was easier to do the whole work within TeX and
use Metapost only to create the needed graphics one and reuse them.

> With the route tex -> .plt file -> gnuplot -> tex (metafun) ->
> metapost (-> mpto or \sometxt) -> pdf, which I frequently use, the
> situation is much much worse, but it's still acceptable. ConTeXt
> became at least 10 times faster during the last three or four years.
> (Or at least that's my impression.)

I don't use gnuplot and I think a lua driven Tikz should solve this in
the future,
calculate the graphs with lua definition and draw the graphics with TeX macros.

> > You should also replace the fullcircle with drawdot in your example, drawdot
> > renders better on screen and looks better.
>
> Thanks. I always use fill fullcircle for some reason. Perhaps I should
> changle my habit :)

Sorry, my fault. What I meant was the difference between draw point and
drawpoint point where the first should be replaced in this situation with the
later, fullcircle produce nice circles and Donald Knuth took care about this.

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: need help with creating a grid with context
  2007-10-10  8:54 ` Peter Rolf
@ 2007-10-11  7:27   ` Wolfgang Schuster
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Schuster @ 2007-10-11  7:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/10/10, Peter Rolf <indiego@gmx.net>:
> 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

Hi,

there is smarter and better solution than loop for doing this work,
you can use leaders. I prefer myself xledaers in this example (alternative b).

\defineoverlay[PageGrid][\PageGrid]

\setupbackgrounds[page][background=PageGrid,offset=5mm]

\starttext

% alternative a:

\def\PageGrid
  {\setbox\scratchbox\hbox to\dimexpr\paperwidth-1cm\relax
     {\leaders\hbox to 1cm{\hss$\bullet$\hss}\hfill}%
   \vbox to\dimexpr\paperheight-1cm\relax
     {\leaders\vbox to 1cm{\vss\box\scratchbox\vss}\vfill}}

\page[empty]

% alternative b:

\def\PageGrid
  {\setbox\scratchbox\hbox to\dimexpr\paperwidth-1cm\relax
     {\xleaders\hbox to 1cm{\hss$\bullet$\hss}\hfill}%
   \vbox to\dimexpr\paperheight-1cm\relax
     {\xleaders\vbox to 1cm{\vss\box\scratchbox\vss}\vfill}}

\page[empty]

% alternative c:

\def\PageGrid
  {\setbox\scratchbox\hbox to\dimexpr\paperwidth-1cm\relax
     {\cleaders\hbox to 1cm{\hss$\bullet$\hss}\hfill}%
   \vbox to\dimexpr\paperheight-1cm\relax
     {\cleaders\vbox to 1cm{\vss\box\scratchbox\vss}\vfill}}

\page[empty]

\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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: need help with creating a grid with context
@ 2007-10-10 23:33 MASON Peter J
  0 siblings, 0 replies; 9+ messages in thread
From: MASON Peter J @ 2007-10-10 23:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

>You introduce "spurious spaces" (line break sometimes adds a space) in
> you loops. See ...

Yes, you're right. A programmer, I tend to think that white space is
always good for readability. Thanks for that tip.

But I DO like the \dorecurse(...) version better. I didn't know of this
macro.

I couldn't survive context with this list! Thanks very much.

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@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
___________________________________________________________________________________


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

* Re: need help with creating a grid with context
  2007-10-09 23:42 MASON Peter J
@ 2007-10-10  8:54 ` Peter Rolf
  2007-10-11  7:27   ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Rolf @ 2007-10-10  8:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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@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
> ___________________________________________________________________________________

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* need help with creating a grid with context
@ 2007-10-09 23:42 MASON Peter J
  2007-10-10  8:54 ` Peter Rolf
  0 siblings, 1 reply; 9+ messages in thread
From: MASON Peter J @ 2007-10-09 23:42 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1416 bytes --]

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


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.

[-- Attachment #1.2: Type: text/html, Size: 4533 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2007-10-11  7:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-10  1:06 need help with creating a grid with context MASON Peter J
2007-10-10 10:08 ` Mojca Miklavec
2007-10-10 13:02   ` Wolfgang Schuster
2007-10-10 19:33     ` Mojca Miklavec
2007-10-11  7:43       ` Wolfgang Schuster
  -- strict thread matches above, loose matches on Subject: below --
2007-10-10 23:33 MASON Peter J
2007-10-09 23:42 MASON Peter J
2007-10-10  8:54 ` Peter Rolf
2007-10-11  7:27   ` Wolfgang Schuster

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).