ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* counter reseting at every heading
@ 2012-05-18 13:00 Peter Schorsch
  2012-05-18 15:41 ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Schorsch @ 2012-05-18 13:00 UTC (permalink / raw)
  To: ConTeXt NTG

Hi,

I realized yesterday that my counter for the module does not reset
itself as before. What I need is a counter that resets after each
heading (chapter, section, subsection, subsubsection and so on).

This is what I know about counter reseting at the moment:

\definecounter[ParagraphNumber][prefix=no,way=bysection]
- way=bychapter: reseting counter at every chapter (default)
- way=bysection: reseting counter at every section (not at chapters)
- way={bychapter,bysection,bysubsection,bysubsubsection}: does not work

\setuphead[chapter,section,subsection,subsubsection][after={\resetcounter[ParagraphNumber]}]
does work but it messes with the distance between heading and normal
text.

What is the correct/best way to make the counter reseting every
heading without messing around?

Thanks
P.
___________________________________________________________________________________
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] 7+ messages in thread

* Re: counter reseting at every heading
  2012-05-18 13:00 counter reseting at every heading Peter Schorsch
@ 2012-05-18 15:41 ` Hans Hagen
  2012-05-18 19:39   ` Aditya Mahajan
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2012-05-18 15:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 18-5-2012 15:00, Peter Schorsch wrote:
> Hi,
>
> I realized yesterday that my counter for the module does not reset
> itself as before. What I need is a counter that resets after each
> heading (chapter, section, subsection, subsubsection and so on).
>
> This is what I know about counter reseting at the moment:
>
> \definecounter[ParagraphNumber][prefix=no,way=bysection]
> - way=bychapter: reseting counter at every chapter (default)
> - way=bysection: reseting counter at every section (not at chapters)
> - way={bychapter,bysection,bysubsection,bysubsubsection}: does not work
>
> \setuphead[chapter,section,subsection,subsubsection][after={\resetcounter[ParagraphNumber]}]
> does work but it messes with the distance between heading and normal
> text.
>
> What is the correct/best way to make the counter reseting every
> heading without messing around?

we probably need something byheader or maybe indeed a comma separated list

Hans


-----------------------------------------------------------------
                                           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] 7+ messages in thread

* Re: counter reseting at every heading
  2012-05-18 15:41 ` Hans Hagen
@ 2012-05-18 19:39   ` Aditya Mahajan
  0 siblings, 0 replies; 7+ messages in thread
From: Aditya Mahajan @ 2012-05-18 19:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 18 May 2012, Hans Hagen wrote:

> On 18-5-2012 15:00, Peter Schorsch wrote:
>> Hi,
>> 
>> I realized yesterday that my counter for the module does not reset
>> itself as before. What I need is a counter that resets after each
>> heading (chapter, section, subsection, subsubsection and so on).
>> 
>> This is what I know about counter reseting at the moment:
>> 
>> \definecounter[ParagraphNumber][prefix=no,way=bysection]
>> - way=bychapter: reseting counter at every chapter (default)
>> - way=bysection: reseting counter at every section (not at chapters)
>> - way={bychapter,bysection,bysubsection,bysubsubsection}: does not work
>> 
>> \setuphead[chapter,section,subsection,subsubsection][after={\resetcounter[ParagraphNumber]}]
>> does work but it messes with the distance between heading and normal
>> text.
>> 
>> What is the correct/best way to make the counter reseting every
>> heading without messing around?
>
> we probably need something byheader or maybe indeed a comma separated list

Or perhaps a \c!setups key for \setuphead commands.

Another option is to add spacebefore and spaceafter keys to set distance, 
rather than the before and after keys. A few commands use spacebefore and 
spaceafter, and it will be nice if all commands used them.

Aditya
___________________________________________________________________________________
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] 7+ messages in thread

* Re: counter reseting at every heading
  2012-10-01  8:48   ` Peter Schorsch
@ 2012-10-01  9:21     ` Wolfgang Schuster
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Schuster @ 2012-10-01  9:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 01.10.2012 um 10:48 schrieb Peter Schorsch <tralalas@freenet.de>:

> Thanks Wolfgang,
> 
> the solution with \startchapter and insidesection works fine. 
> 
> I wasn't aware of that \startchapter-stucture at all. Regarding to 
> 
> 	"The \startchapter command is recommended over \bookmark as the
> 	latter might become obsolete" from
> 	http://wiki.contextgarden.net/PDF_Bookmarks_and_Headers

