From: Sanjoy Mahajan <sanjoy@mrao.cam.ac.uk>
Subject: Re: using headnumber
Date: Thu, 20 Apr 2006 17:54:09 +0100 [thread overview]
Message-ID: <E1FWcPx-0000G2-00@skye.ra.phy.cam.ac.uk> (raw)
In-Reply-To: Your message of "Thu, 20 Apr 2006 17:14:41 +0200." <4447A561.1020102@gmx.net>
> \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.
prev parent reply other threads:[~2006-04-20 16:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-20 14:22 Thomas A. Schmitz
2006-04-20 15:14 ` Peter Rolf
2006-04-20 16:15 ` Thomas A. Schmitz
2006-04-20 17:06 ` Sanjoy Mahajan
2006-04-20 20:44 ` Hans Hagen
2006-04-20 21:46 ` Thomas A. Schmitz
2006-04-20 16:54 ` Sanjoy Mahajan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1FWcPx-0000G2-00@skye.ra.phy.cam.ac.uk \
--to=sanjoy@mrao.cam.ac.uk \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).