%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%        File: mnttex.tex
%      Author: Oliver Corff
%        Date: December 26, 2004
%     Version: \VersionRelease
%   Copyright: Ulaanbaatar, Beijing, Berlin
%
% Description: Core documentation the the MNTTeX system, providing
%		commands necessary for writing Sino-Mongolian
%		text as in the "Secret History of the Mongols".
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This file contains utf8-encoded material. While editing it
% in non-Unicode environments may break the display of Chinese
% characters, the compile process is safe as all character-
% producing commands are expressed in ASCII-only form.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\documentclass[a4paper,12pt]{report}
\usepackage{url,multicol}	% generic material
\usepackage{mnt}		% the new package documented here
%
\newcommand\exa{\nopagebreak \begin{flushleft}\smallskip \nopagebreak
                \begin{minipage}[t]{6cm}\sloppy\kern0pt}%
\newcommand\exb{\end{minipage}\kern 1cm\begin{minipage}[t]{8cm}\sloppy\kern0pt}%
\newcommand\exc{\end{minipage}\kern -3cm \smallskip\end{flushleft}}%
%
\providecommand{\g}{$\gamma$}
%
\psscalebase=155sp	% Modify this value if some Chinese
			% characters appear uneven in size
%
\title{\MNT\TeX\\Tools for Typesetting the\\
	\textsc{Secret History of the Mongols}\\[2mm]
	\normalsize Version 0.3}
\author{Oliver Corff}
\begin{document}
\maketitle
\begin{abstract}
	The \MNT\TeX\ package assists the scholar typesetting the
	complex Chinese material of The Secret History of the
	Mongols (\textit{Mong\g ol-un ni\g uca tobciyan}) by
	accessing all characters either by number or pronounciation
	as well as offering convenient access to small and combined
	characters.
\end{abstract}
\tableofcontents
\chapter{Documentation}
\section{Introduction}

The Secret History of the Mongols
(\textit{Mong\g ol-un ni\g uca tobciyan} --- hence the abbreviation MNT)
is the oldest work of Mongolian literature surviving today.
Though the language of the text is Middle Mongolian, the text 
was written entirely in Chinese characters which were used
to render Mongolian phonetically.

The complete reconstruction of the underlying Middle Mongolian
text has been a scholarly endeavour which mainly took place in
the late 19th and early 20th centuries while research on particular
issues of the text, its language and lexicon, is widely continued
today.

\enlargethispage{2ex}
Modern tools for typing, editing and typesetting Chinese do not easily 
lend themselves for preparing research documentation due to two pecularities
of the historical source:
\begin{itemize}
	\item	Despite the limited set of characters used in
		in the Secret History (only about 520 characters),
		a considerable number of characters occurs virtually
		only in this text and was never coded in internationally
		used CJK character sets;

	\item	Special, small characters are used to modify the 
		pronounciation of the main character to which they are
		attached. Some scholars consider these pairs of main
		character and small modifying character
		as inseparable entities. However, due to the limited
		number of modifying characters and their uniform use,
		they are also frequently regarded as diacritics.
\end{itemize}

The \MNT\TeX\ package assists the scholar typesetting the complex 
Chinese material by accessing all characters either by number
or pronounciation as well as offering convenient access to small
or combined characters.

\section{Technical requirements}% of the \MNT\TeX\ package}

The \MNT\TeX\ package relies on an existing environment for processing
Chinese characters and assumes that the package CJK is installed\footnote{%
	The CJK package is available at \url{ctan:language/chinese}}, since,
technically speaking, \MNT\TeX\ is little more than a wrapper around
the CJK package.
Furthermore it is required to use the font \texttt{zysong.ttf} or a
similar font in Song style.  Since not all characters used in the \MNT\
are provided by modern fonts they had to be made for this package. Being
closely modelled according to Song style, these especially made
characters would stand out in stark contrast from e.g. Kaiti style
character sets. Limited in number, these individual characters were
coded as scalable vector images, rather than as font. No difference
between these characters and ordinary characters can be perceived in
print even though the on-screen display may appear less than intelligible.

If these made-up characters appear uniformly in a different size in
comparison to the other Chinese characters, their size can be adjusted
by changing the value of \verb|\psscalebase| in the preamble of the
document.

\section{How to use the \MNT\TeX\ package}
\MNT\ Text material must always
be enclosed in a \texttt{mnt} environment (as in the figure on
page~\pageref{mntenvironment}; for long texts) or \texttt{\char92 textmnt}
capsule (for short texts; see examples further down)
no matter which input method, by syllable or by number, is chosen. Inside
the \verb|mnt| environment or the \verb|textmnt| capsule \MNT\ characters
and ordinary letters can be mixed freely.

