% tipaman.sty for TIPA Manual

\def\Sep{}

\input{boxchar.sty}

\newif\ifmainitem 
\newif\iftimes \timesfalse

{\newcommand\@@ptm@@@{ptm}%
 \ifx\rmdefault\@@ptm@@@ \global\timestrue\fi}

\def\ip@item#1#2#3#4#5#6#7{{\leavevmode
  \hbox to \textwidth{%
    \setbox\z@\singleframebox{#1}{\hugeTipa}\dimen\z@\ht\z@
    \dimen\@ne\hsize \advance\dimen\@ne-\wd\z@ \advance\dimen\@ne-1.5em
    \setbox\@ne\hbox{\vbox{%\hsize=1.5em
      \edef\symcode{\ifx\empty#7\empty Macro\else#7\fi}%
      \ifmainitem\else\edef\symcode{\underline{\symcode}}\fi
      \hbox to\z@{\hss\scriptsize\textit{\symcode} }}}
    \setbox\tw@\hbox{\vbox{\hsize=\the\dimen\@ne
      {\large #2}\ifx\empty#3\empty\else\quad\textit{Usage}: #3\fi\par
      \ifx\empty#5\empty\textit{Input}: \texttt{#4}\else
      \textit{Input1}: \texttt{#4}\quad\textit{Input2}: \texttt{#5}\fi\par
      \textit{Sources}: #6
      }}%
    \dimen\@ne\dimen\z@ \advance\dimen\@ne-\ht\@ne
    \dimen\tw@\dimen\z@ \advance\dimen\tw@-\ht\tw@
    \raise\dimen\@ne\hbox{\unhbox\@ne}\unhbox\z@\hfill
    \raise\dimen\tw@\hbox{\unhbox\tw@}%
    }}}

\def\ipaitem{\mainitemtrue\ip@item}
\def\ipxitem{\mainitemfalse\ip@item}

\def\usage{\@ifstar{\nonipausage}{\ipausage}}
\def\nonipausage{Usage: }
\def\ipausage{{\itshape IPA usage:} }
\def\ipaall{IPA '49--'96}
\def\ipaold{IPA '49, '79}
\def\ipanew{IPA '89--'96}
\def\psg#1{\PSG\ p.\#1}

\def\tbs{{\ttfamily\char'134}}
\def\tbi{{\ttfamily\char'173}}
\def\tbii{{\ttfamily\char'175}}
\def\ttilde{{\ttfamily\char'176}}
\def\tcircum{{\ttfamily\char'136}}
\def\TT#1{\tbi #1\tbii}
\def\TD#1#2{\tbs #1\tbi #2\tbii}
\def\Td#1#2{\texttt{\TD{#1}{#2}}}
\def\Tt#1{\texttt{\tbs #1}}

\def\PSG{\textsl{PSG}}
\def\Handbook{\textsl{Handbook}}
\def\New{\textbf{\textsf{New!}}}

\newcount\excnt
\def\@inout{i}
\def\yitem{\if i\@inout
 \item[{\itshape Input\/}:]\def\@inout{o}\else
 \par\nobreak\item[{\itshape Output\/}:]\def\@inout{i}\fi}

\newenvironment{tipaexample}{%
  \begin{list}{}{\excnt=1%
  \setlength\labelsep{1em}%
  \setlength\labelwidth{5em}%
  \setlength\leftmargin{6.5em}%
  \setlength\parsep{0pt}}}%
  {\end{list}}

\def\xitem{\if i\@inout
 \item[{\itshape Input \the\excnt\/}:]\def\@inout{o}\else
 \par\nobreak\item[{\itshape Output \the\excnt\/}:]\def\@inout{i}%
 \global\advance\excnt by1\fi}

\def\labelenumi{(\theenumi)}
\newenvironment{Quote}{\begin{quote}}{\end{quote}}

\let\mc\multicolumn

\newskip\sloppyspaceamount
\newcommand\sloppyspace{\setbox0\hbox{ }%
  \sloppyspaceamount=\wd0 plus 2\wd0 minus .5\wd0
  \hskip\sloppyspaceamount}

\newcount\codecnt
\newcommand\tipaallchars[1]{{%
  \hrule width \textwidth \par\medskip
  \noindent\font\test=#1\test
  \codecnt=0 \loop \char\the\codecnt\sloppyspace
    \ifnum\codecnt<255 \advance\codecnt by 1 \repeat
  \par\medskip\hrule width \textwidth}}

\newcommand\tipxallchars[1]{{\par\medskip\sloppy
  \noindent\font\test=#1\test
  \codecnt=0 \loop \char\the\codecnt\sloppyspace
    \ifnum\codecnt<8 \advance\codecnt by 1 \repeat
  \codecnt=32 \loop \char\the\codecnt\sloppyspace
    \ifnum\codecnt<72 \advance\codecnt by 1 \repeat
  \codecnt=80 \loop \char\the\codecnt\sloppyspace
    \ifnum\codecnt<83 \advance\codecnt by 1 \repeat
  \codecnt=112 \loop \char\the\codecnt\sloppyspace
    \ifnum\codecnt<123 \advance\codecnt by 1 \repeat
  \par\medskip\hrule width \textwidth}}

\newcommand\sampletexti[1]{\begin{flushleft}#1
  D@ "nO;T "wInd @nd D@ "s2n w@ dIs"pju;tIN wItS w@z D@ "str6Ng5,
  wEn @ "tr\ae vl5 keIm @"l6N "r\ae pt In @ "wO:m "kloUk. DeI
  @"gri:d D@t D@ "w2n hu; f3;st s@k"si;dId In "meIkiN D@ "tr\ae vl5
  teIk hIz "kloUk 6f SUd bI k@n"sId@d "str6Ng@ D@n DI "2D@.
\end{flushleft}}

\newcommand\sampletextii[1]{\begin{flushleft}#1
  la bi:z e l sOlE:j s@ dispytE, Sak\~{\oe} asyr\~A k il etE l ply
  fO:r, k\~At iz \~O vy \~{\oe} vwajaZ\oe:r ki s av\~AsE, \~AvlOpe
  d\~A s\~O m\~Ato. i s\~O t\~Obe dakO:r, k@ s@lyi ki arivE
  l pr@mje a fEr ote s\~O m\~Ato o vwajaZ\oe:r, s@rE rgarde kOm
  l ply fO:r.
\end{flushleft}}

\newcommand\sampletextiii[1]{\begin{flushleft}#1
  "PaInst St\;RIt@n zI\c{c} "nOKtvInt PUnt "zOn@, "ve:\;R fOn Pi;n@n
  "baId@n vo:l d5K "StEKk5\;R@ vE:\;R@, PAls PaIn "vAnd5\;R5K, de:K
  PIn PaIn@n vAKm@n "mAnt@l g@"hYlt va:K, d@s ve:g@s da:"he:K ka:m.
  zi; vUKd@n "PaIni\c{c}, dAs "de:Kje:nIg@ fy:K d@n "StEKk5\;R@n
  gElt@n zOlt@, de:K d@n "vAnd5\;R5K "tsvIN@n vyKd@, zaIn@n "mAnt@l
  "PAptsu;ne:m@n.
\end{flushleft}}

\newcommand\sampletextiv[1]{\begin{flushleft}#1 \let\H\textcrh
  marra S Samsi wi r ri:\H\ ka:nu bi jitxanPum Pinhu l PaPwa fi:hum.
  u baQde:n Sa:fu ra:gil sa:ji\H\ gaj mim baQi:d mitlaffaQ bi
  Qaba:ja tPi:la. fa ttafaPum Qala Pin illi jixalli:h jiPlaQ il
  Qaba:ja fi l Pawwal jiku:n huwwa PaPwa mit ta:ni.
\end{flushleft}}

\newcommand\sampletextv[1]{\begin{flushleft}#1
  upepo ulikuwa uki\!biSana na \*fua kuwa nani mweNe Nguvu kupita
  mwenziwe, mara akapita masafiri alijekuwa amevaa \*fu\!ba. walipatana
  kuwa atakajemvua \*fu\!ba kwanza msafiri ndije mweNe Nguvu.
\end{flushleft}}

\newcommand\bseries{\fontseries{b}\selectfont}
\newcommand\rmtipa{\renewcommand\rmdefault{cmr}\renewcommand\sfdefault{cmss}}
\newcommand\rmxipa{\renewcommand\rmdefault{ptm}\renewcommand\sfdefault{phv}}

\newcount\rotatetextcnt \rotatetextcnt=0

\newcommand\sampletext{%
 \edef\@rotatetextcnt{\the\rotatetextcnt }%
 \ifcase\@rotatetextcnt\def\@sampletext{\sampletexti}\or
  \def\@sampletext{\sampletextii}\or\def\@sampletext{\sampletextiii}\or
  \def\@sampletext{\sampletextiv}\or\def\@sampletext{\sampletextv}\fi
 \global\advance\rotatetextcnt by 1
 \ifnum\the\rotatetextcnt=5 \global\rotatetextcnt=0 \fi
 \@sampletext}

\endinput
