ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* clutter with \start and \stop
@ 2012-07-03 22:51 Peter Münster
  2012-07-04  8:07 ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Münster @ 2012-07-03 22:51 UTC (permalink / raw)
  To: ConTeXt users

Hi,

Say I want Tufte in 2 columns and Knuth in 1 column:

--8<---------------cut here---------------start------------->8---
\starttext
\startcolumns[n=2]
  \startsection[title=Tufte]
    \input tufte
  \stopsection
  \startsection[title=Tufte and Knuth]
    \input tufte
\stopcolumns
    \input knuth  % \startcolumns[n=1] knuth \stopcolumns does not work
\startcolumns[n=2]
    \input tufte
  \stopsection
\stopcolumns
\stoptext
--8<---------------cut here---------------end--------------->8---

It works, but isn't this a bit ugly to mix up the \starts and \stops ?
In XML, that would be wrong.

Is this just the normal ConTeXt way, or is there a cleaner method?

TIA for any hints,
-- 
           Peter
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: clutter with \start and \stop
  2012-07-03 22:51 clutter with \start and \stop Peter Münster
@ 2012-07-04  8:07 ` Hans Hagen
  2012-07-04 20:29   ` Peter Münster
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2012-07-04  8:07 UTC (permalink / raw)
  To: ConTeXt users

On 4-7-2012 00:51, Peter Münster wrote:
> Hi,
>
> Say I want Tufte in 2 columns and Knuth in 1 column:
>
> --8<---------------cut here---------------start------------->8---
> \starttext
> \startcolumns[n=2]
>    \startsection[title=Tufte]
>      \input tufte
>    \stopsection
>    \startsection[title=Tufte and Knuth]
>      \input tufte
> \stopcolumns
>      \input knuth  % \startcolumns[n=1] knuth \stopcolumns does not work
> \startcolumns[n=2]
>      \input tufte
>    \stopsection
> \stopcolumns
> \stoptext
> --8<---------------cut here---------------end--------------->8---
>
> It works, but isn't this a bit ugly to mix up the \starts and \stops ?
> In XML, that would be wrong.
>
> Is this just the normal ConTeXt way, or is there a cleaner method?

no, mixing this way is asking for troubles, if not now, than maybe in 
the future

just use \section

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


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


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

* Re: clutter with \start and \stop
  2012-07-04  8:07 ` Hans Hagen
@ 2012-07-04 20:29   ` Peter Münster
  2012-07-04 21:49     ` Hans Hagen
  2012-07-04 22:44     ` Rogers, Michael K
  0 siblings, 2 replies; 11+ messages in thread
From: Peter Münster @ 2012-07-04 20:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, Jul 04 2012, Hans Hagen wrote:

> no, mixing this way is asking for troubles, if not now, than maybe in the
> future
>
> just use \section

Yes, but isn't \startsection the recommended method for the future and
needed for XML output?

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


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

* Re: clutter with \start and \stop
  2012-07-04 20:29   ` Peter Münster
@ 2012-07-04 21:49     ` Hans Hagen
  2012-07-04 22:44     ` Rogers, Michael K
  1 sibling, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2012-07-04 21:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 4-7-2012 22:29, Peter Münster wrote:
> On Wed, Jul 04 2012, Hans Hagen wrote:
>
>> no, mixing this way is asking for troubles, if not now, than maybe in the
>> future
>>
>> just use \section
>
> Yes, but isn't \startsection the recommended method for the future and
> needed for XML output?

Indeed, but there is no easy way out of this dilemma

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


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


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

* Re: clutter with \start and \stop
  2012-07-04 20:29   ` Peter Münster
  2012-07-04 21:49     ` Hans Hagen
@ 2012-07-04 22:44     ` Rogers, Michael K
  2012-07-05  4:42       ` Peter Münster
                         ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: Rogers, Michael K @ 2012-07-04 22:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Jul 4, 2012, at 1:29 PM, Peter Münster wrote:
> On Wed, Jul 04 2012, Hans Hagen wrote:
>
>> no, mixing this way is asking for troubles, if not now, than maybe in the
>> future
>>
>> just use \section
>
> Yes, but isn't \startsection the recommended method for the future and
> needed for XML output?

XML documents should form a tree, so a structure like

\startA % <A>
\startB % <B>
\stopA % </A>
\stopB % </B>

won't translate to XML.

Grouping in TeX follows the same restrictions, and \start... and \stop... behave like \begingroup and \endgroup.  The \stop... is supposed to restore the state before the corresponding \start... (at least I assume so -- \endgroup works that way).  One cannot stop A in the middle of B and return to the state before \startA without also stopping B.  So one should put \stopB before \stopA, not after it.

Have you considered structuring your example like this?:

\starttext
\startsection[title=Tufte]
\startcolumns[n=2]
\input tufte
\stopcolumns
\stopsection
\startsection[title=Tufte and Knuth]
\startcolumns[n=2]
\switchtobodyfont[big] % Note that the font size is switched back after \stopcolumns
\input tufte
\stopcolumns
\input knuth
\startcolumns[n=2]
\input tufte
\stopcolumns
\stopsection
\stoptext

XML seems a nice way for machines to deal with data.  But it's not a very human way to speak.  I mean, if I write "\section{One}...\section{Two}" isn't it obvious that section One ends when section Two begins?  Why should I have to write \endsection, when the machine can do the bookkeeping for me?  The start/stop mechanism is nice as an option, if you plan to produce an XML document from ConTeXt.  However the XML translator could implement 'if not first section then "</section><section>" else "<section>"' and add "if in_a_section then "</section>"' when \stoptext is reached.

________________________________

This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: clutter with \start and \stop
  2012-07-04 22:44     ` Rogers, Michael K
