> \determineheadnumber[section]

Thanks for mentioning that command, which I'd been looking for.  I
couldn't quite get it to work, but reading the code near its
definition helped me solve another problem.  Each chapter has a
section for exercises, and each exercise is a subsection with a short
title (a few words).  e.g.

  \exercise{Batteries}

  What is the cost of energy from a 9V battery?  From a wall socket (the
  mains)?

I want the exercises to be numbered just by the exercise number
(e.g. 7), not for example 1.6.7 (if the exercises are the 6th section
in chapter 1).  Hence this setup:

  \definehead[exercise][subsection]
  \def\choptwo#1.#2.{}
  \def\processtwo#1{\expandafter\choptwo#1\relax}
  \setuphead[exercise][style=italic, 
  numbercommand={\processtwo{\currentheadnumber} \gobbleoneargument}]

If there's an easier way using \determineheadnumber, I'll be happy to
use it instead but the above probably fragile hack works for me.

The more obvious try

  \def\choptwo#1.#2.{}
  \setuphead[subsection][numbercommand={\expandafter\choptwo}]

produced 200 lines of complaint, starting with:
  ERROR: Argument of \choptwo has an extra }.

In the following minimal example of my attempt to use
determineheadnumber, the subsection numbers are missing (instead of
being the chapter number):

  \setuphead[subsection]
  [numbercommand={\determineheadnumber[chapter] \gobbleoneargument}]
  \starttext
  \chapter{One}
  \section{A1}
  hi
  \subsection{B1}
  hi
  \subsection{B2}
  hi
  \stoptext

>> 
>> \setuphead[section]
>>     [command={{{\determineheadnumber[section]}
               ^^^^
> one opening brace too much

That's why I want the editor to insert } for me automatically when I
type { (in the earlier thread about AUCTeX/Emacs).

-Sanjoy

`Never underestimate the evil of which men of power are capable.'
         --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to