%
% LaTeX Preamble for the Tibetan Transcript Translator
% Written and collected by Beat.Steiner@gseved.admin.ch
%

% Thanks to J. Sparkes and Sam Sirlin to give me the necessary ideas
% to solve LaTeX boxing problems


% Vovel Macros

% Sorry for using such brute force to (almost) center the
% vovels on their main letter. The \kern commands work around the
% fact that a \hfil is never negative.
% A further benefit is that the ligature boxes are only as
% wide as the main letter even if the vovel is wider.
% Unfortunately, an \accent can not be put on boxes (generic ligatures).


\def\gigu#1{\strut
	\vbox{\baselineskip0pt\ialign{##
		\cr{\hfil\rm\kern-8.7em
				\tibsp\accent126
		    	 \rm\kern-9em\hfil}
		\cr{#1}\cr
	}}}

\def\shabkyu#1{\strut
	\vtop{\baselineskip0pt\ialign{##
		\cr{#1}
		\cr{\hfil\rm\kern-9em
				\tibsp\char123
			 \rm\kern-8.9em\hfil}
		\cr
	}}}


\def\drengbu#1{\strut
	\vbox{\baselineskip0pt\ialign{##
		\cr{\hfil\rm\kern-9em
				\tibsp\accent127
			 \rm\kern-9em\hfil}
		\cr{#1}\cr
	}}}

\def\naro#1{\baselineskip0pt\strut
	\vbox{\baselineskip0pt\ialign{##
		\cr{\hfil\rm\kern-8.7em
				\tibsp\accent125
			 \rm\kern-9em\hfil}
		\cr{#1}\cr
	}}}

\def\anusvaara#1{\strut\baselineskip0pt
        \vbox{\baselineskip0pt\ialign{##
                \cr{\hfil\rm\kern-8.9em
                                \tibsp\char0
                         \rm\kern-9em\hfil}
                \cr{#1}\cr
        }}}



% Fonts

\font\tibetan=gtib
\font\tibsp=gtibsp



% Manual ligature definitions


\def\aa{\strut
	\vtop{\baselineskip0pt\ialign{##
		\cr{\tibetan\char29}
		\cr{\hfil\rm\kern-8.7em
				\tibetan\char22
			 \rm\kern-9em\hfil}
		\cr
	}}}

\def \rya{\vtop{\baselineskip0pt\hbox{\tibetan\char24}\hbox{\tibsp\char4}}}
\def \hya{\vtop{\baselineskip0pt\hbox{\tibetan\char28}\hbox{\tibsp\char4}}}
\def \dzra{\vtop{\baselineskip0pt\hbox{\tibetan\char18}\hbox{\tibsp\char127}}}



% Sam Sirlin's \endsym
\def \visarga{
\vtop{\ialign{##\cr
{\tibsp\char0}\cr
\noalign{\kern -2pt\nointerlineskip}
{\hskip1pt\bf-}\cr
\noalign{\nointerlineskip}
{\tibsp\char0}\cr }} 
}

% From Sam Sirlin
\input{tibdef.tex}

% LaTeX Preamble

\documentclass[a4paper]{article}
\begin{document}

\parindent=0pt
\parskip=0pt
\sloppy





