Hi, Some time ago I had a query on the list about roman numbering in headers. Once I got my answer, I asked something else relatively unrelated but in the same thread. It's probably bad etiquette, so I figure that is why it has remained unheeded. I'd like to submit my second query again. I have a problem with the separator in header numbers. I want to use a different separator between chapter and section numbers (-), than between section and subsection numbers (.). So, assuming I'm using roman numerals for chapters, I'd like numering of sections to be I-1, I-2, I-3, etc., of subsections to be I-1.1, I-1.2, I-2.1, I-2.2, I-2.3, etc. Now when I use \setuphead for section and subsection blocks with different [separator=] attributes: \setuphead[section][separator=-] \setuphead[subsection][separator=.] ... it defines the separator for the _whole_ header level, not the number position within any relevant header. So I get this instead: sections are numbered I-1, I-2, I-3, etc. subsections are numbered I.1.1, 1.1.2, I.2.1, I.2.2, I.2.3, etc. Is there a way to achieve what I want to do? Thanks! Jeff
On Tue, 7 Nov 2006, Jeff Smith wrote:
Hi,
Some time ago I had a query on the list about roman numbering in headers. Once I got my answer, I asked something else relatively unrelated but in the same thread. It's probably bad etiquette, so I figure that is why it has remained unheeded. I'd like to submit my second query again.
I have a problem with the separator in header numbers. I want to use a different separator between chapter and section numbers (-), than between section and subsection numbers (.).
So, assuming I'm using roman numerals for chapters, I'd like numering of sections to be I-1, I-2, I-3, etc., of subsections to be I-1.1, I-1.2, I-2.1, I-2.2, I-2.3, etc.
Is there a way to achieve what I want to do?
Yes, as long as you do not want to refer to your sections :) The separator seems to be broken while refering anyways. \setupsection[section-2][bodypartconversion=Romannumerals] \setuphead [subsection] [numbercommand=\mysubsectionnumber] \setuphead[section][separator=-] \unprotect \def\mysubsectionnumber#1% {\@@shortsectionnumber{section-2}-% \@@shortsectionnumber{section-3}.% \@@shortsectionnumber{section-4}} \protect \starttext \chapter{Test} \section[sec]{section test} \subsection[sub]{test} The separator is not honored in \in Section[sec] and in \in subsection[sub]. \stoptext
On Tue, 7 Nov 2006, Aditya Mahajan wrote:
On Tue, 7 Nov 2006, Jeff Smith wrote:
Hi,
Some time ago I had a query on the list about roman numbering in headers. Once I got my answer, I asked something else relatively unrelated but in the same thread. It's probably bad etiquette, so I figure that is why it has remained unheeded. I'd like to submit my second query again.
I have a problem with the separator in header numbers. I want to use a different separator between chapter and section numbers (-), than between section and subsection numbers (.).
So, assuming I'm using roman numerals for chapters, I'd like numering of sections to be I-1, I-2, I-3, etc., of subsections to be I-1.1, I-1.2, I-2.1, I-2.2, I-2.3, etc.
Is there a way to achieve what I want to do?
Yes, as long as you do not want to refer to your sections :) The separator seems to be broken while refering anyways.
I need this functionality for a project (IEEE conference style), so here is hack to get the feature. The referencing also works. Use with caution, can break existing macros. \setupsection[section-1][separator=-] \setupsection[section-2][separator=-] \setupsection[section-3][separator=-] %section \setupsection[section-4][separator=.] %subsection \setupsection[section-5][separator=-] \setupsection[section-6][separator=-] \setupsection[section-2][bodypartconversion=Romannumerals] \unprotect \def\@@longsectionnumber#1% {\ifreversesectionnumbers \@@shortsectionnumber{#1}% \ifnum\countervalue{\??se\previoussection{#1}}>\zerocount \csname\??se#1\c!separator\endcsname%AM: was . \csname\previoussection{#1}\c!number\endcsname \fi \else \ifnum\countervalue{\??se\previoussection{#1}}>\zerocount \csname\previoussection{#1}\c!number\endcsname% \csname\??se#1\c!separator\endcsname%AM: was . \fi \@@shortsectionnumber{#1}% \fi} \protect \starttext \chapter{Test} \section[sec]{section test} \subsection[sub]{test} The separator is honored in \in Section[sec] and in \in subsection[sub]. \stoptext Basically, section numbers are built according to \??se (\setupsection, etc), while separators are specified using \??ko (\setuphead, etc), so any interaction is very difficult. I defined separators according to \setupsection, and use while generating the number. Aditya
On 11/7/06, Aditya Mahajan
I need this functionality for a project (IEEE conference style), so here is hack to get the feature. The referencing also works.
Use with caution, can break existing macros.
Wow, thanks a lot! This works as expected. In what situation can it break existing macros? I intend to use that extensively but in a fairly simple document (a thesis... yeah, another one in ConTeXt!). Is there anything I should _not_ do? Thanks again for your help! It's always greatly appreciated. Jeff
On Thu, 9 Nov 2006, Jeff Smith wrote:
On 11/7/06, Aditya Mahajan
wrote: I need this functionality for a project (IEEE conference style), so here is hack to get the feature. The referencing also works.
Use with caution, can break existing macros.
Wow, thanks a lot! This works as expected. In what situation can it break existing macros? I intend to use that extensively but in a fairly simple document (a thesis... yeah, another one in ConTeXt!). Is there anything I should _not_ do?
In principle, it should work fine for european languages. Lot of the trickery with numbers and number formats is present because ConTeXt also supports other languages like chinese and arabic. @@longsectionnumber is used a lot by the sectioning macros, and I do not completely understand what is happening here. My solution was based on trial and error and figuring out what works. Moreover, it changes a core feature of ConTeXt. I am associating separators with sectioning levels rather than with heads. Right now, in principle, you can have different separators for different heads at the same level. For example \setuphead[remark][section=section-4,separator=.] \setuphead[note][section=section-4,separator=-] With this change, this will no longer work. So, the macro is not backward compatible, and thus can break existing code. If you have only one head at each sectioning level, and do not plan to use Chinese or Arabic, it should work fine. Atleast for my simple, 5 page document, it works correctly :-) Aditya
Jeff Smith wrote:
On 11/7/06, Aditya Mahajan
wrote: I need this functionality for a project (IEEE conference style), so here is hack to get the feature. The referencing also works.
Use with caution, can break existing macros.
Wow, thanks a lot! This works as expected. In what situation can it break existing macros? I intend to use that extensively but in a fairly simple document (a thesis... yeah, another one in ConTeXt!). Is there anything I should _not_ do?
hm, can on esummarize what will break macros? (i was away for a week with time for email) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Tue, 14 Nov 2006, Hans Hagen wrote:
Jeff Smith wrote:
On 11/7/06, Aditya Mahajan
wrote: I need this functionality for a project (IEEE conference style), so here is hack to get the feature. The referencing also works.
Use with caution, can break existing macros.
Wow, thanks a lot! This works as expected. In what situation can it break existing macros? I intend to use that extensively but in a fairly simple document (a thesis... yeah, another one in ConTeXt!). Is there anything I should _not_ do?
hm, can on esummarize what will break macros? (i was away for a week with time for email)
A patch that I sent to Jeff. There is a problem with separators and setuphead. I have summarized the problem and a possible patch in the attached file. However, I do not know if it will break something in multi-lingual documents (esp. Arabic), so I sent the patch with a disclaimer. Aditya
Aditya Mahajan wrote:
On Tue, 14 Nov 2006, Hans Hagen wrote:
Jeff Smith wrote:
On 11/7/06, Aditya Mahajan
wrote: I need this functionality for a project (IEEE conference style), so here is hack to get the feature. The referencing also works.
Use with caution, can break existing macros.
Wow, thanks a lot! This works as expected. In what situation can it break existing macros? I intend to use that extensively but in a fairly simple document (a thesis... yeah, another one in ConTeXt!). Is there anything I should _not_ do?
hm, can on esummarize what will break macros? (i was away for a week with time for email)
A patch that I sent to Jeff. There is a problem with separators and setuphead. I have summarized the problem and a possible patch in the attached file. However, I do not know if it will break something in multi-lingual documents (esp. Arabic), so I sent the patch with a disclaimer. hm, then let's not patch before tex live code freeze then; after all it would be bad to break anything arab related the first week after a tug conference with a focus on high quality arab (including arab math)
Hans -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Aditya Mahajan wrote:
On Tue, 14 Nov 2006, Hans Hagen wrote:
Jeff Smith wrote:
On 11/7/06, Aditya Mahajan
wrote: I need this functionality for a project (IEEE conference style), so here is hack to get the feature. The referencing also works.
Use with caution, can break existing macros.
Wow, thanks a lot! This works as expected. In what situation can it break existing macros? I intend to use that extensively but in a fairly simple document (a thesis... yeah, another one in ConTeXt!). Is there anything I should _not_ do?
hm, can on esummarize what will break macros? (i was away for a week with time for email)
A patch that I sent to Jeff. There is a problem with separators and setuphead. I have summarized the problem and a possible patch in the attached file. However, I do not know if it will break something in multi-lingual documents (esp. Arabic), so I sent the patch with a disclaimer. i took a quick look at it; the problem is that it will mess up other things; the period in fullsectionnumber is a placeholder that will be replaced later on; the actual code where things happen in \doseparatednumber and it's not that easy to hook level dependent separators in there
(i will reimplement sectionnumbering some day soon due to some other pending issues) anyhow, here's another approach: \starttext \unexpanded\def\seplist#1% {\ifx\sepnumber\undefined\def\sepnumber{0}\fi \increment\sepnumber \getfromcommacommand[#1][\sepnumber]% \ifx\commalistelement\empty \getcommalistsize[#1]% \def\sepnumber{\number\commalistsize}% \getfromcommacommand[#1][\sepnumber]% \fi \commalistelement} % \setuphead[section] [separator=\seplist{?,!,*}] % \setuphead[subsection][separator=\seplist{??,!!,**}] \let\spr\seplist % quick hack % \setuphead[section] [separator={?,!,*}] % \setuphead[subsection][separator={??,!!,**}] \setupheads[separator={A,B,C,D,E,F}] \chapter{test} \section{test} \subsection{test} \subsection{test} \section{test} \subsection{test} \subsection{test} \stoptext Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Wed, 15 Nov 2006, Hans Hagen wrote:
Aditya Mahajan wrote:
On Tue, 14 Nov 2006, Hans Hagen wrote:
Jeff Smith wrote:
On 11/7/06, Aditya Mahajan
wrote: I need this functionality for a project (IEEE conference style), so here is hack to get the feature. The referencing also works.
Use with caution, can break existing macros.
Wow, thanks a lot! This works as expected. In what situation can it break existing macros? I intend to use that extensively but in a fairly simple document (a thesis... yeah, another one in ConTeXt!). Is there anything I should _not_ do?
hm, can on esummarize what will break macros? (i was away for a week with time for email)
A patch that I sent to Jeff. There is a problem with separators and setuphead. I have summarized the problem and a possible patch in the attached file. However, I do not know if it will break something in multi-lingual documents (esp. Arabic), so I sent the patch with a disclaimer. i took a quick look at it; the problem is that it will mess up other things; the period in fullsectionnumber is a placeholder that will be replaced later on; the actual code where things happen in \doseparatednumber and it's not that easy to hook level dependent separators in there
(i will reimplement sectionnumbering some day soon due to some other pending issues)
anyhow, here's another approach: [snip]
This does not work with references, \in[ref] still gives . as the separator. Consider IEEE's journal and conference requirements In the head only show the current number Section I. Subsection B. Subsubsection 3) paragraph a) While refereing to a section, use Section I Subsection I-A subsubsection I-A.1 paragraph I-A.1.a The first part is easy \setupsection[section-3][bodypartconversion=Romannumerals] \setupsection[section-4][bodypartconversion=Character, previousnumber=no] \setupsection[section-5][bodypartconversion=numbers, previousnumber=no] \setupsection[section-6][bodypartconversion=character, previousnumber=no] \setuphead[section] [numbercommand={\groupedcommand{}{.}}] \setuphead[subsection] [numbercommand={\groupedcommand{}{)}}] I could never get the second part working and had to go back to Latex :-( Hoping that your reimplementation is before my next deadline. Aditya
participants (3)
-
Aditya Mahajan
-
Hans Hagen
-
Jeff Smith