On Jan 13, 2011, at 10:32 , Bogdan Butnaru wrote:

> 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.

What you might want is not a LaTeX command, but a TeX command. I'm looking at 
page 85 of "The TeXbook":

=====

A discretionary break consists of three sequences of characters called the 
_pre-break_, _post-break_, and _no-break_ texts. The idea is that if a line 
break occurs here, the _pre-break text_ will appear at the end of the current 
line and the _post-break text_ will occur at the beginning of the next line; 
but if no break occurs, the _no-break text_ will appear in the current line. 
Users can specify discretionary breaks in complete generality by writing

        \discretionary{pre-break text}{post-break text}{no-break text}

where the three texts consist entirely of characters, boxes, and kerns. For 
example, \TeX\ can hyphenate the word `difficult' between the f's, even though 
this requires breaking the`ffi' ligature into `f-' followed by an `fi' 
ligature, if the horizontal list contains 
        \discretionary{f-}{fi}{ffi}cult.

=====

So I would imagine you could accomplish your intent with

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





--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex

Reply via email to