[XeTeX] XeTex and Tibetan full justification

Jonathan Kew jonathan_kew at sil.org
Tue Apr 19 21:08:53 CEST 2005

On 19 Apr 2005, at 6:43 pm, Daniel Muller wrote:

> Jonathan,
> Thanks for the example, the second macro of \line{} gives the proper 
> results, except that the fill
> should occur only with a shad+space like "some Tibetan text| |other 
> text", "some text| text" or
> "some text ga |text", but not in "some text|| ||".

OK.... trickier, but it ought to be possible. There isn't much that 
*can't* be done by a sufficiently determined TeX programmer!

> I would like to undestand how the macro works and modify according to 
> the rules above:
> % version of \line that pads with space after \shad, or with \tsheg on 
> the right if no \shad
> present
> \catcode\shad=\active
> \def^^^^0f0d{\advance\shadfound by 1 \shad\hskip1sp plus 1fil}
> \newcount\shadfound
> \def\line#1{\shadfound=0
>   \hbox to \hsize{#1\ifnum\shadfound=0 
> \unskip\leaders\hbox{\tsheg\kern.05em}\hfil
>   \else \skip0=\lastskip \unskip \ifdim\skip0=1sp \advance\shadfound 
> by -1 \fi
>     \ifnum \shadfound=0 \hfill \fi \fi}}
> Where can I find a good reference on the web how to program in LaTex?

(Be aware that you're in for a steep learning curve.)

> For sure I will replace it with \tibetanline{} macro.
> I'm wondering about one little things, my text is about 573 pages or 
> 12000 lines, is it efficent
> to use a macro in that case or should we implement that Tibetan 
> justification differently?

Well, the first question to consider is whether this is a text with 
predetermined line breaks, or one where you want TeX to find the 
optimal line-breaks in each paragraph (as it normally does).

If the line breaks are fixed, then it should be possible to use 
\everypar to automatically apply an appropriate macro (yes, that's a 
perfectly reasonable thing to do) to each line of the text (with 
\obeylines, so that each input line is considered a separate 

If you want normal line-breaking of paragraphs, and then special the 
justification behavior applied to the resulting lines, that'll be 
harder.... I'm imagining schemes that involve unpacking and 
re-justifying each line of a paragraph, after the normal paragraph 
builder has done its work. Sounds like a job for a real TeX macro 

Sorry, I don't think I have time to try and put together a complete 
implementation of all this at the moment; it's considerably more than a 
few minutes of work (at least, it sounds like it to me).


More information about the XeTeX mailing list