Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Hans Hagen via ntg-context

On 12/24/2021 5:45 PM, Jason Ross via ntg-context wrote:

Dear list,

Is it possible to set the maximum table of contents depth to a number 
rather than providing an explicit list of section names?



Background:

I am developing an exporter for Org mode. In Org, users can specify the 
number of levels they want in the table of contents with a number. I 
currently do this by having the sectioning commands be known to the 
exporter so I can generate a command like

     \setupcombinedlist
   [content]
   [list={section,subsection}]
for n=2.

I'm considering using  \start/stopsectionlevel for sectioning commands 
instead. That way, users could add \definesectionlevels to the document 
preamble to use whatever sectioning scheme they wanted. However, this 
would mean that the exporter wouldn't know what sectioning commands to 
use the TOC setup.
given the amount of reactions i added a simple levels feature ... the 
best i can do for now is:


\placelist[chapter,section,subsection][levels=2]

keep in mind that all should work with the already present selective 
placement and filtering (criterium)


uploaded

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Bruce Horrocks via ntg-context


> On 24 Dec 2021, at 16:45, Jason Ross via ntg-context  
> wrote:
> 
> Dear list,
> 
> Is it possible to set the maximum table of contents depth to a number rather 
> than providing an explicit list of section names?
> 
> 
> Background:
> 
> I am developing an exporter for Org mode. In Org, users can specify the 
> number of levels they want in the table of contents with a number. I 
> currently do this by having the sectioning commands be known to the exporter 
> so I can generate a command like
>\setupcombinedlist
>  [content]
>  [list={section,subsection}]
> for n=2.
> 
> I'm considering using  \start/stopsectionlevel for sectioning commands 
> instead. That way, users could add \definesectionlevels to the document 
> preamble to use whatever sectioning scheme they wanted. However, this would 
> mean that the exporter wouldn't know what sectioning commands to use the TOC 
> setup.

Can you not specify a full list of sections in your exporter code and then 
truncate that list to the appropriate value of n before generating the ConTeXt 
source from the truncated list?

Assuming you are using an Emacs macro to do the export then the following code 
will return the first 2 from the list of section types:

(let ((list '("part" "chapter" "section" "subsection" "subsubsection" 
"subsubsubsection" "subsubsubsubsection")))
  (butlast list (- (length list) 2)))

I stole that from StackOverflow so I'll leave it to you work out how to get 
your depth variable substituted for the 2. :-)

Note that you probably don't want "part" but I include it for completeness. 
Best to start with "chapter".
—
Bruce Horrocks
Hampshire, UK

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Jason Ross via ntg-context

On 12/24/21 1:48 PM, Denis Maier via ntg-context wrote:

Anyway, I agree that a solution via hierarchy levels would be nice.


That's what I'm hoping to achieve. I'm not familiar enough with 
low-level ConTeXt to do something like this but it seems like it ought 
to be possible.



You don't do that. If you provide default a default sectionlevel 
scheme, you'll know what toc:2 means.
If a user uses a different scheme provided via 
#+Context_Section_Levels you can use that to adjust the meaning of 
toc:2. But if a user uses the default setting toc:2 should be fine. 
Does that make sense?


I understand. The issue I see is that this introduces a coupling between 
section structure and table of contents that could be confusing for 
users, and also makes the interface more complicated by adding another 
keyword.


I am trying to take advantage of the flexibility of ConTeXt for most of 
the configuration, because a user is more likely to be familiar with 
ConTeXt than with my specific elisp module.



Jason
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Denis Maier via ntg-context


 
 
  
   Anyway, I agree that a solution via hierarchy levels would be nice.
   
  
  
   
Denis Maier via ntg-context  hat am 24.12.2021 22:43 geschrieben:
   
   

   
   

   
   

   
   

 Jason Ross  hat am 24.12.2021 22:37 geschrieben:


 


 


 On 12/24/21 1:29 PM, Denis Maier wrote:


 


 
  I probably wasn't clear. You will support toc:2.
 
 
  This:
 
 
  #+Context_Section_Levels: '(chapter section subsection)
 
 
  will translate into a definesectionlevels command and inform your
 
 
  exporter about the used sectionlevels. Once the used commands are known
 
 
  it should be possible to map toc:2 to a combinedlist definition.
 


 I can't require the user to use more document keywords to get the same


 functionality they already have with the other exporters by default.

   
   
You don't do that. If you provide default a default sectionlevel scheme, you'll know what toc:2 means. 

   
   
If a user uses a different scheme provided via #+Context_Section_Levels you can use that to adjust the meaning of toc:2. But if a user uses the default setting toc:2 should be fine. Does that make sense? 

   
   

   
   
Denis 

   
   

 


 I am really specifically looking for a way _in ConTeXt_ to create a


 table of contents with depth `n` regardless of the sectioning used.


 


 Jason

   
  
 

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Denis Maier via ntg-context


 
 
  
   
  
  
   
Jason Ross  hat am 24.12.2021 22:37 geschrieben:
   
   

   
   

   
   
