\startsection ...\stopsection alias for \section?
Hi, would it make sense to have, in addtion to e.g. \section a start..stop pair? such as \startsection{my section name} \stopsection with something like \let\startsection\section \let\stopsection\relax This way the text would be slightly more structured. Patrick (or is it in the core already?) -- ConTeXt wiki and more: http://contextgarden.net
On Fri, 30 Mar 2007, Patrick Gundlach wrote:
Hi,
would it make sense to have, in addtion to e.g. \section a start..stop pair?
such as
\startsection{my section name}
\stopsection
with something like \let\startsection\section \let\stopsection\relax
This way the text would be slightly more structured.
I would prefer something error checking in \stopsection etc to catch nesting errors. I have been biten once too many times with mismatched \(start|stop)(components|project|product|environments) to have the same experience with sections ;) Aditya
On Tue, 10 Apr 2007 08:29:56 -0600, Aditya Mahajan
On Fri, 30 Mar 2007, Patrick Gundlach wrote:
Hi,
would it make sense to have, in addtion to e.g. \section a start..stop pair?
such as
\startsection{my section name}
\stopsection
with something like \let\startsection\section \let\stopsection\relax
This way the text would be slightly more structured.
For now: ===================== \def\startchapter[#1]#2% {\getparameters[Chapter][#1]\chapter{#2}} \def\stopchapter{} \def\startsection[#1]#2% {\getparameters[Section][#1]\section{#2}} \def\stopsection{} \def\startsubsection[#1]#2% {\getparameters[Subsection][#1]\subsection{#2}} \def\stopsubsection{} \def\startfootnote[#1]#2% {\getparameters[Footnote][#1]\footnote\bgroup#2} \def\stopfootnote{\egroup{}} ===================== All based on a note from Taco; I don't really know how it works... The footnote one needs a % at the end of the preceding line, don't know how to gobble it: text.% \startfootnote[] note. \stopfootnote{} text Further: I now use fake start-stops in my environments/preambles. In conjunction with an editor that can handle TeX-syntax folding, they area really good organizing tools. So I have a file startstops.tex with totally naive things like ======================= \let\startENV=\relax \let\stopENV=\relax \let\startLET=\relax \let\stopLET=\relax \let\startFONTS=\relax \let\stopFONTS=\relax \let\startLISTS=\relax \let\stopLISTS=\relax \let\startPAPER=\relax \let\stopPAPER=\relax \let\startTITLE=\relax \let\stopTITLE=\relax \let\startLAYOUT=\relax \let\stopLAYOUT=\relax \let\startBIBLIO=\relax \let\stopBIBLIO=\relax \let\startALIASES=\relax \let\stopALIASES=\relax \let\startSTRUCTURE=\relax \let\stopSTRUCTURE=\relax \let\startSTARTSTOPS=\relax \let\stopSTARTSTOPS=\relax \let\startDESCRIPTIONS=\relax \let\stopDESCRIPTIONS=\relax \let\startINTERACTIONS=\relax \let\stopINTERACTIONS=\relax ======================= Syntax-folding makes things soooo much easier and efficient. Best Idris -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523 -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
On Fri, 13 Apr 2007 16:11:53 -0600
"Idris Samawi Hamid"
On Tue, 10 Apr 2007 08:29:56 -0600, Aditya Mahajan
wrote: On Fri, 30 Mar 2007, Patrick Gundlach wrote:
Hi,
would it make sense to have, in addtion to e.g. \section a start..stop pair?
such as
\startsection{my section name}
\stopsection
with something like \let\startsection\section \let\stopsection\relax
This way the text would be slightly more structured.
For now:
===================== \def\startchapter[#1]#2% {\getparameters[Chapter][#1]\chapter{#2}} \def\stopchapter{}
\def\startsection[#1]#2% {\getparameters[Section][#1]\section{#2}} \def\stopsection{}
\def\startsubsection[#1]#2% {\getparameters[Subsection][#1]\subsection{#2}} \def\stopsubsection{}
Hi, you can avoid all these definition by changing the \definisection commands in core-sec. YOu nedd only a few extra lines at the end from the \dododefinehead macro. Just add: \setvalue{\e!start#1}##1[##2]% {\getparameters[\??se\??se#1][\c!ref=,\c!title=,##2]% \getvalue{#1}[\getvalue{\??se\??se#1\c!ref}]{\getvalue{\??se\?? se#1\c!title}}}% \setvalue{\e!stop#1}{\relax} for Tacos version. \startsetion[ref=...,title=...] ... \stopsection or add: \setvalue{\e!start#1}{\getvalue{#1}}% \setvalue{\e!stop#1}{\relax} for Patricks version. \startsection[reference]{title} ... \stopsection
\def\startfootnote[#1]#2% {\getparameters[Footnote][#1]\footnote\bgroup#2} \def\stopfootnote{\egroup{}} =====================
\def\startfootnote[#1]#2\stopfootnote {\footnote[#1]{#2}} We need something in core-not that creates start/stop commands for everything defined with \definenote. It is not as easy as extending the section commands.
All based on a note from Taco; I don't really know how it works...
The footnote one needs a % at the end of the preceding line, don't know how to gobble it:
text.% \startfootnote[] note. \stopfootnote{} text
Further: I now use fake start-stops in my environments/preambles. In conjunction with an editor that can handle TeX-syntax folding, they area really good organizing tools. So I have a file startstops.tex with totally naive things like
======================= \let\startENV=\relax \let\stopENV=\relax \let\startLET=\relax \let\stopLET=\relax \let\startFONTS=\relax \let\stopFONTS=\relax \let\startLISTS=\relax \let\stopLISTS=\relax \let\startPAPER=\relax \let\stopPAPER=\relax \let\startTITLE=\relax \let\stopTITLE=\relax \let\startLAYOUT=\relax \let\stopLAYOUT=\relax \let\startBIBLIO=\relax \let\stopBIBLIO=\relax \let\startALIASES=\relax \let\stopALIASES=\relax \let\startSTRUCTURE=\relax \let\stopSTRUCTURE=\relax \let\startSTARTSTOPS=\relax \let\stopSTARTSTOPS=\relax \let\startDESCRIPTIONS=\relax \let\stopDESCRIPTIONS=\relax \let\startINTERACTIONS=\relax \let\stopINTERACTIONS=\relax =======================
Syntax-folding makes things soooo much easier and efficient.
Best Idris
Gruß Wolfgang
Hi,
Thanks for the wonderful guidance! See below:
On Sat, 14 Apr 2007 07:34:59 -0600, Wolfgang Schuster
Just add:
\setvalue{\e!start#1}##1[##2]% {\getparameters[\??se\??se#1][\c!ref=,\c!title=,##2]% \getvalue{#1}[\getvalue{\??se\??se#1\c!ref}]{\getvalue{\??se\?? se#1\c!title}}}% \setvalue{\e!stop#1}{\relax}
\startsetion[ref=...,title=...] ... \stopsection
for Tacos version.
I did a \unprotect-\protect macro with just the \dododefinehead macro. ============= \starttext \startchapter[ref=,title=Chapter]{Test} text \stopchapter \stoptext ============= which gives the error ============= ! Parameters must be numbered consecutively. <to be read again> ## l.133 \setvalue{\e!start#1}## 1[##2]% ? =============
or add:
\setvalue{\e!start#1}{\getvalue{#1}}% \setvalue{\e!stop#1}{\relax}
for Patricks version.
\startsection[reference]{title} ... \stopsection
\def\startfootnote[#1]#2% {\getparameters[Footnote][#1]\footnote\bgroup#2} \def\stopfootnote{\egroup{}} =====================
\def\startfootnote[#1]#2\stopfootnote {\footnote[#1]{#2}}
Wow, I did not know that you could define two commands with one \def (TeXBook, p. 219)
We need something in core-not that creates start/stop commands for everything defined with \definenote. It is not as easy as extending the section commands.
In the above definition the square brackets [] are mandatory even if the argument is empty, viz \startfootnote[] text \stopfootnote Is there a way to make it optional, as with \footnote itself? Thank you again, Wolfgang! Best Idris -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523 -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
On Sat, 14 Apr 2007 10:45:21 -0600
"Idris Samawi Hamid"
Hi,
Thanks for the wonderful guidance! See below:
On Sat, 14 Apr 2007 07:34:59 -0600, Wolfgang Schuster
wrote: Just add:
\setvalue{\e!start#1}##1[##2]% {\getparameters[\??se\??se#1][\c!ref=,\c!title=,##2]% \getvalue{#1}[\getvalue{\??se\??se#1\c!ref}]{\getvalue{\??se\?? se#1\c!title}}}% \setvalue{\e!stop#1}{\relax}
\startsetion[ref=...,title=...] ... \stopsection
for Tacos version.
I did a \unprotect-\protect macro with just the \dododefinehead macro.
============= \starttext
\startchapter[ref=,title=Chapter]{Test}
text
\stopchapter
\stoptext =============
which gives the error
============= ! Parameters must be numbered consecutively. <to be read again> ## l.133 \setvalue{\e!start#1}## 1[##2]%
Hi Idris, you have to make the change in core-sec.tex, id is not possible to redefine them within a local file, because the section commands are when you make the format files.
? =============
or add:
\setvalue{\e!start#1}{\getvalue{#1}}% \setvalue{\e!stop#1}{\relax}
for Patricks version.
\startsection[reference]{title} ... \stopsection
\def\startfootnote[#1]#2% {\getparameters[Footnote][#1]\footnote\bgroup#2} \def\stopfootnote{\egroup{}} =====================
\def\startfootnote[#1]#2\stopfootnote {\footnote[#1]{#2}}
Wow, I did not know that you could define two commands with one \def (TeXBook, p. 219)
Not realy two commands, only a delimiter that tells TeX to read everything from \startfoonote till \stopfootnote, you can use it also as prevent eating the following space, e.g., \def\TEX/{\TEX} Text \TEX/ text \bye
We need something in core-not that creates start/stop commands for everything defined with \definenote. It is not as easy as extending the section commands.
In the above definition the square brackets [] are mandatory even if the argument is empty, viz
\startfootnote[] text \stopfootnote
Is there a way to make it optional, as with \footnote itself?
I will send you a patched core-sec and core-not offlist, because they are to big for the list.
Thank you again, Wolfgang!
Best Idris
Wolfgang
On Fri, 30 Mar 2007, Patrick Gundlach wrote:
Hi,
would it make sense to have, in addtion to e.g. \section a start..stop pair?
such as
\startsection{my section name}
\stopsection
with something like \let\startsection\section \let\stopsection\relax
This way the text would be slightly more structured.
Another interesting way is to use start-stop sections is as specified by rfc2629 [1]: \startsection is nestable, so that you can have \startsection {first section} \startsection {first subsection} \stopsection \startsection {second subsection} \stopsection \stopsection which makes it easy to move things around, promote demote section levels, etc. [1] http://www.rfc-editor.org/rfc/rfc2629.txt which is a decent xml dtd for simple documents. Also see http://xml.resource.org/authoring/draft-mrose-writing-rfcs.html Aditya
[...]
Another interesting way is to use start-stop sections is as specified by rfc2629 [1]: \startsection is nestable, so that you can have
\startsection {first section}
\startsection {first subsection}
\stopsection
\startsection {second subsection}
\stopsection
\stopsection
which makes it easy to move things around, promote demote section levels, etc.
That would be really, really nice! Patrick -- ConTeXt wiki and more: http://contextgarden.net
participants (4)
-
Aditya Mahajan
-
Idris Samawi Hamid
-
Patrick Gundlach
-
Wolfgang Schuster