[texhax] Can TeX fix word and line the way I want?

Hartmut Henkel hartmut_henkel at gmx.de
Tue Sep 16 22:06:05 CEST 2003


On Mon, 15 Sep 2003, Chakrit Nimmanant wrote:

> I have document in English alphabet but I also want to transliterate
> the English alphabet into Sinhalese alphabet a word by word and a line
> by line
>
> The problem is that Sinhalese alphabet is not as the same width as
> English alphabet, so words in a line of Sinhalese alphabet will be put
> into the new line automatically by TeX.

Some silly example, not Sinhalese :-) It seems something like this would
keep the two languages in sync from one text basis file. Should be
straight-forward to switch fonts.

\documentclass{article}
\newif\ifeng
\usepackage[width=50mm]{geometry}
\def\tl #1 #2 {{\leavevmode
  \setbox1=\hbox{#1}%
  \setbox2=\hbox{#2}%
  \ifdim\wd2>\wd1\relax\wd1=\wd2\fi
  \hbox to \wd1{\ifeng#1\else#2\fi\hss}} }
\begin{document}
\raggedright
\toks0={
\noindent
\tl Life Lavo
\tl is   essa
\tl beautiful. batifula.
\tl Enjoy Enajou
\tl every evali
\tl day.  sunupdo.
}
\engtrue \the\toks0\par\bigskip
\engfalse \the\toks0
\end{document}

Isn't there even a package for things like this?

Greetings Hartmut


------------------------------------------------------------------------
Hartmut Henkel, Oftersheim, Germany
------------------------------------------------------------------------


More information about the texhax mailing list