Hi there,

a few weeks ago I asked whether somebody could help me with a problem that
occured writing a manual.
The Problem was to create a "german" index (that means an index that sorts
german umlauts correctly).

JMarc gave me a very useful hint ("May the source be with you", :-) and as
he told me I had a look at the source code, especially LaTeX.C

Well the solution I found works as follows:

Patch LaTeX.C (around line 442):

char *lyxenv;

        lyxerr.debug("idx file has been made,"
                      " running makeindex on file "
                      + file, Error::LATEX);

        // It should be possible to set the switches for makeindex
        // sorting style and such. It would also be very convenient
        // to be able to make style files from within LyX. This has
        // to come for a later time. (0.13 perhaps?)
        LString tmp = "makeindex -c -q ";
        lyxenv=getenv("LYX_MAKEINDEX");
        if (lyxenv)
        {
                tmp += LString(lyxenv);
                tmp += " ";
        }

Export two variables:
 
        LXY_MAKEINDEX="-s foo.ist -g"
        INDEXSTYLE=/usr/share/texmf/makeindex/

        foo.ist is the name of the style file, -s is the option to tell
        makeindex to use a style file and -g is the option for German word
        ordering.

        INDEXSTYLE contains the path where makeindex will find the style 
        file (please note: I work with SuSE 6.0 so the paths may vary from
        distribution to distribution.

Create a style file in the directory /usr/share/texmf/makeindex. An
example for it (the style file I use) is displayed below:

        quote '+'

        lethead_prefix   "{\\bfseries "
        lethead_suffix   "\\hfil}\\nopagebreak\n"
        lethead_flag       1
        heading_prefix   "{\\bfseries "
        heading_suffix   "\\hrulefill}\\nopagebreak\n"
        headings_flag       1


        The "quote..." enables you to use the way tex recognizes german
        umlauts "A instead of Ä
        The "\\hrulefill" creates a line beneath the letter of every new
        group of the index.

The only thing now you have to do when writing a document is to make sure
that index entries with a german umlaut as the first character
        ä, Ä, ö, Ö, ü, Ü
are written like
        "a, "A, "o, "O, "u, "U.

That's it.

Let me thank JMarc for immediate help and Andreas Wegmann for patching
LaTeX.C (and all the other guys who gave a helping hand).

As I mentioned above: "May the source be with you".

cu

Stephan

Reply via email to