ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \showgrid question
@ 2006-10-15 21:22 Marcus Vinicius Mesquita de So
  2006-10-16 18:20 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Marcus Vinicius Mesquita de So @ 2006-10-15 21:22 UTC (permalink / raw)



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

Hi!

Is there an option for the \showgrid command for showing only the line numbers (no lines) ?

Marcus Vinicius




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

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: \showgrid question
  2006-10-15 21:22 \showgrid question Marcus Vinicius Mesquita de So
@ 2006-10-16 18:20 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2006-10-16 18:20 UTC (permalink / raw)


Marcus Vinicius Mesquita de So wrote:
> Hi!
>
> Is there an option for the \showgrid command for showing only the line 
> numbers (no lines) ?
no, but it's easy to add that option, 

put this in cont-new.tex (after \unprotect) 

\chardef\gridboxlinenomode\plusone
\chardef\gridboxlinemode  \plusone % 0:nothing 1:all 2:lines 3:frame

\def\gridboxvbox {\ifcase\gridboxlinemode\vbox\or\ruledvbox\or\vbox\or\ruledvbox\else\ruledvbox\fi}
\def\gridboxwidth{\ifcase\gridboxlinemode0\or.5\or.5\or0\else.5\fi\testrulewidth}

\def\setgridbox#1#2#3%
  {\setbox#1\gridboxvbox to #3 % given size
     {\forgetall
      \resetteststrut
      \offinterlineskip
      \hsize#2%
      \baselinerulefalse
      \gridboxvbox % calculated size
        {\getrawnoflines{#3}% \getnoflines{#3}%
         \vskip\topskip
         \vskip-\strutht
         \scratchdimen#2\advance\scratchdimen \lineheight
         \dorecurse\noflines
           {\strut
            \hskip-.5\lineheight
            \ifcase\gridboxlinenomode\or
              \rlap
                {\hskip.2\bodyfontsize\hskip\scratchdimen
                 \infofont\hbox to 1em{\hss\recurselevel}}%
            \or
              \llap
                {\infofont\hbox to 1em{\hss\recurselevel}%
                 \hskip.2\bodyfontsize}%
            \fi
            \vrule
              \!!height \gridboxwidth
              \!!depth  \gridboxwidth
              \!!width  \scratchdimen
            \par}}
      \vfill}}

\def\doshowgrid[#1]%
  {\chardef\showgridstate    \plusone % downward compatible default
   \chardef\gridboxlinemode  \plusone
   \chardef\gridboxlinenomode\plusone
   \processallactionsinset
     [#1]%
     [ \v!reset=>\chardef\showgridstate    \zerocount,
      \v!bottom=>\chardef\showgridstate    \plusone,
         \v!top=>\chardef\showgridstate    \plustwo,
        \v!none=>\chardef\gridboxlinemode  \zerocount,
         \v!all=>\chardef\gridboxlinemode  \plusone,
       \v!lines=>\chardef\gridboxlinemode  \plustwo,
       \v!frame=>\chardef\gridboxlinemode  \plusthree,
    \v!nonumber=>\chardef\gridboxlinenomode\zerocount,
       \v!right=>\chardef\gridboxlinenomode\plusone,
        \v!left=>\chardef\gridboxlinenomode\plustwo]}


now you can use keywords, like

\showgrid[lines.left]

\input tufte


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

end of thread, other threads:[~2006-10-16 18:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-15 21:22 \showgrid question Marcus Vinicius Mesquita de So
2006-10-16 18:20 ` Hans Hagen

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