ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* typesetting chapter--label for cross references
@ 2003-02-24  8:25 Guy Worthington
  2003-03-11 23:24 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Guy Worthington @ 2003-02-24  8:25 UTC (permalink / raw)


I'd like to display a cross reference, using a en-dash to separate the
chapter number from the text being cross referenced.  In the example
below, if you look at label attached to the example caption "A Sample
XML file," you'll see that it is typeset as

    Example~1--1

however if you look at the cross reference to the example, it is
typeset as

   Example~1.1

how do I change the period (.) separator in the cross reference to an
en-dash separator (--).

-----

\defineenumeration
 [example]
 [location=serried,
  text=Example,
  before=\blank,
  after=\blank,
  way=bychapter,
  style=italic,
  separator=--]

\starttext

\chapter{One}

\in{Example}[ex:Simple-doc] has the chapter number separated from the 
example number by a period, and not an en-dash.

\example[ex:Simple-doc] A Sample XML file

\startXML
<?xml version="1.0"?>
<?xml-stylesheet href="simple-doc.xsl" type="text/xsl"?>
\stopXML

\stoptext

-----

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

* Re: typesetting chapter--label for cross references
  2003-02-24  8:25 typesetting chapter--label for cross references Guy Worthington
@ 2003-03-11 23:24 ` Hans Hagen
  2003-03-12 13:06   ` Guy Worthington
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2003-03-11 23:24 UTC (permalink / raw)


At 04:25 PM 2/24/2003 +0800, you wrote:
>I'd like to display a cross reference, using a en-dash to separate the
>chapter number from the text being cross referenced.  In the example
>below, if you look at label attached to the example caption "A Sample
>XML file," you'll see that it is typeset as
>
>     Example~1--1
>
>however if you look at the cross reference to the example, it is
>typeset as
>
>    Example~1.1
>
>how do I change the period (.) separator in the cross reference to an
>en-dash separator (--).
>
>-----
>
>\defineenumeration
>  [example]
>  [location=serried,
>   text=Example,
>   before=\blank,
>   after=\blank,
>   way=bychapter,
>   style=italic,
>   separator=--]
>
>\starttext
>
>\chapter{One}
>
>\in{Example}[ex:Simple-doc] has the chapter number separated from the
>example number by a period, and not an en-dash.
>
>\example[ex:Simple-doc] A Sample XML file
>
>\startXML
><?xml version="1.0"?>
><?xml-stylesheet href="simple-doc.xsl" type="text/xsl"?>
>\stopXML
>
>\stoptext

This is a mixture of a bug and feature. I'm not sure if the following patch 
is completely safe (so i'll have to test it for a while)

\unprotect

\def\preparethenumber#1#2#3% {\??id#1} \number \result
   {\doifelsevaluenothing{#1\c!scheider}
      {\let\numberseparator\empty
       \let#3#2}
      {\edef\numberseparator{\getvalue{#1\c!scheider}}%
       \edef#3{\@EA\separatednumber\@EA{#2}}}}  % hm, etex

\protect

the best way to handle sep's is

\definesymbol[MySep][--]

separator={\symbol[MySep]}

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

* Re: typesetting chapter--label for cross references
  2003-03-11 23:24 ` Hans Hagen
@ 2003-03-12 13:06   ` Guy Worthington
  0 siblings, 0 replies; 3+ messages in thread
From: Guy Worthington @ 2003-03-12 13:06 UTC (permalink / raw)


Hans Hagen wrote:
> Guy Worthington wrote:

>> I'd like to display a cross reference, using a en-dash to separate
>> the chapter number from the text being cross referenced.

> This is a mixture of a bug and feature.

I don't understand what you did to patch the bug, but I can certainly
appreciate the feature.  I get a lot of pleasure when I trip across
these types of electric macros.

-----
%output=pdf

\unprotect

\def\preparethenumber#1#2#3% {\??id#1} \number \result
   {\doifelsevaluenothing{#1\c!scheider}
      {\let\numberseparator\empty
       \let#3#2}
      {\edef\numberseparator{\getvalue{#1\c!scheider}}%
       \edef#3{\@EA\separatednumber\@EA{#2}}}}  % hm, etex

\protect

\definesymbol[MySep][--]

\defineenumeration
  [example]
  [location=serried,
   text=Example,
   before=\blank,
   after=\blank,
   way=bychapter,
   style=italic,
   separator={\symbol[MySep]}]

\starttext

\chapter{One}

\in{Example}[ex:Simple-doc] has the chapter number separated from the
example number by a period, and not an en-dash.

\example[ex:Simple-doc] A Sample XML file

\startXML
<?xml version="1.0"?>
<?xml-stylesheet href="simple-doc.xsl" type="text/xsl"?>
\stopXML

\stoptext
-------

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

end of thread, other threads:[~2003-03-12 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-24  8:25 typesetting chapter--label for cross references Guy Worthington
2003-03-11 23:24 ` Hans Hagen
2003-03-12 13:06   ` Guy Worthington

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