With \startchapter etc. it’s easier to set different texts for the heading, header,
bookmarks and table of contents because there is a key for each of them while
for \chapter you can only set one text for all of them. Only with the \bookmark
command you can at least set a different text for the bookmarks.

> is that also the new recommended way of defining chapters instead of
> \chapter{..}?

You can use them but you don’t have to, the old commands while stay but the new
ones but they are helpful when you want endnotes end the end of each chapter etc.

When you have a simple structure in your document you can use \startsectionlevel
instead of \startchapter, \startsection etc. for your headings because the command
switches always to the next heading (chapter -> section -> subsection).

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
___________________________________________________________________________________


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

* Re: counter reseting at every heading
  2012-09-30 21:07 ` Wolfgang Schuster
@ 2012-10-01  8:48   ` Peter Schorsch
  2012-10-01  9:21     ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Schorsch @ 2012-10-01  8:48 UTC (permalink / raw)
  To: ntg-context

Thanks Wolfgang,

the solution with \startchapter and insidesection works fine. 

I wasn't aware of that \startchapter-stucture at all. Regarding to 

	"The \startchapter command is recommended over \bookmark as the
	latter might become obsolete" from
	http://wiki.contextgarden.net/PDF_Bookmarks_and_Headers

is that also the new recommended way of defining chapters instead of
\chapter{..}?

P.

___________________________________________________________________________________
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] 7+ messages in thread

* Re: counter reseting at every heading
  2012-09-30 20:29 Peter Schorsch
@ 2012-09-30 21:07 ` Wolfgang Schuster
  2012-10-01  8:48   ` Peter Schorsch
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2012-09-30 21:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 30.09.2012 um 22:29 schrieb Peter Schorsch <tralalas@freenet.de>:

> Hi, 
> 
> few months ago (18th may) I asked about how to setup a counter that
> resets after each heading (chapter, section, subsection, subsubsection
> and so on.
> 
> I got three possibilities then but none of them was implemented (and
> still is not):
> 
> 1)
> \definecounter[ParagraphNumber][prefix=no,way={bychapter,bysection,bysubsection,bysubsubsection}]
> 
> 2)
> \definecounter[ParagraphNumber][prefix=no,way=byheader]
> 
> 3)
> \setuphead[chapter,section,subsection,subsubsection][after={\resetcounter[ParagraphNumber]}]
> as soon the spaces are defined over spaceafter instead of after.
> 
> Is there a forth option out?

When you use the start/stop commands for the headings you can use the inside section key to reset the counter, e.g. \setuphead[insidesection={\resetcounter[…]}]

> Or can anyone tell me what the defaults spaces are so that I can copy them manually? 


Here are the default values taken from strc-def.mkiv, the subsection etc. inherit the settings from section.

part, chapter:

  before = \blank[2*big]
  after  = \blank[2*big]

section:

  before = \blank[2*big]
  after  = \blank

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
___________________________________________________________________________________


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

* counter reseting at every heading
@ 2012-09-30 20:29 Peter Schorsch
  2012-09-30 21:07 ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Schorsch @ 2012-09-30 20:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi, 

few months ago (18th may) I asked about how to setup a counter that
resets after each heading (chapter, section, subsection, subsubsection
and so on.

I got three possibilities then but none of them was implemented (and
still is not):

1)
\definecounter[ParagraphNumber][prefix=no,way={bychapter,bysection,bysubsection,bysubsubsection}]

2)
\definecounter[ParagraphNumber][prefix=no,way=byheader]

3)
\setuphead[chapter,section,subsection,subsubsection][after={\resetcounter[ParagraphNumber]}]
as soon the spaces are defined over spaceafter instead of after.

Is there a forth option out? Or can anyone tell me
what the defaults spaces are so that I can copy them manually? 

Thanks
P.
___________________________________________________________________________________
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] 7+ messages in thread

end of thread, other threads:[~2012-10-01  9:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-18 13:00 counter reseting at every heading Peter Schorsch
2012-05-18 15:41 ` Hans Hagen
2012-05-18 19:39   ` Aditya Mahajan
2012-09-30 20:29 Peter Schorsch
2012-09-30 21:07 ` Wolfgang Schuster
2012-10-01  8:48   ` Peter Schorsch
2012-10-01  9:21     ` Wolfgang Schuster

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