\begin{figure}[h]
\begin{center}
\begin{verbatim}
\begin{mnt}
... ... ... ...
... ... ... ...
... ... ... ...
... ... ... ...
\end{mnt}
\end{verbatim}
\caption{\label{mntenvironment}%
	The \texttt{mnt} environment is useful for big portions of text.}
\end{center}
\end{figure}

\MNT\ material can be expressed in a number of ways. The basic models are
input by pronounciation and input by number.
The most important difference between the two input methods is the
usage. Input by pronounciation will always and exclusively return
single Chinese characters while the input by number generates a
character which may only be `complete' if accompanied by its potential
diacritic.

\subsection{Input by pronounciation}

The input by pronounciation model takes a pronounciation and returns
a character with that pronounciation. The pronounciation takes, for
convenience, the modern Hanyu Pinyin system as its base.

The command is in the form of \verb|\<syllable>| or
\verb|\<syllable><selector>|, where 
\verb|syllable| stands for the desired syllable, and \verb|selector|
selects the desired character among all syllables with the same
pronounciation. See section~\ref{pinyin} below for a reference of all
characters available under each pronounciation.

\exa
	\textmnt{\cheng1\ji1\si\han1}\\
	\textit{cinggis xan}
\exb
\begin{verbatim}
	\textmnt{\cheng1\ji1\si\han1}\\
	\textit{cinggis xan}
\end{verbatim}
\exc

It can be seen from the example that not all pronounciations point
to more than one character. If a syllable like \verb|\si| is erroneously
followed by digit, a spurious digit will then appear in the text,
as in \verb|\si1| which results in \textmnt{\si1}. If the syllable
requires a selector and the selector is missing, the following
error message will appear:
\begin{verbatim}
! Missing number, treated as zero.
\end{verbatim}

If there is a selector digit but it is out of range, like in
\verb|cheng4|, the following error message will appear:
\begin{verbatim}
! LaTeX Error: Package MNT: Select between 1 and 3 for syllable cheng.
\end{verbatim}


\subsection{Input by number}

The input by number model takes a number as argument and returns the
character with that number. There are at present two enumeration schemes
available within \MNT\TeX, one by Sum'yaabaatar, one by Bayar.

\subsubsection{Sum`yaabaatar's numbering scheme}

