Re: [NTG-context] Sections, cross-references and separators
![](https://secure.gravatar.com/avatar/0ed499139c984ed1c5c6312376a707e5.jpg?s=120&d=mm&r=g)
Taco wrote:
In this case it is easier to make the actual chapter number include the 'A'. That way, you won't have to worry about "separator" at all (which is good, because its use is confusing).
Try this:
@@ -1,4 +1,4 @@ -\setupheads[separator=] %<-- this can't be right \setupreferencing[state=start,chapternumber=yes,global=yes] -\setupsection[section-1][conversion=Characters] -\setupsection[section-2][previousnumber=yes] +\def\Mychapter#1{\convertnumber{Characters}{\getvalue{@@sesection-1}}#1} +\defineconversion[MyChapter][\Mychapter] +\setupsection[section-2][conversion=MyChapter]
Ah, thanks so much Taco, never thought of that approach - works like a charm. (I also thought that macros with @ in their names could only be used in protected mode, so that's two things I have learned for the price of one.) Do you think this is general interest enough to warrant wikifying? Thanks very much. Duncan
![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
Duncan Hothersall wrote:
Taco wrote:
In this case it is easier to make the actual chapter number include the 'A'. That way, you won't have to worry about "separator" at all (which is good, because its use is confusing).
Try this:
@@ -1,4 +1,4 @@ -\setupheads[separator=] %<-- this can't be right \setupreferencing[state=start,chapternumber=yes,global=yes] -\setupsection[section-1][conversion=Characters] -\setupsection[section-2][previousnumber=yes] +\def\Mychapter#1{\convertnumber{Characters}{\getvalue{@@sesection-1}}#1} +\defineconversion[MyChapter][\Mychapter] +\setupsection[section-2][conversion=MyChapter]
Ah, thanks so much Taco, never thought of that approach - works like a charm. (I also thought that macros with @ in their names could only be used in protected mode, so that's two things I have learned for the price of one.)
As far as TeX is concerned, I am not actually using the macro myself, just mentioning its name. The \getvalue macro then constructs the actual macro name internally. That works always, but usually macro calls look funny when used in that way. I just found \rawsectionnumber, so with this change it should also work (and look less low-level, which is good if you want to wikify it): \def\Mychapter#1% {\convertnumber{Characters}{\rawsectionnumber{section-1}}#1} Best wishes, Taco
participants (2)
-
Duncan Hothersall
-
Taco Hoekwater