On 12/24/21 1:29 PM, Denis Maier wrote:
   
   

   
   

 I probably wasn't clear. You will support toc:2.


 This:


 #+Context_Section_Levels: '(chapter section subsection)


 will translate into a definesectionlevels command and inform your


 exporter about the used sectionlevels. Once the used commands are known


 it should be possible to map toc:2 to a combinedlist definition.

   
   
I can't require the user to use more document keywords to get the same
   
   
functionality they already have with the other exporters by default.
   
  
  
   You don't do that. If you provide default a default sectionlevel scheme, you'll know what toc:2 means.
   
  
  
   If a user uses a different scheme provided via #+Context_Section_Levels you can use that to adjust the meaning of toc:2. But if a user uses the default setting toc:2 should be fine. Does that make sense?
   
  
  
   
  
  
   Denis
   
  
  
   
   
I am really specifically looking for a way _in ConTeXt_ to create a
   
   
table of contents with depth `n` regardless of the sectioning used.
   
   

   
   
Jason
   
  
 

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Jason Ross via ntg-context



On 12/24/21 1:29 PM, Denis Maier wrote:


I probably wasn't clear. You will support toc:2.
This:
#+Context_Section_Levels: '(chapter section subsection)
will translate into a definesectionlevels command and inform your 
exporter about the used sectionlevels. Once the used commands are known 
it should be possible to map toc:2 to a combinedlist definition.


I can't require the user to use more document keywords to get the same 
functionality they already have with the other exporters by default.


I am really specifically looking for a way _in ConTeXt_ to create a 
table of contents with depth `n` regardless of the sectioning used.


Jason
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Denis Maier via ntg-context


 
 
  
   
  
  
   
Jason Ross via ntg-context  hat am 24.12.2021 22:22 geschrieben:
   
   

   
   

   
   
On 12/24/21 1:20 PM, Denis Maier via ntg-context wrote:
   
   

   
   
>>
   
   
>> I see.
   
   
>>
   
   
>> Next try: add a new option
   
   
>>
   
   
>> "#+Context_Section_Levels:
   
   
>>
   
   
>> Thus will take an alist. Now you'll know about the user defined
   
   
>> structure levels and the toc option can be translated to the
   
   
>> corresponding setting. (Here again, you can if course define
   
   
>> reasonable defaults.)
   
   

 


 Actually,  you don't need an alist. A simple quotes list should be enough:


 


 #+Context_Section_Levels: '(chapter section subsection)


 >


 
  Denis
 

   
   

   
   

   
   
That isn't going to work. The interface needs to be the same as for the
   
   
other exporters for TOC control. I need to support "toc:2".
   
   
  
  
   I probably wasn't clear. You will support toc:2. 
   
  
  
   This:
   
  
  
   #+Context_Section_Levels: '(chapter section subsection)
  
  
   will translate into a definesectionlevels command and inform your exporter about the used sectionlevels. Once the used commands are known it should be possible to map toc:2 to a combinedlist definition.
   
  
  
   
Jason
   
   
___
   
   
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://context.aanhet.net

   
   
archive : https://bitbucket.org/phg/context-mirror/commits/

   
   
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Jason Ross via ntg-context



On 12/24/21 1:20 PM, Denis Maier via ntg-context wrote:



I see.

Next try: add a new option

"#+Context_Section_Levels:

Thus will take an alist. Now you'll know about the user defined 
structure levels and the toc option can be translated to the 
corresponding setting. (Here again, you can if course define 
reasonable defaults.)


Actually,  you don't need an alist. A simple quotes list should be enough:

#+Context_Section_Levels: '(chapter section subsection)


Denis



That isn't going to work. The interface needs to be the same as for the 
other exporters for TOC control. I need to support "toc:2".


Jason
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Denis Maier via ntg-context


 
 
  
   
  
  
   
Denis Maier via ntg-context  hat am 24.12.2021 22:13 geschrieben:
   
   

   
   

   
   

   
   

 Jason Ross via ntg-context  hat am 24.12.2021 18:53 geschrieben:


 


 


 On 12/24/21 9:49 AM, Denis Maier via ntg-context wrote:


 
  For the six = for the toc...
 
 
  
   Denis Maier via ntg-context  hat am 24.12.2021
  
  
   18:42 geschrieben:
  
  
   
  
  
   
  
  
   Can't you just define a default structurelevel scheme and a default
  
  
   combined list for the six. If a user redefines the structure level
  
  
   scheme, they will just redefine the combined list as well. Would that
  
  
   work?
  
  
   
  
  
   Denis
  
 


 


 The way the user specifies TOC depth in Org is e.g. "#+OPTIONS: toc:2".


 All exporters support that method.

   
   

   
   
I see. 

   
   

   
   
Next try: add a new option 

   
   

   
   
"#+Context_Section_Levels:
   
   

   
   
Thus will take an alist. Now you'll know about the user defined structure levels and the toc option can be translated to the corresponding setting. (Here again, you can if course define reasonable defaults.)
   
  
  
   
  
  
   Actually,  you don't need an alist. A simple quotes list should be enough:
   
  
  
   
  
  
   #+Context_Section_Levels: '(chapter section subsection) 
   
  
  

   
   

   
   
