ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Enumerating paragraphs
@ 2000-09-19 11:16 Guy Worthington
  2000-09-19 13:39 ` Ed L Cashin
  2000-09-19 14:31 ` Hans Hagen
  0 siblings, 2 replies; 8+ messages in thread
From: Guy Worthington @ 2000-09-19 11:16 UTC (permalink / raw)


How do I number paragraphs (similar to the format used when
typesetting a module)?  I've had an unsuccessful attempt at
it (below).

\newcount\paragraphno    % enumerate paragraphs
\def\paragraph#1\par{\advance\paragraphno by 1
    \llap{\sl \the\paragraphno\kern1pc}#1\par}%  number to left of text

\setupbodyfont[ber,10pt]
\setupwhitespace[big]

\starttext

\section[sec-language]{How this Book Teaches You The Language}

\paragraph Java is an object oriented programming language.  When you
use an object oriented programming language, your program consists of
class definitions.

\stoptext


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

* Re: Enumerating paragraphs
  2000-09-19 11:16 Enumerating paragraphs Guy Worthington
@ 2000-09-19 13:39 ` Ed L Cashin
  2000-09-19 14:36   ` Hans Hagen
  2000-09-19 14:31 ` Hans Hagen
  1 sibling, 1 reply; 8+ messages in thread
From: Ed L Cashin @ 2000-09-19 13:39 UTC (permalink / raw)
  Cc: Context

Guy Worthington <guyw@multiline.com.au> writes:

> How do I number paragraphs (similar to the format used when
> typesetting a module)?  I've had an unsuccessful attempt at
> it (below).

There's a section in the beginner's manual on paragraph formatting.
There may be a cleaner way to do it, but here's an example based on
the ones in the beginner's manual:

  \newcount\paragraphno
  \paragraphno=1
  \defineparagraphs	[guypara][n=2,before={\blank},after={\blank}]
  \setupparagraphs	[guypara][1][width=.1\textwidth,style=bold]
  \def\GuyPar#1{\startguypara
          \the\paragraphno
          \global\advance\paragraphno by 1
          \guypara#1\stopguypara}

  \starttext
  \GuyPar{This is the first paragraph.}
  \GuyPar{This is the second paragraph.}
  \GuyPar{Three!!!  Three paragraphs!!!  Ah -- ah -- ah -- ahh!!!.}
  \stoptext

-- 
--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


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

* Re: Enumerating paragraphs
  2000-09-19 11:16 Enumerating paragraphs Guy Worthington
  2000-09-19 13:39 ` Ed L Cashin
@ 2000-09-19 14:31 ` Hans Hagen
  1 sibling, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2000-09-19 14:31 UTC (permalink / raw)
  Cc: Context

At 07:16 PM 9/19/00 +0800, Guy Worthington wrote:

>\newcount\paragraphno    % enumerate paragraphs
>\def\paragraph#1\par{\advance\paragraphno by 1
>    \llap{\sl \the\paragraphno\kern1pc}#1\par}%  number to left of text
>
>\setupbodyfont[ber,10pt]
>\setupwhitespace[big]
>
>\starttext
>
>\section[sec-language]{How this Book Teaches You The Language}
>
>\paragraph Java is an object oriented programming language.  When you
>use an object oriented programming language, your program consists of
>class definitions.
>
>\stoptext

\newcounter\ParNum

\def\paragraph{\doglobal\increment\ParNum\inleft{\ParNum}}

So, \inleft \inleftmargin \margintitle are the commands to use since they
also honor the margindistance and so. You can even say: 

\margintitle{\NextPar} 

some text 

with \def\NextPar{\doglobal\increment\ParNum\ParNum}

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: Enumerating paragraphs
  2000-09-19 13:39 ` Ed L Cashin
