Re: section ref customization
- From: "Tim Arnold" <tiarno@xxxxxxx>
- Date: Tue, 20 Dec 2005 10:38:01 -0500
"Ulrich Diez" <ulrich.diez@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:do1i8p$2v3$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> On the second reading of the op, I also noticed the lines:
>
>> I don't know if there's a good way to walk through the aux
>> file, looking for the page on which the next section begins.
>
> In case that there is some \cleardoublepage or the like after a
> section for some obscure reason, the start of the next section
> is not a criterium for a section without page-break.
>
>> Now maybe this is very hard and more work than its worth. I
>> read the doc on varioref and it seems like a good approach to
>> this kind of thing, but I'm dealing with technical docs of
>> over 5,000 pages (I think the memory requirements of the
>> varioref approach will be too much).
>
> If I got it right, the "varioref-approach" suggests dealing with
> two labels per block/range. I overlooked that in my first
> posting - the suggestion therein describes more or less the same
> approach. Sorry. As each label causes defining a new macro while
> reading the aux-file, things might get "memory-intensive".
>
> In case that memory is an issue _but not time_, one could
> implement an alternative version of the \label-mechanism which
> causes the page-number and the "alternative-label"-name to be
> added to an "argument-list"-macro while reading the aux-file at
> start instead of creating a new macro. The crucial point is:
> Each time when you wish to regain info on such a page-number,
> you'll have to iterate the (possibly very long) list. This is
> time-intensive... Nonetheless I took it for a nice "learning-
> exercise" to implement such a "time-intensive" mechanism.
>
> The "\label"-macro creates "\newlabel"-entries in the aux-file.
> While reading the aux-file, from these \newlabel-entries macros
> \r@<label's name> get defined for each label.
>
> The alternative mechanism in the "time-intensive"-examples
> below is analogous:
> Using the "\setendmarker"-macro in the main-document creates a
> "\addtosectionendmarkers"-entry in the aux-file which contains a
> value-pair nested into one single argument:
> {{name of endmarker}{page-number at endmarker}}.
> When reading the aux-file, all the information provided by these
> entries is gathered up into the macro "\sectionendmarkers". In
> order to regain the page-number which is associated to a
> section-endmarker, the \sectionendmarker-macro needs to be
> iterated until the corresponding "endmarker" is found so that
> the associated page-number can get extracted.
> This is done by the macro "\checkbeginref": It takes two
> arguments: The first is the label from the start of the section,
> the second is the endmarker of the section created by
> "\setendmarker". From the label, the start-page of the section
> gets extracted, from the endmarker -by iterating the
> \sectionendmarker-macro- the ending-page of the section gets
> extracted. If both numbers are equal, there was no page-break,
> otherwise there was...
> In case that you decide to use the same name for \labels at
> start of a section and section-endmarkers by "\setendmarker"
> at the end of a section, you can do so without problems.
> In this case you can also implement a macro which takes
> only one argument and supplies it's value to the
> "\checkbeginref" both as "start-label-argument" and as
> "endmarker-argument".
> I decided to stick to labels for the first argument as the first
> argument determines what is "visibly" referred to. I didn't want
> to also implement nameref- and hyperref-support for the
> referenced argument...
>
> You also mentioned the xr-package. Therefore I decided to
> implement the "\addtosectionendmarkers"-macro in a way so that
> it takes an optional argument. After patching the "\XR@test"-
> macro from XR/XR-hyper as done in the examples below, the
> \externaldocument-prefix gets added to "endmarker"-names via this
> optional argument so that imported "endmarkers" can also be
> distinguished from non-imported-ones.
<great example snipped>
Hi Ulrich, thanks very much for taking the time to think about this.
I'm still re-reading your example and learning from it--I'm starting to
understand. The begin-and-end-label system seems the way to go. Now I'm
thinking that a run of LaTeX (or possibly two) followed by a postprocessing
step will do the end-label work for me automatically--in that way, I can
write an external program to insert the \setendmarker{label}. In fact, that
information would be good to have anyway for section encapsulation in case
we convert this to xml or html later on.
thanks again. I'm still reading your code.
--Tim Arnold
.
- Follow-Ups:
- Re: section ref customization
- From: Ulrich Diez
- Re: section ref customization
- References:
- section ref customization
- From: Tim Arnold
- Re: section ref customization
- From: Ulrich Diez
- section ref customization
- Prev by Date: Re: metapost or PSTricks
- Next by Date: wick contractions : thank you Mr T.Kugo :-)
- Previous by thread: Re: section ref customization
- Next by thread: Re: section ref customization
- Index(es):
Relevant Pages
|