%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% atrans.sty
% transcription module for ArabTeX
% ZDMG Transkription 
% 13.07.94
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Klaus Lagally
%     Institut fuer Informatik
%     Universitaet Stuttgart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ifx \transatcode \undefined \else \xpa \endinput
\fi

\chardef \transatcode = \catcode`\@            \catcode`\@ = 11

\version = {3.02}  		\datum = {13.07.94} 
\message {\the\version }	\message {(\the\datum )}

\edef \arabtexconfig {\arabtexconfig 
atrans.sty \the\version \space (\the\datum) }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\gdef \a@trans #1>{% transcribe word 
\iftest@trans \iftest@scan \else \a@verb (#1)>\fi
\tracingmacros=1 \fi
\if@was \@vocaltrue \else \@vocalfalse \fi
\tr@aword #1|||>>%
\if@vocal \global \@wastrue \else \global \@wasfalse \fi
\iftest@trans \tracingmacros=0 \fi }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newif \if@vocal

\gdef \tr@aword #1#2{% transcribe rest of word 
\def \next {\tr@aword #2}%
\ifx #1>\let \next \relax \else
\ifx #1|\else
\ifx #1"\else
\ifx #1^\else
\ifx #1--\else 
\ifcat #1-#1\@vocalfalse \else
\ifx #1l\def \next {\tr@l #2}\else
\ifx #1E\def \next {\tr@E #2}\else
\ifx #1e\def \next {\tr@e #2}\else
\ifx #1X\def \next {\tr@X #2}\else
\ifx #1N\def \next {\tr@N #2}\else
\ifx #1U\def \next {\tr@U #2}\else
\ifx #1W\def \next {\tr@W #2}\else
\ifx #1a\def \next {\tr@wasla #1#2}\else
\ifx #1i\def \next {\tr@wasla #1#2}\else
\ifx #1u\def \next {\tr@wasla #1#2}\else
\ifx #1\a@a \def \next {\tr@A \kill@alif #2}\else
	\@vocalfalse \csname tr@\string #1\endcsname
\fi\fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi\fi\fi\fi\fi \next }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\gdef \kill@alif #1{% delete alif or waw after N, U, W, _a 
\let \next \tr@aword 
\ifx #1a\else \ifx #1A\else \ifx #1I\else \ifx #1Y\else \ifx #1U\else
\def \next {\tr@aword #1}%
\fi\fi\fi\fi\fi \next }

