4

I'm using XeLaTeX, imakeidx and xindy, and I'd like to use shorthand like "- and "= in the index entries (soft and hard hyphen allowing hyphenation within component words, from [ngerman]babel). I guess I'll need to add something to my local xindy style file, but I can't figure out what.

The indexes are lists of recipes in a cookbook, the recipe names are added automatically, they contain expressions like Wirsing"=Kartoffel"=Bett, which xindy turns into Wirsing=Kartoffel=Bett instead of Wirsing-Kartoffel-Bett with breakpoints at the hyphens and possible hyphenation Wir-sing and Kar-tof-fel. When I say Wirsing-Kartoffel-Bett in the recipe name it turns into a very long unbreakable compound that disrupts the proper linebreaking considerably.

So what happens is that xindy looses the double quotes and leaves the rest of the shorthand character pair as it is. What I want xindy to do, however, is to ignore the shorthand characters while sorting and to put them back when writing the .ind file.

  • The double quote is used for “quoting the next character”. With MakeIndex one can define a new style where the quoting character is different; probably also Xindy has such a feature. – egreg Apr 2 '14 at 11:57
  • Not sure if I understand that. I haven't worked with makeindex for ages and am just now starting with xindy. You can twist most everything with xindy, but xindy's interior scripting language uses double quotes a lot and I can see no way to tell xindy something about double quotes. I'd need to 'escape' that character '"', so that I can talk to xindy about it as I would about an 'ö' or something, but so far I've found nothing in the manual to that effect. – Blackface Apr 2 '14 at 12:10
1

As a workaround I have defined new commands (instead of shorthands) like this:

    \newcommand{\HH}{\penalty1000-\hspace{0pt}}

and say Wirsing\HH Kartoffel\HH Bett. Not beautiful or elegant, but it works.

Edit: Now that I'm happily using TeXLive 2013 instead of 2011 (my Editor was still pointed to the old directory) I could also write

    \newcommand{\HH}{\babelhyphen{hard}}

which is slightly nicer, or I could define my own babel shorthands with

    \defineshorthand{...}{...}

and use a character that is not gobbled by xindy.

Edit: Using |= as shorthand does not work, apparently. The whole entry disappears from the index.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.