[XeTeX] alternate text for line-breaking

Fr. Michael Gilmary FrMichaelGilmary at MaroniteMonks.org
Thu Jan 13 23:11:30 CET 2011


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



Well, my rather simple way of achieving this is to change the \tolerance 
setting (e.g., to get a more forgiving but less optimal stretching try 
\tolerance=600) or \sloppypar or \emergencystretch, etc.

To get less complaints of overfull hboxes (again, this isn't an ideal, 
only a compromise) you can adjust the \hfuzz (e.g., \hfuzz=1.2pt) to 
quiet things down.

That will save you a lot of work on alternatives for unpleasant line 
breaks, IMHO.

HTH.





-- 
United in adoration of Jesus, 



fr. michael gilmary, mma

Most Holy Trinity Monastery
67 Dugway Road
Petersham, MA 01366-9725

www.MaroniteMonks.org






More information about the XeTeX mailing list