@ 2012-07-05  4:42       ` Peter Münster
  2012-07-05  5:42         ` Rogers, Michael K
  2012-07-05  5:56       ` luigi scarso
  2012-07-05  8:23       ` luigi scarso
  2 siblings, 1 reply; 11+ messages in thread
From: Peter Münster @ 2012-07-05  4:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Jul 05 2012, Rogers, Michael K wrote:

> Have you considered structuring your example like this?:

The output is not the same...

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


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

* Re: clutter with \start and \stop
  2012-07-05  4:42       ` Peter Münster
@ 2012-07-05  5:42         ` Rogers, Michael K
  0 siblings, 0 replies; 11+ messages in thread
From: Rogers, Michael K @ 2012-07-05  5:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Jul 4, 2012, at 9:42 PM, Peter Münster wrote:

> On Thu, Jul 05 2012, Rogers, Michael K wrote:
>
>> Have you considered structuring your example like this?:
>
> The output is not the same...

Sorry, I misunderstood.

________________________________

This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: clutter with \start and \stop
  2012-07-04 22:44     ` Rogers, Michael K
  2012-07-05  4:42       ` Peter Münster
@ 2012-07-05  5:56       ` luigi scarso
  2012-07-05  7:16         ` Rogers, Michael K
  2012-07-05  8:23       ` luigi scarso
  2 siblings, 1 reply; 11+ messages in thread
From: luigi scarso @ 2012-07-05  5:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

On Thu, Jul 5, 2012 at 12:44 AM, Rogers, Michael K <mroge02@emory.edu>wrote:

>
> XML seems a nice way for machines to deal with data.  But it's not a very
> human way to speak.  I mean, if I write "\section{One}...\section{Two}"
> isn't it obvious that section One ends when section Two begins?  Why should
> I have to write \endsection, when the machine can do the bookkeeping for
> me?  The start/stop mechanism is nice as an option, if you plan to produce
> an XML document from ConTeXt.  However the XML translator could implement
> 'if not first section then "</section><section>" else "<section>"' and add
> "if in_a_section then "</section>"' when \stoptext is reached.
>
> Hm, consider this
\section{One} \input knuth
Text
\section{Two} \input knuth
and
\startsection{One} \input knuth
\stopsection
Text
\startsection{Two} \input knuth
\stopsection

In the last one it's clear that Text is not in the section One  or in the
section Two: In the first one, Text is in section One ---  but how can I
put Text so that is not in section One and not in section Two ?
Most of the time section One  ends where section Two begins, but  it's
not true that *always* section One  ends where section Two begins :  infact
the last one is a legal example.



-- 
luigi

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

[-- Attachment #2: Type: text/plain, Size: 485 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: clutter with \start and \stop
  2012-07-05  5:56       ` luigi scarso
@ 2012-07-05  7:16         ` Rogers, Michael K
  0 siblings, 0 replies; 11+ messages in thread
From: Rogers, Michael K @ 2012-07-05  7:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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


On Jul 4, 2012, at 10:56 PM, luigi scarso wrote:
On Thu, Jul 5, 2012 at 12:44 AM, Rogers, Michael K <mroge02@emory.edu<mailto:mroge02@emory.edu>> wrote:

XML seems a nice way for machines to deal with data.  But it's not a very human way to speak.  I mean, if I write "\section{One}...\section{Two}" isn't it obvious that section One ends when section Two begins?  Why should I have to write \endsection, when the machine can do the bookkeeping for me?  The start/stop mechanism is nice as an option, if you plan to produce an XML document from ConTeXt.  However the XML translator could implement 'if not first section then "</section><section>" else "<section>"' and add "if in_a_section then "</section>"' when \stoptext is reached.

Hm, consider this
\section{One} \input knuth
Text
\section{Two} \input knuth
and
\startsection{One} \input knuth
\stopsection
Text
\startsection{Two} \input knuth
\stopsection

In the last one it's clear that Text is not in the section One  or in the section Two: In the first one, Text is in section One ---  but how can I put Text so that is not in section One and not in section Two ?
Most of the time section One  ends where section Two begins, but  it's not true that *always* section One  ends where section Two begins :  infact the last one is a legal example.

I agree.  When I said start/stop mechanisms are nice options, I had in mind they are useful, even indispensable, alternatives for certain sorts of structuring, as your example shows -- at the time of writing, I focused on XML.  I could equally say \section is a nice option.  Still, if I want to write a paper that consists of a sequence of sections, it's easier to just use \section, and an XML translator could be written to mark it up accordingly.
________________________________

This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).

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

[-- Attachment #2: Type: text/plain, Size: 485 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: clutter with \start and \stop
  2012-07-04 22:44     ` Rogers, Michael K
  2012-07-05  4:42       ` Peter Münster
  2012-07-05  5:56       ` luigi scarso