\gdef \killw@w #1{% delete w after _h in Persian
\def \next {\tr@aword #1}\@vocalfalse 
\ifiz@fet \ifx #1w\let \next \tr@aword
\fi\fi \next }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\gdef \tr@l #1#2#3{% test assimilation after l
\ifx #1-% l -
   \ifx #2l% l - l
      l-l\ifx #3l% l - ll
            \let \next \tr@aword
         \else \def \next {\tr@aword #3}%
         \fi \else
   \ifx #2Q% l - '
      l-\tr@Q \let \next \tr@aword \else
   \ifx #2#3% l - x x
      \def \next {\tr@aword #2-#3}%
   \else
   l-\def \next {\tr@aword #2#3}%
   \fi\fi\fi
\else l\def \next {\tr@aword #1#2#3}%
\fi \@vocalfalse \next }

\gdef \tr@wasla #1{% initial vowel
\ift@rk #1\else \ifh@mza \if@vocal '\else #1\fi \else #1\fi\fi 
\@vocaltrue \tr@aword }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\gdef \s #1{\oalign{#1\crcr\hidewidth % accent for _h
    \vbox to.2ex{\hbox{\kern-0.25em\char'25}\vss}\hidewidth}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def \tr@def #1#2{% define \tr@#1 as {#2}
\xpa \gdef \csname tr@\string #1\endcsname {#2}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\catcode `\ =9 \catcode `\^^M=9 \catcode `\^^I=9
\gdef \tr@zdmg {% define character macros for transliteration
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef \tr@@ {{$\bullet $}}% substitute for illegal characters
\gdef \tr@b {b}	\gdef \tr@c {c}	\gdef \tr@d {d}	
\gdef \tr@e ##1{% test for ee -> ey
	\def \next {\tr@aword ##1}\@vocaltrue
	\ifx ##1e\let \next \tr@aword ey\-\else e\fi \next}
\gdef \tr@f {f} \gdef \tr@g {g}	\gdef \tr@h {h}	\gdef \tr@j {\v{z}} 
\gdef \tr@k {k} \gdef \tr@m {m}	\gdef \tr@n {n}	\gdef \tr@o {o\@vocaltrue }
\gdef \tr@p {p}	\gdef \tr@q {q}	\gdef \tr@r {r}	\gdef \tr@s {s}
\gdef \tr@t {t}	\gdef \tr@v {v}	\gdef \tr@w {w}	\gdef \tr@x {\v{s}}
\gdef \tr@y {y}	\gdef \tr@z {z}
\gdef \tr@A {\=a\-\@vocaltrue }	\gdef \tr@B {}	\gdef \tr@C {\b{t}}
\gdef \tr@D {\d{d}}	\gdef \tr@E ##1{% test for Ee -> ey
	\def \next {\tr@aword ##1}\@vocaltrue
	\ifx ##1e\let \next \tr@aword ey\else \=e\fi \-\next}
\gdef \tr@F {\b{d}}	\gdef \tr@G {\v{g}}
\gdef \tr@H {\d{h}}	\gdef \tr@I {\={\i}\-\@vocaltrue }
\gdef \tr@J {\v{c}}	\gdef \tr@K {\~n}	\gdef \tr@L {y}
\gdef \tr@M {\tr@@ }	\gdef \tr@N {n\@vocalfalse \kill@alif }
\gdef \tr@O {\=o\-\@vocaltrue }
\gdef \tr@P {\-\kern.1em$\lhook $\kern-.05em}
\gdef \tr@Q {\kern.05em$\rhook $\kern-.1em\let \next \tr@aword }
\gdef \tr@R {\.g}	\gdef \tr@S {\d{s}}	\gdef \tr@T {t}
\gdef \tr@U {\=u\-\@vocaltrue \kill@alif }	\gdef \tr@V {\d{t}}	
\gdef \tr@W {w\@vocalfalse \kill@alif }	\gdef \tr@X {\s{h}\killw@w }	
\gdef \tr@Y {\=a\-\@vocaltrue }	
\gdef \tr@Z {\d{z}}
\tr@def \a@b {\d{b}}	\tr@def \a@c {\'c}	\tr@def \a@d {\'d}
\tr@def \a@e {\'d}	\tr@def \a@f {\d{f}}	\tr@def \a@g {g}
\tr@def \a@h {h}	\tr@def \a@i {\={\i}\-\@vocaltrue }
\tr@def \a@j {\"{\i}\@vocaltrue }		\tr@def \a@k {k}
\tr@def \a@l {\~l}	\tr@def \a@m {k}	\tr@def \a@n {\d{n}}
\tr@def \a@o {u\@vocaltrue }			\tr@def \a@p {$\eta$}
\tr@def \a@q {\'r}	\tr@def \a@r {\'r}	\tr@def \a@s {\'s}
\tr@def \a@t {\'t}	\tr@def \a@u {\=u\-\@vocaltrue }
\tr@def \a@v {\'t}	\tr@def \a@w {{u}\@vocaltrue }
\tr@def \a@x {\tr@@ }	\tr@def \a@y {y}	\tr@def \a@z {\'z}
\tr@def \a@A {e\@vocaltrue }			\tr@def \a@B {\tr@@ }
\tr@def \a@C {\'c}	\tr@def \a@D {\v{d}}	\tr@def \a@E {\v{e}}
\tr@def \a@F {f}	\tr@def \a@G {\'c}	\tr@def \a@H {h}
\tr@def \a@I {\"{\i}\@vocaltrue }		\tr@def \a@J {\.g}
\tr@def \a@K {\d{k}}	\tr@def \a@L {k}	\tr@def \a@M {k}
\tr@def \a@N {\d{n}}	\tr@def \a@O {u\@vocaltrue }	
\tr@def \a@P {\={u}\@vocaltrue }		\tr@def \a@Q {q}	
\tr@def \a@R {\.r}	\tr@def \a@S {\'s}	\tr@def \a@T {\'t}
\tr@def \a@U {u\@vocaltrue }			\tr@def \a@V {v}
\tr@def \a@W {o}	\tr@def \a@X {\tr@@ }	\tr@def \a@Y {\=e\-}
\tr@def \a@Z {\'s}
\global \tr@nstrue }}% end \tr@zdmg

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\catcode `\ =9 \catcode `\^^M=9 \catcode `\^^I=9
\gdef \tr@encisl {% define Enc. of Islam transliteration
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tr@zdmg    		\let \@ub \underbar	
\def \tr@j {\@ub{zh}}	\def \tr@x {\@ub{sh}}
%\def \tr@q {\d{k}} % variant qaf; uncomment if required
\def \tr@C {\@ub{th}}	\def \tr@F {\@ub{dh}}	\def \tr@G {j}
\def \tr@J {\@ub{ch}}	\def \tr@R {\@ub{gh}}	
%\def \tr@P {$^c$} % variant `ain; uncomment if required
\def \tr@X {\@ub{kh}\killw@w }
\message {Encyclopedia of Islam transliteration.}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\catcode `\ =9 \catcode `\^^M=9 \catcode `\^^I=9
\gdef \tr@turk {% define character macros for modern Turkish
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tr@zdmg	
\gdef \tr@e {e\@vocaltrue \tr@aword }	\gdef \tr@q {k}	
\gdef \tr@w {v}		\gdef \tr@x {\c{s}}
\gdef \tr@A {\^a\@vocaltrue }	\gdef \tr@E {\^e\@vocaltrue \tr@aword }
\gdef \tr@G {c}	\gdef \tr@H {h}	\gdef \tr@I {\^{\i}\@vocaltrue }		
\gdef \tr@J {\c{c}}	\gdef \tr@K {n}		
\gdef \tr@O {\^o\@vocaltrue }	\gdef \tr@P {\-}	
\gdef \tr@R {g}		\gdef \tr@S {s}		\gdef \tr@T {t}
\gdef \tr@U {\^u\@vocaltrue \kill@alif }
\gdef \tr@V {t}		\gdef \tr@Z {z}
\tr@def \a@j {{\i}\@vocaltrue }		
%\tr@def \a@j {\^u\@vocaltrue }		
\tr@def \a@m {\u{g}}	\tr@def \a@w {{\"u}\@vocaltrue }
\tr@def \a@A {\"a\@vocaltrue }		\tr@def \a@H {}	
\tr@def \a@I {{\i}\@vocaltrue }		\tr@def \a@J {\u{g}}	
\tr@def \a@L {g}	\tr@def \a@M {n}	
\tr@def \a@O {\"o\@vocaltrue }
\tr@def \a@P {{\"o}\@vocaltrue }	\tr@def \a@Q {q}
\tr@def \a@U {\"u\@vocaltrue }		\tr@def \a@V {v}
\message {modern Turkish transliteration.}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def \a@zdmg {zdmg}	\def \a@turk {turk}	\def \a@encisl {english}	

\def \settrans #1{\def \next {#1}% switch the transcription mode
\ifx \next \a@zdmg \message {ZDMG transliteration.}\tr@zdmg \else
\ifx \next \a@standard \message {ZDMG transliteration.}\tr@zdmg \else
\ifx \next \a@encisl \tr@encisl \else
\ifx \next \a@turk \tr@turk \else 	
	\message {ZDMG transliteration assumed.}\tr@zdmg 
\fi\fi\fi\fi }

\settrans {zdmg}% default

\catcode`\@ = \transatcode

\endinput
%%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