The basis of Sum`yaabaatar's numbering scheme is the
enumerated list of characters found in his edition of the
\MNT\footnote{B.~Sum`yaabaatar, ed.: {\em Mong\g ol-un Ni\g uca Tobciyan.
	\"Usgi\"{\i}n galig}.
	Ulsyn X\"awl\"ali\"{\i}n Gazar, Ulaanbaatar 1990, p. 927--953}.
Sum`yaabaatar counts the characters in the order in which they
appear for the first time in text and takes differences of pronounciation
into account. It may thus be that a character has two or even three
different positions in Sum`yaabaatar's arrangement. In the majority
of these cases pronounciation is differentiated by a small modifier
character acting as pronounciation marker and diacritic. Hence, the
potential return value of a number in Sum`yaabaatar's system is not
necessarily a canonical character but a combination of diacritic and
character.

See section~\ref{sumyaabaatar} below for a full list of all characters
and combinations. The following example shows the title of the \MNT\
in Chinese characters. It can be seen from the example that the small
character \textmnt{\sn{161}} is reduced to its consonant value. The
brackets indicate that this character was inserted later; the high
index number (161) indicates that this character has its first original
appearance far later in the text.

\exa
	\textmnt{\sn{1}\sn{2}\sn{3}\sn{4}%
		\sn{5}\sn{6}(\sn{161})\sn{5}\sn{7}}\\
	\textit{mong\g ol-un ni\g uca to(b)ciyan}
\exb
\begin{verbatim}
	\textmnt{\sn{1}\sn{2}\sn{3}\sn{4}%
		\sn{5}\sn{6}(\sn{161})\sn{5}\sn{7}}\\
	\textit{mong\g ol-un ni\g uca to(b)ciyan}
\end{verbatim}
\exc

\subsubsection{Bayar's numbering scheme}

Bayar's positioning scheme\footnote{%
	Bayar, ed.: {\em Monggol-un ni\g uca tobciyan}.
	Neimenggu Renmin Chubanshe, Huhehaote, Xincheng Xijie 82 hao, 1980,
	reprint 1998. ISBN: 7-204-02537-7/K.76.}
is radically different from Sum`yaabatar's scheme as he arranges all
syllables by pronounciation, following Chinese tradition by rhyme first,
and by initial as secondary sort key. In further contrast to Sum`yaabaatar,
he does not recount a syllable if it appears in a different context.

See section~\ref{bayar} below for a list of all characters. The following
example shows the title of the \MNT\ again, however since the character
\textmnt{\niu} doesn't appear in Bayar's list it has to added using, e.\,g.,
the pinyin input method.

\exa
	\textmnt{\bn{446}\xooloi\bn{62}\bn{423}\niu%
		\bn{25}\bn{77}({\scriptsize\bn{181}})%
		\bn{25}\bn{345}}\\
	\textit{mong\g ol-un ni\g uca to(b)ciyan}
\exb
\begin{verbatim}
	\textmnt{%
	\bn{446}\xooloi\bn{62}\bn{423}\niu%
	\bn{25}\bn{77}(\scriptsize\bn{181})%
	\bn{25}\bn{345}}\\
	\textit{mong\g ol-un ni\g uca to(b)ciyan}
\end{verbatim}
\exc

\subsection{Input of special characters}

A limited number of diacritical marks is used for indicating a modified
pronounciation of the base character. These are \verb|\textmnt{\xooloi}|
producing a small \textit{zhong} character: \textmnt{\xooloi} which 
is normally combined with characters the (\textit{pinyin}) initials of which
are \textit{h} or \textit{k},
and \verb|\textmnt{\xel}| producing a small \textit{she} character:
\textmnt{\xel} which is usually combined with characters the
(\textit{pinyin}) initial of which is \textit{l}.

Other small characters appearing in the text can be produced with the
\verb|{\scriptsize ...}| command, like \textmnt{\scriptsize\hei}. It is
however always possible to use Sum`yaabaatar's numbering system for
producing combinations of special characters and main characters.


\subsection{Typesetting complete words}

It is also possible to typeset complete words appearing in the \MNT\
using the command
\verb|\mntword{<characters>}{<gloss>}{<transliteration>}|.
Here, 
\verb|<characters>| are the \MNT\ characters to be displayed,
\verb|<gloss>| is the Chinese gloss found in smaller characters
		under the word proper, and
\verb|<transliteration>| is the scholarly interpretation of the
		pronounciation.

Depending on the Chinese encoding used for the gloss, the encoding
must be announced once in the document with the command
\verb|\glossencoding{<encoding>}|. \verb|<encoding>| must be an 
encoding known to CJK. In the following example the UTF8 encoding is
assumed\footnote{Nonetheless, in the example the characters of the
	gloss  (\textmnt{\UC{78}{186}\UC{84}{13}} --- \textit{renming})
	were not entered in native characters, which would have been
	perfectly
	possible but were entered as
	\texttt{\char92 UC\{78\}\{186\}\char92 UC\{84\}\{13\}},
	in order to keep this document as portable as possible with
	regard to any encoding.}.

\exa
\glossencoding{UTF8}
\mntword{\tie1\mu2\zhen}
	{\UC{78}{186}\UC{84}{13}}
	{temujin}
\exb
\begin{verbatim}
\glossencoding{UTF8}
\mntword{\tie1\mu2\zhen}
	{\UC{78}{186}\UC{84}{13}}
	{temujin}
\end{verbatim}
\exc

It ist possible to define one's own range of frequently used words
which can be invoked conveniently.
\exa
\glossencoding{UTF8}
\newcommand{\temujin}{%
	\mntword{\tie1\mu2\zhen}
		{\UC{78}{186}\UC{84}{13}}
		{temujin}
	}
	We write about Temujin, 
	rendered as \temujin.
\exb
\begin{verbatim}
\newcommand{\temujin}{%
	\mntword{\tie1\mu2\zhen}
	{\UC{78}{186}\UC{84}{13}}
	{temujin}}
	We write about Temujin, 
	rendered as \temujin.
\end{verbatim}
\exc

\section{Desiderata}

%\begin{sloppypar}
Several scholars have presented different lists of Chinese characters
used in recording the \MNT, and it is planned to integrate these 
numbering and pronounciation tables into this software at the next
opportunity. This includes also characters from various editions of
the \MNT.

Other problems remain, for which the author takes sole and full
responsibility. Users of this software package are kindly requested to
report any problems to the author at \texttt{oliver.corff@email.de}.
%\end{sloppypar}

%\section{Output of \MNT\ Material}

\chapter{Tables}
\begin{mnt}
\input mntdoc
\end{mnt}

%\bibliographystyle{plain}
%\bibliography{mongol,mnt}
\end{document}