@ 2012-07-05  8:23       ` luigi scarso
  2012-07-05 13:40         ` Rogers, Michael K
  2 siblings, 1 reply; 11+ messages in thread
From: luigi scarso @ 2012-07-05  8:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

On Thu, Jul 5, 2012 at 12:44 AM, Rogers, Michael K <mroge02@emory.edu>wrote:

> On Jul 4, 2012, at 1:29 PM, Peter Münster wrote:
> > On Wed, Jul 04 2012, Hans Hagen wrote:
> >
> >> no, mixing this way is asking for troubles, if not now, than maybe in
> the
> >> future
> >>
> >> just use \section
> >
> > Yes, but isn't \startsection the recommended method for the future and
> > needed for XML output?
>
> XML documents should form a tree, so a structure like
>
> \startA % <A>
> \startB % <B>
> \stopA % </A>
> \stopB % </B>
>
> won't translate to XML.
>
> Grouping in TeX follows the same restrictions, and \start... and \stop...
> behave like \begingroup and \endgroup.  The \stop... is supposed to restore
> the state before the corresponding \start... (at least I assume so --
> \endgroup works that way).  One cannot stop A in the middle of B and return
> to the state before \startA without also stopping B.  So one should put
> \stopB before \stopA, not after it.
>
> It depends.

\starttext
\long\def\startA#1\stopA{<\low{A}#1>\low{A}}
\long\def\startB#1\stopB{<\low{B}#1>\low{B}}

\startA
textAA
\startB
textAB
\stopA
textBB
\stopB
\stoptext


is ok  (not the context way, btw: real code is more complex).


The meaning of this can be
content of \startA..\stopA = textAA ⋃ textAB
content of \startB..\stopB = textAB ⋃ textBB
\startA..\stopA ⋂  \startB..\stopB = textAB

If we are describing programs, textAB can be the common code between the
function A and B.



-- 
luigi

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

[-- Attachment #2: Type: text/plain, Size: 485 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: clutter with \start and \stop
  2012-07-05  8:23       ` luigi scarso
@ 2012-07-05 13:40         ` Rogers, Michael K
  0 siblings, 0 replies; 11+ messages in thread
From: Rogers, Michael K @ 2012-07-05 13:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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


On Jul 5, 2012, at 1:23 AM, luigi scarso wrote:
On Thu, Jul 5, 2012 at 12:44 AM, Rogers, Michael K <mroge02@emory.edu<mailto:mroge02@emory.edu>> wrote:
XML documents should form a tree, so a structure like

\startA % <A>
\startB % <B>
\stopA % </A>
\stopB % </B>

won't translate to XML.

Grouping in TeX follows the same restrictions, and \start... and \stop... behave like \begingroup and \endgroup.  The \stop... is supposed to restore the state before the corresponding \start... (at least I assume so -- \endgroup works that way).  One cannot stop A in the middle of B and return to the state before \startA without also stopping B.  So one should put \stopB before \stopA, not after it.

It depends.

\starttext
\long\def\startA#1\stopA{<\low{A}#1>\low{A}}
\long\def\startB#1\stopB{<\low{B}#1>\low{B}}

\startA
textAA
\startB
textAB
\stopA
textBB
\stopB
\stoptext


is ok  (not the context way, btw: real code is more complex).


The meaning of this can be
content of \startA..\stopA = textAA ⋃ textAB
content of \startB..\stopB = textAB ⋃ textBB
\startA..\stopA ⋂  \startB..\stopB = textAB

If we are describing programs, textAB can be the common code between the function A and B.



--
luigi

Again, I agree with what you write.  Somewhere I must have expressed myself poorly and I apologize.  It seems like a side issue (my issue with XML), and I did not mean to hijack the thread.  Sorry.

________________________________

This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).

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

[-- Attachment #2: Type: text/plain, Size: 485 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2012-07-05 13:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-03 22:51 clutter with \start and \stop Peter Münster
2012-07-04  8:07 ` Hans Hagen
2012-07-04 20:29   ` Peter Münster
2012-07-04 21:49     ` Hans Hagen
2012-07-04 22:44     ` Rogers, Michael K
2012-07-05  4:42       ` Peter Münster
2012-07-05  5:42         ` Rogers, Michael K
2012-07-05  5:56       ` luigi scarso
2012-07-05  7:16         ` Rogers, Michael K
2012-07-05  8:23       ` luigi scarso
2012-07-05 13:40         ` Rogers, Michael K

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