ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Fully object-oriented section
@ 2002-10-17 20:28 Giuseppe Bilotta
  2002-10-17 21:27 ` Giuseppe Bilotta
  0 siblings, 1 reply; 4+ messages in thread
From: Giuseppe Bilotta @ 2002-10-17 20:28 UTC (permalink / raw)


Hello,

I'd like to restart the thread about "object-orienting" section
commands. Availability of \startpart ... \stoppart, \startchapter
...\stopchapter (alongside the faster \part, \chapter ...
alternatives) becomes more and more a need for me. Having the
mechanism standardized in ConTeXt would be a great thing.

This is the way I'm implementing it by hand:

%D New structured sectioning

\newtoks\everybeforestartpart
\newtoks\everyafterstartpart
\newtoks\everystoppart
\def\startpart{\dosingleempty\dostartpart}
\def\dostartpart[#1]#2{%
  \bgroup\bgroup
    \the\everybeforestartpart
    \iffirstargument
       \part[#1]{#2}%
    \else
       \part{#2}%
    \fi
  \egroup
  \the\everyafterstartpart
}
\def\stoppart{\the\everystoppart\egroup}


Using this snippet as the kernel and simply changing "part" to
whatever other sectioning level is needed is enough to allow full
customization of the sectioning levels. Can this be put in
ConTeXt?

-- 
Giuseppe "Oblomov" Bilotta

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


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

* Re: [NTG-context] Fully object-oriented section
  2002-10-17 20:28 [NTG-context] Fully object-oriented section Giuseppe Bilotta
@ 2002-10-17 21:27 ` Giuseppe Bilotta
  2002-10-18 18:44   ` Simon Pepping
  0 siblings, 1 reply; 4+ messages in thread
From: Giuseppe Bilotta @ 2002-10-17 21:27 UTC (permalink / raw)
  Cc: ntg-context


Thursday, October 17, 2002 Giuseppe Bilotta wrote:

GB> %D New structured sectioning

GB> \newtoks\everybeforestartpart
GB> \newtoks\everyafterstartpart
GB> \newtoks\everystoppart
GB> \def\startpart{\dosingleempty\dostartpart}
GB> \def\dostartpart[#1]#2{%
GB>   \bgroup\bgroup
GB>     \the\everybeforestartpart
GB>     \iffirstargument
GB>        \part[#1]{#2}%
GB>     \else
GB>        \part{#2}%
GB>     \fi
GB>   \egroup
GB>   \the\everyafterstartpart
GB> }
GB> \def\stoppart{\the\everystoppart\egroup}

Sorry for following up to myself. After a few tries, I discovered
that it's much better without the inner grouping:

\newtoks\everybeforestartpart
\newtoks\everyafterstartpart
\newtoks\everystoppart
\def\startpart{\dosingleempty\dostartpart}
\def\dostartpart[#1]#2{%
  \bgroup
    \the\everybeforestartpart
    \iffirstargument
       \part[#1]{#2}%
    \else
       \part{#2}%
    \fi
  \egroup
  \the\everyafterstartpart
}
\def\stoppart{\the\everystoppart}

-- 
Giuseppe "Oblomov" Bilotta

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


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

* Re: [NTG-context] Fully object-oriented section
  2002-10-17 21:27 ` Giuseppe Bilotta
@ 2002-10-18 18:44   ` Simon Pepping
  2002-10-18 18:55     ` Re[2]: " Giuseppe Bilotta
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Pepping @ 2002-10-18 18:44 UTC (permalink / raw)


On Thu, Oct 17, 2002 at 11:27:14PM +0200, Giuseppe Bilotta wrote:
> 
> Sorry for following up to myself. After a few tries, I discovered
> that it's much better without the inner grouping:
> 
> \newtoks\everybeforestartpart
> \newtoks\everyafterstartpart
> \newtoks\everystoppart
> \def\startpart{\dosingleempty\dostartpart}
> \def\dostartpart[#1]#2{%
>   \bgroup
>     \the\everybeforestartpart
>     \iffirstargument
>        \part[#1]{#2}%
>     \else
>        \part{#2}%
>     \fi
>   \egroup
>   \the\everyafterstartpart
> }
> \def\stoppart{\the\everystoppart}

This is without the outer grouping. I think the outer grouping is
necessary; when I use \start \stop commands I expect them to make a
group.

Could not you do without the if statement?

\def\dostartpart[#1]#2{%
  \bgroup
    \the\everybeforestartpart
    \part[#1]{#2}%
    \the\everyafterstartpart
}
\def\stoppart{\the\everystoppart\egroup}


-- 
Simon Pepping
email: spepping@scaprea.hobby.nl

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


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

* Re[2]: [NTG-context] Fully object-oriented section
  2002-10-18 18:44   ` Simon Pepping
@ 2002-10-18 18:55     ` Giuseppe Bilotta
  0 siblings, 0 replies; 4+ messages in thread
From: Giuseppe Bilotta @ 2002-10-18 18:55 UTC (permalink / raw)
  Cc: ntg-context


Friday, October 18, 2002 Simon Pepping wrote:

SP> This is without the outer grouping. I think the outer grouping is
SP> necessary; when I use \start \stop commands I expect them to make a
SP> group.

Right indeed.

SP> Could not you do without the if statement?

SP> \def\dostartpart[#1]#2{%
SP>   \bgroup
SP>     \the\everybeforestartpart
SP>     \part[#1]{#2}%
SP>     \the\everyafterstartpart
SP> }
SP> \def\stoppart{\the\everystoppart\egroup}

I'm not sure if this works. I've had problems with some arguments
which behave differently depending on whether the argumet is not
there or is empty, so I prefer to keep on the safe side.

-- 
Giuseppe "Oblomov" Bilotta

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


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

end of thread, other threads:[~2002-10-18 18:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-17 20:28 [NTG-context] Fully object-oriented section Giuseppe Bilotta
2002-10-17 21:27 ` Giuseppe Bilotta
2002-10-18 18:44   ` Simon Pepping
2002-10-18 18:55     ` Re[2]: " Giuseppe Bilotta

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