@ 2000-09-19 14:36   ` Hans Hagen
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2000-09-19 14:36 UTC (permalink / raw)
  Cc: Guy Worthington, Context

At 09:39 AM 9/19/00 -0400, Ed L Cashin wrote:
>Guy Worthington <guyw@multiline.com.au> writes:
>
>> How do I number paragraphs (similar to the format used when
>> typesetting a module)?  I've had an unsuccessful attempt at
>> it (below).
>
>There's a section in the beginner's manual on paragraph formatting.
>There may be a cleaner way to do it, but here's an example based on
>the ones in the beginner's manual:
>
>  \newcount\paragraphno
>  \paragraphno=1
>  \defineparagraphs	[guypara][n=2,before={\blank},after={\blank}]
>  \setupparagraphs	[guypara][1][width=.1\textwidth,style=bold]
>  \def\GuyPar#1{\startguypara
>          \the\paragraphno
>          \global\advance\paragraphno by 1
>          \guypara#1\stopguypara}
>  
>  \starttext
>  \GuyPar{This is the first paragraph.}
>  \GuyPar{This is the second paragraph.}
>  \GuyPar{Three!!!  Three paragraphs!!!  Ah -- ah -- ah -- ahh!!!.}
>  \stoptext

btw, if you're talking about not too large paragrapgs, you may consider
using the \startnumbering mechanism which supports line and para numbering. 

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: enumerating paragraphs
  2001-11-11 12:27 ` Patrick Gundlach
@ 2001-11-12  9:29   ` Hans Hagen
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2001-11-12  9:29 UTC (permalink / raw)
  Cc: ntg-context

At 01:27 PM 11/11/2001 +0100, Patrick Gundlach wrote:
>Hi!
>
> > How can I enumerate paragraphs? They should simply look like
> >
> > (1) sometext
> > for this para.
> >
> > (2) and some
> > for this
> > para
> >
> > (X) ...
> > ....
>
>Is this something you want?
>\starttext
>\defineconversion[map][(\numbers]
>\startitemize[map,intext][stopper=)]
>\item \input tufte
>\item \input tufte
>\item \input tufte
>\stopitemize
>\stoptext
>
>Patrick, who is getting closer every day to become a MOI (master of itemize)

then, how about: \setupparagraphnumbering[state=start]

Hans

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: enumerating paragraphs
  2001-11-09 18:06 enumerating paragraphs Mathias.Picker
@ 2001-11-11 12:27 ` Patrick Gundlach
  2001-11-12  9:29   ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Patrick Gundlach @ 2001-11-11 12:27 UTC (permalink / raw)


Hi!

> How can I enumerate paragraphs? They should simply look like
>
> (1) sometext
> for this para.
>
> (2) and some
> for this
> para
>
> (X) ...
> ....

Is this something you want?
\starttext
\defineconversion[map][(\numbers]
\startitemize[map,intext][stopper=)]
\item \input tufte
\item \input tufte
\item \input tufte
\stopitemize
\stoptext

Patrick, who is getting closer every day to become a MOI (master of itemize)


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

* enumerating paragraphs
@ 2001-11-09 18:06 Mathias.Picker
  2001-11-11 12:27 ` Patrick Gundlach
  0 siblings, 1 reply; 8+ messages in thread
From: Mathias.Picker @ 2001-11-09 18:06 UTC (permalink / raw)


How can I enumerate paragraphs? They should simply look like

(1) sometext
for this para.

(2) and some
for this
para

(X) ...
...

?? I tried to play with the itemize setups, but got nowhere. Any hints?

Thanks, Mathias
-- 
                            virtual earth
 Mathias Picker
 Geschäftsführer      Gesellschaft für Wissens re/prä sentation mbH

                            Mathias.Picker@virtual-earth.de 
			    Fon +49 89  / 540 7425-1
                            Fax +49 89  / 540 7425-9


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

* Re: Enumerating paragraphs
@ 2000-09-20  2:31 Guy Worthington
  0 siblings, 0 replies; 8+ messages in thread
From: Guy Worthington @ 2000-09-20  2:31 UTC (permalink / raw)


Thanks Ed L Cashin for your solution.  I had read section 12
in the beginner's manual but it takes an especially devious mind to
invent a wrapper macro around the paragraph formatting macro.  Your
reference to the Count was much more obvious (I guess I watch too much
Sesame St.).

Thanks Hans Hagen for your reply.  I'm continually amazed at what
you've packed into ConTeXt, the \inleft command is exactly what I
want.


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

end of thread, other threads:[~2001-11-12  9:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-19 11:16 Enumerating paragraphs Guy Worthington
2000-09-19 13:39 ` Ed L Cashin
2000-09-19 14:36   ` Hans Hagen
2000-09-19 14:31 ` Hans Hagen
2000-09-20  2:31 Guy Worthington
2001-11-09 18:06 enumerating paragraphs Mathias.Picker
2001-11-11 12:27 ` Patrick Gundlach
2001-11-12  9:29   ` 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).