Have a look at TeX's \discretionary, Bogdan : this may give you some ideas.
Philip Taylor -------- Bogdan Butnaru wrote:
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.”
-------------------------------------------------- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex