Re: [NTG-context] toc and macro

2015-05-28 Thread Harry
What I want to do is something like this:

___

\starttext

  \completecontent[criterium=all]

  % how i have to do it
  \startchapter[colors][Colors]
\startsection,[black][Black]
  black is a dark color
\stopsection,
\startsection[white][White]
  white is light color
\stopsection
  \stopchapter
 
  % how i want it to write (with the same result of the code above)
  \startSameCommand[colors][Colors]
\startSameCommand[black][Black]
  black is a dark color
\stopSameCommand
\startSameCommand[white][White]
  white is light color
\stopSameCommand
  \stopSameCommand

\stoptext

___

The \startSameCommand finds itself out (by the nesting of the command)
if its behave
 as  \startpart or \startchapter or \startsection or \startsubsection or
\startsubsubsection ...

Harry

Am 28.05.2015 um 12:47 schrieb Wolfgang Schuster:
 Am 27.05.2015 um 20:13 schrieb Harry irgk...@gmx.de:

 Hi,

 I hope that this is the right address to post my question. If not I
 would be glad for a tip.

 I wanted to do something like this:

 ___

 \unprotect

 %This line uncommented leads to an error
 \def\tit{Oops!}

 \def\Teil{\dodoubleempty\doTeil}
 \def\doTeil[#1][#2]#3{%
  \def\tit{#1}
 %...
  \startchapter[title={\tit},reference={#2}]
#3
  \stopchapter
 %...
 }


 \protect

 \starttext

  \completecontent

  \doTeil[Hallo][hallo]{Text Text Text Text Text Text Text}
 Why do you \doTeil and not not \Teil?

 \stoptext

 ___

 It works if i use #1 direct (like this):
  \startchapter[title=#1,reference={#2}]
 But how can I wrap it in the \tit?
 (wrapping #2 works fine)

 I wanted to programm \doTeil so, that I can nest it freely (for example
 with \input) and the table of content uses the hierarchy of the nesting
 to produce a nice TOC.
 Is there a reason why you can use use \chapter[reference][title] in your 
 document,
 I can’t see any advantage with your command.

 Wolfgang
 ___
 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
 ___

___
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
___

Re: [NTG-context] toc and macro

2015-05-28 Thread Wolfgang Schuster

 Am 28.05.2015 um 23:08 schrieb Harry irgk...@gmx.de:
 
 What I want to do is something like this:
 
 ___
 
 \starttext
 
  \completecontent[criterium=all]
 
  % how i have to do it
  \startchapter[colors][Colors]
\startsection,[black][Black]
  black is a dark color
\stopsection,
\startsection[white][White]
  white is light color
\stopsection
  \stopchapter
 
  % how i want it to write (with the same result of the code above)
  \startSameCommand[colors][Colors]
\startSameCommand[black][Black]
  black is a dark color
\stopSameCommand
\startSameCommand[white][White]
  white is light color
\stopSameCommand
  \stopSameCommand
 
 \stoptext
 
 ___
 
 The \startSameCommand finds itself out (by the nesting of the command)
 if its behave
 as  \startpart or \startchapter or \startsection or \startsubsection or
 \startsubsubsection …


You’re looking for the \startsectionlevel command.

%\definesectionlevels[default][part,chapter,section,subsection]

\starttext

\completecontent[criterium=all]

\startsectionlevel[title=Colors,reference=colors]

\startsectionlevel[title=Black,reference=black]
black is a dark color
\stopsectionlevel

\startsectionlevel[title=White,reference=white]
white is light color
\stopsectionlevel

\stopsectionlevel

\stoptext

Wolfgang
___
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
___

[NTG-context] toc and macro

2015-05-28 Thread Harry
Hi,

I hope that this is the right address to post my question. If not I
would be glad for a tip.

I wanted to do something like this:

___

\unprotect

%This line uncommented leads to an error
\def\tit{Oops!}

\def\Teil{\dodoubleempty\doTeil}
\def\doTeil[#1][#2]#3{%
  \def\tit{#1}
%...
  \startchapter[title={\tit},reference={#2}]
#3
  \stopchapter
%...
}


\protect

\starttext

  \completecontent

  \doTeil[Hallo][hallo]{Text Text Text Text Text Text Text}

\stoptext

___

It works if i use #1 direct (like this):
  \startchapter[title=#1,reference={#2}]
But how can I wrap it in the \tit?
(wrapping #2 works fine)

I wanted to programm \doTeil so, that I can nest it freely (for example
with \input) and the table of content uses the hierarchy of the nesting
to produce a nice TOC.

thanks for help.

Sincerely, Harry
___
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
___

Re: [NTG-context] toc and macro

2015-05-28 Thread Wolfgang Schuster

 Am 27.05.2015 um 20:13 schrieb Harry irgk...@gmx.de:
 
 Hi,
 
 I hope that this is the right address to post my question. If not I
 would be glad for a tip.
 
 I wanted to do something like this:
 
 ___
 
 \unprotect
 
 %This line uncommented leads to an error
 \def\tit{Oops!}
 
 \def\Teil{\dodoubleempty\doTeil}
 \def\doTeil[#1][#2]#3{%
  \def\tit{#1}
 %...
  \startchapter[title={\tit},reference={#2}]
#3
  \stopchapter
 %...
 }
 
 
 \protect
 
 \starttext
 
  \completecontent
 
  \doTeil[Hallo][hallo]{Text Text Text Text Text Text Text}

Why do you \doTeil and not not \Teil?

 \stoptext
 
 ___
 
 It works if i use #1 direct (like this):
  \startchapter[title=#1,reference={#2}]
 But how can I wrap it in the \tit?
 (wrapping #2 works fine)
 
 I wanted to programm \doTeil so, that I can nest it freely (for example
 with \input) and the table of content uses the hierarchy of the nesting
 to produce a nice TOC.

Is there a reason why you can use use \chapter[reference][title] in your 
document,
I can’t see any advantage with your command.

Wolfgang
___
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
___