Denis 

   
   

 


 Jason


 ___


 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://context.aanhet.net 
 


 archive : https://bitbucket.org/phg/context-mirror/commits/ 
 


 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Denis Maier via ntg-context


 
 
  
   
  
  
   
Jason Ross via ntg-context  hat am 24.12.2021 18:53 geschrieben:
   
   

   
   

   
   
On 12/24/21 9:49 AM, Denis Maier via ntg-context wrote:
   
   

 For the six = for the toc...


 
  Denis Maier via ntg-context  hat am 24.12.2021
 
 
  18:42 geschrieben:
 
 
  
 
 
  
 
 
  Can't you just define a default structurelevel scheme and a default
 
 
  combined list for the six. If a user redefines the structure level
 
 
  scheme, they will just redefine the combined list as well. Would that
 
 
  work?
 
 
  
 
 
  Denis
 

   
   

   
   
The way the user specifies TOC depth in Org is e.g. "#+OPTIONS: toc:2".
   
   
All exporters support that method.
   
  
  
   
  
  
   I see.
   
  
  
   
  
  
   Next try: add a new option 
   
  
  
   
  
  
   "#+Context_Section_Levels:
  
  
   
  
  
   Thus will take an alist. Now you'll know about the user defined structure levels and the toc option can be translated to the corresponding setting. (Here again, you can if course define reasonable defaults.)
   
  
  
   
  
  
   Denis
   
  
  
   
   
Jason
   
   
___
   
   
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://context.aanhet.net

   
   
archive : https://bitbucket.org/phg/context-mirror/commits/

   
   
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Jason Ross via ntg-context



On 12/24/21 9:49 AM, Denis Maier via ntg-context wrote:

For the six = for the toc...
Denis Maier via ntg-context  hat am 24.12.2021 
18:42 geschrieben:



Can't you just define a default structurelevel scheme and a default 
combined list for the six. If a user redefines the structure level 
scheme, they will just redefine the combined list as well. Would that 
work?


Denis


The way the user specifies TOC depth in Org is e.g. "#+OPTIONS: toc:2". 
All exporters support that method.


Jason
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Denis Maier via ntg-context


 
 
  
   For the six = for the toc...
   
  
  
   
Denis Maier via ntg-context  hat am 24.12.2021 18:42 geschrieben:
   
   

   
   

   
   
Can't you just define a default structurelevel scheme and a default combined list for the six. If a user redefines the structure level scheme, they will just redefine the combined list as well. Would that work? 

   
   

   
   
Denis 

   
   

 Jason Ross via ntg-context  hat am 24.12.2021 17:45 geschrieben:


 


 


 Dear list,


 


 Is it possible to set the maximum table of contents depth to a number


 rather than providing an explicit list of section names?


 


 


 Background:


 


 I am developing an exporter for Org mode. In Org, users can specify the


 number of levels they want in the table of contents with a number. I


 currently do this by having the sectioning commands be known to the


 exporter so I can generate a command like


 \setupcombinedlist


 [content]


 [list={section,subsection}]


 for n=2.


 


 I'm considering using \start/stopsectionlevel for sectioning commands


 instead. That way, users could add \definesectionlevels to the document


 preamble to use whatever sectioning scheme they wanted. However, this


 would mean that the exporter wouldn't know what sectioning commands to


 use the TOC setup.


 


 


 Thanks,


 


 Jason


 ___


 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://context.aanhet.net 
 


 archive : https://bitbucket.org/phg/context-mirror/commits/ 
 


 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting table of contents depth by number rather than by list

2021-12-24 Thread Denis Maier via ntg-context


 
 
  
   Can't you just define a default structurelevel scheme and a default combined list for the six. If a user redefines the structure level scheme, they will just redefine the combined list as well. Would that work?
   
  
  
   
  
  
   Denis
   
  
  
   
Jason Ross via ntg-context  hat am 24.12.2021 17:45 geschrieben:
   
   

   
   

   
   
Dear list,
   
   

   
   
Is it possible to set the maximum table of contents depth to a number
   
   
rather than providing an explicit list of section names?
   
   

   
   

   
   
Background:
   
   

   
   
I am developing an exporter for Org mode. In Org, users can specify the
   
   
number of levels they want in the table of contents with a number. I
   
   
currently do this by having the sectioning commands be known to the
   
   
exporter so I can generate a command like
   
   
\setupcombinedlist
   
   
[content]
   
   
[list={section,subsection}]
   
   
for n=2.
   
   

   
   
I'm considering using \start/stopsectionlevel for sectioning commands
   
   
instead. That way, users could add \definesectionlevels to the document
   
   
preamble to use whatever sectioning scheme they wanted. However, this
   
   
would mean that the exporter wouldn't know what sectioning commands to
   
   
use the TOC setup.
   
   

   
   

   
   
Thanks,
   
   

   
   
Jason
   
   
___
   
   
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://context.aanhet.net

   
   
archive : https://bitbucket.org/phg/context-mirror/commits/

   
   
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___