[XeTeX] alternate text for line-breaking

Bogdan Butnaru bogdanb at gmail.com
Thu Jan 13 19:32:37 CET 2011


Hello!

I was wondering if is it possible to do write a LaTeX command that
provides text alternatives when the line-breaking algorithm can’t find
good line breaks. For example, a command that for:

    Pretext \alternate{something}{a  thing} post-text.

runs the line-breaking algorithm for “Pretext something post-text.”
but if gets bad results (i.e., if it would report
an underful or overful hbox) tries again with “Pretext a thing
post-text.” Ideally one could give more than two if necessary,
alternatives and the best (with least underful/overful) would be
picked in case none work perfectly.

I’d like that to use for a (rather large) document that needs to be
adapted (and look good) for several different page sizes. I’m willing
to reword the text by hand to make it break well, but a wording that
works for some size may not work for another; also, I’d prefer that
the “original” wording be used whenever possible (so, if I reword
something to fit the current page size, I’d like it to revert
automatically to the original wording on another page size if it would
fit).

-- Bogdan Butnaru



More information about the XeTeX mailing list