From: Wolfgang Schuster via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>
Cc: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
Subject: Re: numbering questions
Date: Sun, 1 Jan 2023 11:27:26 +0100 [thread overview]
Message-ID: <7dba4137-68eb-f2e0-6871-92c3c241fe70@gmail.com> (raw)
In-Reply-To: <18f2f823-ac76-e606-9f66-7990f586a966@fiee.net>
Henning Hraban Ramm via ntg-context schrieb am 31.12.2022 um 18:23:
> A happy new year to everyone!
>
> I’m playing with some examples of section numbering.
>
> * Is there a setup to influence the order of number segments? I.e. can
> I have “section.chapter.part“ instead of “part.chapter.section”?
You need a new prefix-set to rearrange the order of the sections.
%%%% begin example
\defineprefixset [reverse-section] [section,chapter] []
\defineprefixset [reverse-subsection] [subsection,section,chapter] []
\setuphead
[section]
[sectionset=reverse-section]
\setuphead
[subsection]
[sectionset=reverse-subsection]
\starttext
\startchapter [title={A}]
\startsection [title={B}]
\startsubsection [title={C}] \stopsubsection
\startsubsection [title={D}] \stopsubsection
\startsubsection [title={E}] \stopsubsection
\stopsection
\startsection [title={F}]
\startsubsection [title={G}] \stopsubsection
\startsubsection [title={H}] \stopsubsection
\startsubsection [title={I}] \stopsubsection
\stopsection
\stopchapter
\stoptext
%%%% end example
> * How can I format the segments, e.g. to get two or three digits each
> (leading zeros)?
You can create your own conversion format.
%%%% begin example
\startluacode
interfaces.implement {
name = "FourDigits",
public = true,
arguments = "string",
actions = function(s) context("%04d",tonumber(s)) end
}
\stopluacode
\defineconversion [FourDigits] [\FourDigits]
\setuphead
[chapter]
[conversion=FourDigits]
\starttext
\startchapter [title={Chapter}] \stopchapter
\stoptext
%%%% end example
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2023-01-01 10:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-31 17:23 Henning Hraban Ramm via ntg-context
2022-12-31 18:20 ` Duncan Hothersall via ntg-context
2022-12-31 19:36 ` Henning Hraban Ramm via ntg-context
2022-12-31 19:41 ` Pablo Rodriguez via ntg-context
2022-12-31 21:07 ` Henning Hraban Ramm via ntg-context
2023-01-01 10:27 ` Wolfgang Schuster via ntg-context [this message]
2023-01-01 13:13 ` Henning Hraban Ramm via ntg-context
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=7dba4137-68eb-f2e0-6871-92c3c241fe70@gmail.com \
--to=ntg-context@ntg.nl \
--cc=wolfgang.schuster.lists@gmail.com \
/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).