Menu

#1 page ranges and emphasize (LaTeX)

v3.1
open
5
2019-12-17
2004-07-27
No

I have the following command to get bold page refs:
% Emphasize index references
\providecommand\EmpIn[1]{{\textbf{#1}}}

However, when I run "texindy -g" on an *.idx file that
contains the following entries:
\indexentry{Foucault, Michel|(EmpIn}{5}
\indexentry{Foucault, Michel|)}{13}
I get the error:
WARNING:
Found a :close-range in the index that wasn't opened
before!
Location-reference is 13 in keyword (Foucault, Michel)
I'll continue and ignore this.

In the dvi output, the page range is completely missing, the
entry in the *.ind file is
\item Foucault, Michel,
(this is xindy LC2 edition).
With makeindex, it works a expected, i.e.:
\item Foucault, Michel, \EmpIn{5--13}

Discussion

  • Joachim Schrod

    Joachim Schrod - 2004-07-27

    Logged In: YES
    user_id=70318

    This is an incompatibility to MakeIndex that we were not
    aware of. (It is documented that location encapsulators work
    different in xindy, but not this difference.) A proper
    solution will need a change in the xindy style language.

    First, facts and known working approach:
    xindy needs to know which location attribute is closed in
    the range, as it supports overlapping ranges. I.e., it needs
    \indexentry{Foucault, Michel|)EmpIn}{13}
    In addition, it won't work without a style file, as
    documented in TLC2:
    (define-attributes ("EmpIn"))
    (markup-locref :open "\EmpIn{" :close "}" :attr "EmpIn")
    Working test cases are attached, process with
    texindy -M range-encap range-encap.idx

    The hard problem:
    The markup output is \EmpIn{5}--\EmpIn{13}, not
    \EmpIn{5--13} as Jrgen wants. And we cannot create that
    markup output as markup-range does not support an :attr
    option, only a :class option. Only markup-locref has an
    :attr option.

    Proposed solution:
    -- Better document the difference between xindy location
    encapsulators and MakeIndex formatting.
    -- Improve support for location encapsulators in tex2xindy
    (the parser
    for idx files). If there is an open range with an
    encapsulator and a
    close range without an encapsulator, generate an
    appropriate close
    encapsulator.
    -- Change define-attribute to define implicitely a location
    class.
    Make :attr identical to :class. (This fine difference
    probably is more
    confusing than it's worth, anyhow.)
    -- Alternatively: Add :attr options to all other markup
    clauses that are
    concerned with locations.

    Timeline: tex2xindy change could be in 2.2 final, latest in
    2.3. Documentation update in 2.3. xindy style language
    change in 2.5.

     
  • Joachim Schrod

    Joachim Schrod - 2004-07-27
    • assigned_to: nobody --> jschrod
     
  • Joachim Schrod

    Joachim Schrod - 2004-07-27

    range-encap.idx

     
  • Joachim Schrod

    Joachim Schrod - 2004-07-27

    range-encap.xdy

     
  • Joachim Schrod

    Joachim Schrod - 2004-08-09
    • labels: --> Kernel (incl. scripts)
    • milestone: --> 422834
     
  • Joachim Schrod

    Joachim Schrod - 2006-09-11
    • milestone: 422834 --> 422835
     
  • Joachim Schrod

    Joachim Schrod - 2008-01-09
    • milestone: 422835 --> v3.1
     
  • Joachim Schrod

    Joachim Schrod - 2008-01-09

    Logged In: YES
    user_id=70318
    Originator: NO

    Release 2.3 happens to be the `Gour and Jörg' release.
    Rescheduled to release 3.1 and beyond.

     
  • Juergen Spitzmueller

    any chance to get this fixed eventually?

     
  • Joachim Schrod

    Joachim Schrod - 2011-01-18

    Sorry, but this incompatibility is rather low on my to-do list, there are several more pressing issues. As explained, using \)EmpIn to close the range and declaring this index attribute gives a result that does not drop any data.

     
  • Juergen Spitzmueller

    It might not be dataloss, but I produces ugly output that is not accepted at least by my publisher.

    For anyone who faces the same problem, here is a workaround. I use the following shell script that does a simple replace operation which in result embraces the dash into the EmpIn command. This is with splitindex, hence the loop. It is of course considerably simpler with plain xindy and one index:

    ---------------------------------------------
    #!/bin/sh
    if [ $# -ne 1 ]; then
    HELP
    exit 1
    fi

    # issue splitindex
    splitindex.pl -m 'xindy -L german-duden -M mymodule' $1

    # with plain xindy, just replace the above by
    # xindy -L german-duden -M mymodule $1

    # the replacement work
    for f in *.ind
    do
    echo "performing replacement in file: $f"
    sed -i -e 's/}--\\EmpIn{/--/g' $f
    done

    ----------------------------------------------

    If you use LyX (as I do), just replace the xindy call in Preferences > LaTeX by a call of the script.

     
  • Juergen Spitzmueller

    Joachim, after another 9 years (and more than 15 years after I filed this report!) I finally sat down and got my own hands dirty. The attached patch implements the :attr option to markup-range and thus fixes the problem reported here via
    (markup-range :open "\EmpIn{" :close "}" :sep "--" :attr "EmpIn")
    The only minor nuisance is that the markup is doubled, i.e. \EmpIn{\EmpIn{1}--\EmpIn{3}}, but apart from being slightly ugly, this is only a problem for toggling macros such as \emph.

    I'd be very happy to provide a pull request over at github, after my pending PR there has been resolved.

    Note, though, that this is my first touch with clisp, so a review of my code would be great.

     
    • Juergen Spitzmueller

      The only minor nuisance is that the markup is doubled, i.e. \EmpIn{\EmpIn{1}--\EmpIn{3}},

      A way around this is
      (markup-range :sep "\EmpIn{--}" :attr "EmpIn")
      which yields \EmpIn{1}\EmpIn{--}\EmpIn{3}.
      I've pondered about removing the inner markup when there is a range, but this requires markup-range of the given attr to be defined, which might break old definitions.

       

Log in to post a comment.