#!/bin/sh 
ttt input.ttd tex.ttd $0 test.tex; latex test; rm test.tex; exit

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

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

\section{Additional Features}
\begin{description}
\item[Q:] There are now already two \LaTeX\ implementations of the Tibetan language.
  Why is there now a third one?
\item[A:] Like other typesetting programs, the above implementations make use of predefined
  ligatures only. If you try to enter prayers containing Sanskrit syllables into
  such a system, you will get into severe trouble. Therefore, I added now a completely new
  transcript preprocessor having the following extra features:
\item[Compatibility:] As far as I know, it supports all control sequences of the above 
  implementations, plus the ACIP transcript. If you have yet another transcript, you can
   create your own transcript definition file, hopefully without having to modify the C code.
\item[Inline \LaTeX\ commands:] All commands that do not contain spaces or such can be
  typed without using the mode switching characters({\tt \%\%}). Even the tabbing character
  ({\verb|&|}) is transparent. So you can easily typeset tabular environments and line breaks.
\item[Generic Ligatures:] If this preprocessor encounters any ligatures which are not predefined,
  it tries to compose them automatically. There is still much work to be done on this:
  \begin{itemize}
	\item There are some spacing problems to solve on \LaTeX\ level
    	\item Adding intelligence for character mutations
	\item Font definition for character fragments
	\item Font definition for vertically smaller characters
  \end{itemize}
  Especially syllables like %% /tutt'a ra/ %% \ do not look very nice and need too much vertical 
  space. But in many cases, the output is quite readable and the input very simple 
  (e. g. {\verb| /tutt'a ra/|}).

 
\end{description}


\section{How to use it}
\subsection{General Command Line Handling}
In fact, it is very similar to the previous implementations:
You have the usual \LaTeX\ procedure plus an additional preprocessor program
between editing and \LaTeX ing, which interprets a transcript described below,
generating Tibetan characters and ligatures.

\pagebreak

There is some extra complication concerning the command line parameters:
{\tiny\begin{verbatim}
   STARTING THIS PROGRAM
   ---------------------
   In order to translate ACIP to LaTeX, use

   ttt acip.ttd latex.ttd input.tib output.tex

   where acip.ttd   is the input  transcript definition file   
   .     latex.ttd  is the output transcript definition file
   .     input.tib  is your ACIP input text
   .     output.tex is the output file to be processed by latex
 
   On Linux, you will enjoy the feature of magic line support:
   In your input.tib file, add the following two lines at the
   VERY TOP (replacing the respective filenames):

   #!/bin/sh
   ttt acip.ttd latex.ttd $0 output.tex; latex output; exit

   Due to the magic line at the top, (ba)sh will think that your text 
   input.tib is a shell script, executing the 2nd line. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   This program will ignore the FIRST AND THE SECOND 
   line if the FIRST line starts with #!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   Do not put anything, even not comments above these lines. 
   $0 is automatically replaced by the file name (e.g. input.tib).

   Then turn your input.tib file into an executable by
   chmod 755 input.tib

   Now, you can start this program by entering 
   input.tib
   at the shell command prompt.

   DOS users, please write an apropriate *.BAT file (without $0). 
   Windows users may set the command line options as program properties.
\end{verbatim}}

\subsection{Which ttd files to use}

At present, {\tt input.ttd} and {\tt acip.ttd} can be used as input transcript definitions
only. Use {\tt input.ttd} for any texts supplied by Jeff Sparkes and Sam Sirlin and this
package (ending in {\tt .tib}). {\tt acip.ttd} only for ACIP texts. You easily recognize 
them by their having an UPPERCASE TRANSCRIPT.

{\tt tex.ttd} and {\tt latex.ttd} are the output transcript definitions. Use {\tt latex.ttd}
{\bf only} for ACIP texts. It includes a document preamble and postamble for LaTeX. In
all other cases, I recommend you to include the preamble and postamble into the source file
and use {\tt tex.ttd}.

\section{Transcription}
\subsection{Note}
The upper lines show the transcript used by Jeff Sparkes and Sam Sirlin.
The lower lines show the ACIP transcription. Please note the difference marked by {\bf(!)}.
Of course, punctuation and spacing are completely different.
For \LaTeX, I recommend the transcript in the upper lines, since this transcript definition
supports the full power of the ligature generator.

\subsection{Single Characters and Vovels}

%%

\begin{tabular}{ccccccc}

ka & kha & ga & nga \\*
\tt{ka} & \tt{kha} & \tt{ga} & \tt{nga} \\*
\tt{KA} & \tt{KHA} & \tt{GA} & \tt{NGA} \\[0.5cm]

ca & cha & ja & nya \\*
\tt{ca} & \tt{cha} & \tt{ja} & \tt{nya} \\*
\tt{CA} & \tt{CHA} & \tt{JA} & \tt{NYA} \\[0.5cm]

ta & tha & da & na \\*
\tt{ta} & \tt{tha} & \tt{da} & \tt{na} \\*
\tt{TA} & \tt{THA} & \tt{DA} & \tt{NA} \\[0.5cm]

pa & pha & ba & ma \\*
\tt{pa} & \tt{pha} & \tt{ba} & \tt{ma} \\*
\tt{PA} & \tt{PHA} & \tt{BA} & \tt{MA} \\[0.5cm]

tsa & tsha & dza & wa \\*
\tt{tsa} & \tt{tsha} & \tt{dza} & \tt{wa} & \tt{\bf(!)}\\*
\tt{TZA} & \tt{TSA}  & \tt{DZA} & \tt{WA} & \tt{\bf(!)} \\[0.5cm]

zha & za & 'a & ya \\*
\tt{zha} & \tt{za} & \tt{'a} & \tt{ya} \\*
\tt{ZHA} & \tt{ZA} & \tt{'A} & \tt{YA} \\[0.5cm]

ra & la & sha & sa \\*
\tt{ra} & \tt{la} & \tt{sha} & \tt{sa} \\*
\tt{RA} & \tt{LA} & \tt{SHA} & \tt{SA} \\[0.5cm]

 & ha & a \\*
 & \tt{ha} & \tt{a} \\*
 & \tt{HA} & \tt{A} \\[1cm]

a & i & u & e & o & * & aa \\
\tt{a} & \tt{i} & \tt{u} & \tt{e} & \tt{o} & \tt{*} & \tt{aa} \\*
\tt{A} & \tt{I} & \tt{U} & \tt{E} & \tt{O} \\[1cm]

txa & thxa & dxa & nxa & shxa & kshxa \\*
\tt{txa} & \tt{thxa} & \tt{dxa} & \tt{nxa} & \tt{shxa} & \tt{kshxa} \\

\end{tabular}

%%

\subsection{Punctuation Marks and Spacing Control}

%%
\begin{tabular}{ccccccc}
/ & ! & , & \rm{suppress`} ,\rm{'} & \rm{shad~space} & \swasti & :      \\*
\tt{/} & \tt{!} & \tt{,} & \tt{\#} & \tt{|} & \verb|\swasti|   & \tt{:} \\*
\tt{,} &        &        &         &        & \tt{*~(?)}         \\[0.5cm]

\end{tabular}
%%

% \subsection{Combined Letters or Ligatures}
% %%
% \begin{tabular}{cccccc}
% na & mo & gu & ru & bhya:| & na mo gu ru bhya:| \\*
% \tt{na} & \tt{mo} & \tt{gu} & \tt{ru} & \verb#bhya:|# 
% \end{tabular}
% 

%%

\section{Examples}
\subsection{Explicit Ligature Control}
\begin{tabular}{ccccccl} %%
gyin      & g-yin      & gyas      & g-yas      & ddha      & -ddha \\* %%
\tt{gyin} & \tt{g-yin} & \tt{gyas} & \tt{g-yas} & \tt{ddha} & \tt{-ddha}\\
\end{tabular}

\subsection{Generic Ligatures}
%%
\begin{tabular}{ccccccl}
o* & ma & nxi & padme & h'u* & hr'i:| & o* ma nxi padme h'u* hr'i:| \\*
\tt{o*} & \tt{ma} & \tt{nxi} & \tt{padme} & \tt{h'u*} & \verb#hr'i:|#
& \rm{Yet~another~spacing~bug!}
\end{tabular}

% \begin{center} 
% /o* ma nxi padme h'u* hr'i:| 
% \rm{Cheap~workaround}
% \end{center}

\begin{tabular}{cccccr}
na & mo & gu & ru & bhya:| & na mo gu ru bhya:| \\*
\tt{na} & \tt{mo} & \tt{gu} & \tt{ru} & \verb#bhya:|# & \hspace*{5cm}
\end{tabular}

\begin{tabular}{ccccr}
na & mo & buddha & ya/ & na mo buddha ya/ \\*
\tt{na} & \tt{mo} & \tt{buddha} & \tt{ya/} & \hspace*{5.5cm}
\end{tabular}

\begin{tabular}{ccccr}
na & mo & dharm'a & ya/ & na mo dharm'a ya/ \\*
\tt{na} & \tt{mo} & \tt{dharm'a} & \tt{ya/} & \hspace*{5cm}
\end{tabular}

\begin{tabular}{ccccr}
na & mo & sanggha & ya/ & na mo sanggha ya/ \\*
\tt{na} & \tt{mo} & \tt{sanggha} & \tt{ya/} & \hspace*{5cm}
\end{tabular}


\begin{tabular}{ccccr}
/o* & aa: & h'u*/ & &  /o* aa: h'u*/ \\*
\tt{/o*} & \tt{aa:} & \tt{h'u*/} &  & \hspace*{5cm}
\end{tabular}


%%

\end{document}