I’m working with a Khmer script project in which they want \nd to be underlined. The trouble is that the first letter of the word meaning “lord” has a deep descender. If the underline is placed low enough to be below the descender then it’s just too far from the majority of the text, especially in cases where \nd is used on a word without a descender. I’m actually simplifying the problem, since the “first letter” visually is actually the 4th character in the string, due to the beauty of Khmer Unicode re-ordering rules. \nd ប៉្រ័ះ ប៊កកាតយ័\nd*
Substituting English to keep it simple, I used changes.txt to change \nd god Yahweh\nd* to god\zul\u0332\zul*\nd\ Yahweh\nd*.
The \zul style reduces the font size and sets stretch to 200% so that the single \u0332 character nicely underlines both the “o” and “d” of “god”, while skipping the “g”.
The "\ " (slash space) before “Yahweh” causes \nd to underline the space between “god” and “Yahweh”, so it all worked beautifully—until I got to a paragraph which I’d shrunk using the \p^95 notation, which seems to reset to 100% the stretch on my \zul style, leaving only the last letter of “god” underlined.
Ideal would be a check box to cause underlining to dropout at all descenders, but a quick search leads me to believe that this is not a simple thing in TeX.
I feel like I took a wrong turn 49 miles ago and I’m looking for some other suggestions.
How can I make a nice underline of the words ប៉្រ័ះ ប៊កកាតយ័ — and something that will also work for the word អាញ់?
Hmm. I’m not sure why the ^95 is overriding the 200% stretch of your character style. That sounds like the paragraph styling is overriding the character styling, when it should probably be multiplying or just leaving the char style unaffected. So I would call that a bug. Hopefully it won’t be too hard to fix it.
I don’t know if it’s a worthwhile approach, but in a relatively recent update, I made it so that negative underline positions mean the underline is relative to the baseline, rather than relative to the descenders. You end up with crossed out descenders, so that might not be what you want either.
Not underlining characters with descenders… even if there were a way to split up the text into letters (probably not impossible, but still very very hard when you take into account things like nesting character styles, footnotes and the extra magic that verse numbers add) the problem is that while “T” has no descent, even things like “e” have a little bit of a descent - 0.146pt on 10pt Gentium), so depth>0pt won’t work, and there’d still need to be some kind of logic to distinguish ‘this is just a normal letter with a curved base’ from ‘this letter has a real descender’.
I believe the issue is now (partially) fixed in 2.3.1. A character style that has a stretch set now multiplies its value with whatever stretch was previously set in the paragraph, whether that is from a p^95 type adjustment or a paragraph style with stretched text. This ought to mean that if your \u0332 is the right width to underline “o” and “d” in a normal sized paragraph, it should scale properly in a stretched/shrunk paragraph too.
The full fix (I hope!) will be in 2.3.2, and will give the behaviour as outlined below (if you set stretch to 200% in the UI, you have ‘fixed’ wide characters):
This fix would let your \zul stretch be independent of the stretch set by a paragraph style (if you defined a p_95), but not one set by ^95, hopefully giving you all the control you might want.
Note that if you want to use the ‘feature-inheritance’ described above, or change the limits past what the user interface allows you, you will almost certainly have to hand-edit the ptxprint-mods.sty override style sheet, and maybe read some documentation, too!
For your final sentence… I wonder if underlining right on the baseline might work, or just look horrible? You can set the ‘Underline vertical position’ to be -0.01, and that should be about 0.1pt below the baseline (depending on your font-size):
(that’s on the Advanced tab).
Or you could set it even closer by putting this in your ptxprint-mods.tex: