ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: Sections, cross-references and separators
       [not found] <mailman.4030.1207034365.4340.ntg-context@ntg.nl>
@ 2008-04-01  8:06 ` Duncan Hothersall
  2008-04-01  8:57   ` Taco Hoekwater
  0 siblings, 1 reply; 4+ messages in thread
From: Duncan Hothersall @ 2008-04-01  8:06 UTC (permalink / raw)
  To: ntg-context

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

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Sections, cross-references and separators
  2008-04-01  8:06 ` Sections, cross-references and separators Duncan Hothersall
@ 2008-04-01  8:57   ` Taco Hoekwater
  0 siblings, 0 replies; 4+ messages in thread
From: Taco Hoekwater @ 2008-04-01  8:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users



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
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Sections, cross-references and separators
  2008-03-31 17:25 Duncan Hothersall
@ 2008-04-01  6:38 ` Taco Hoekwater
  0 siblings, 0 replies; 4+ messages in thread
From: Taco Hoekwater @ 2008-04-01  6:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Duncan Hothersall wrote:
> What I am aiming for is a style where:
>     Parts are labelled A, B, C [done],
>     Chapters are labelled A1, A2, A3 [done, but...],
>     Cross-references to Chapters call them A1, A2, A3 [not done: I'm 
> getting A.1]
>     Figures are labelled A1.1, A1.2 [not done; I'm getting A.11 (eek!)]
>     Cross-references to Figures call them A1.1, A1.2 [not done: I'm 
> getting A.11]

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]


Question for Hans: is there a nicer way to get at the part number?
The explicit @@se is a bit too low-level for my taste ...

Best wishes,
Taco
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Sections, cross-references and separators
@ 2008-03-31 17:25 Duncan Hothersall
  2008-04-01  6:38 ` Taco Hoekwater
  0 siblings, 1 reply; 4+ messages in thread
From: Duncan Hothersall @ 2008-03-31 17:25 UTC (permalink / raw)
  To: ntg-context

Dear all,

I am confused. Here is a minimal version of my problem:

---
\setupheads[separator=] %<-- this can't be right
\setupreferencing[state=start,chapternumber=yes,global=yes]
\setupsection[section-1][conversion=Characters]
\setupsection[section-2][previousnumber=yes]
\setuphead[part][placehead=yes,resetnumber=yes,page=no]
\setuphead[chapter][page=no]
\setuphead[section][number=no]
\setuppagenumbering[partnumber=no]
\starttext
\placelist[part,chapter,section][alternative=b,partnumber=no]
\part[ptest]{Ptest}
\chapter[ctest]{Ctest}
\section[stest]{Stest}
See \in{Chapter}[ctest] (should say A1) and \in{Figure}[ftest] (should 
say A1.1).
\placefigure[here][ftest]{Ftest (should be called A1.1)}{}
\stoptext
---

What I am aiming for is a style where:
    Parts are labelled A, B, C [done],
    Chapters are labelled A1, A2, A3 [done, but...],
    Cross-references to Chapters call them A1, A2, A3 [not done: I'm 
getting A.1]
    Figures are labelled A1.1, A1.2 [not done; I'm getting A.11 (eek!)]
    Cross-references to Figures call them A1.1, A1.2 [not done: I'm 
getting A.11]

It seems to me that the line
\setupheads[separator=]
can't possibly be right and is almost certainly causing the missing dot 
in the Figure number, but it was the only way I could find to remove the 
dot between the A and the 1 in the chapter label. I have toiled a little 
with the core-ref code and cannot fathom how any of the variety of uses 
of the word "separator" make sense, or indeed if they really have 
anything to do with it... :-)

I'm testing on the garden, using pdfTeX. I'd be *really* grateful for 
some help with this one.

Thanks,

Duncan

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2008-04-01  8:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.4030.1207034365.4340.ntg-context@ntg.nl>
2008-04-01  8:06 ` Sections, cross-references and separators Duncan Hothersall
2008-04-01  8:57   ` Taco Hoekwater
2008-03-31 17:25 Duncan Hothersall
2008-04-01  6:38 ` Taco Hoekwater

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