% Document Type: LaTeX
% Master File: Egypto.tex
\documentstyle[egypto,hiero,12pt]{article}

\title{A \LaTeX periment of hieroglyphic typesetting}
\author{Serge Rosmorduc\\  rosmord@inf.enst.fr}
\def\comment#1{}

\long\def\SHOWHIERO#1{\ }
\long\def\SHOWHIERO#1{#1}
%
% uncomment the line above to see the hieroglyphs 
% after having them installed.

\def\Backslash{$\backslash$}


\begin{document}

\maketitle

  \begin{center}
\begin{hieroglyph}%
{%
\leavevmode\makeatletter%
\cartouche{\boite{\hboiteI{\convertir{\AROBtaille}O/34\relax%%
}\hboite{\convertir{\AROBtaille}D/38\relax%%
}\hboite{\convertir{\AROBtaille}D/21\relax%%
}}\AROBrempl \boite{\hboiteI{\convertir{\AROBtaille}I/11\relax%%
}\hboite{\quartespace }}\AROBrempl \boite{\hboiteI{\convertir{\AROBtaille}E/24\relax%%
}\hboite{\convertir{\AROBtaille}O/34\relax%%
}}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}G/19\relax%%
}\AROBrempl \boite{\hboiteI{\convertir{\AROBtaille}D/21\relax%%
}\hboite{\convertir{\AROBtaille}D/48\relax%%
}}\AROBrempl \boite{\hboiteI{\convertir{\AROBtaille}Z/8\relax%%
}\hboite{\convertir{\AROBtaille}V/31\relax%%
}}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}A/1\relax%%
}}\intermots%
}%
\end{hieroglyph}

  \end{center}
  
\section{Licence}
\begin{center}
     Sesh Nesout, a TeX package for hieroglyphic typesetting
     Copyright (C) 1993 Serge Rosmorduc
\end{center}     
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 1, or (at your option)
     any later version.
     
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABI\-LITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
     
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

\section{Introduction}
	This is a package that allows one to typeset hieroglyphs; one
more ! It is now in a very early stage, but I want to come with a
complete, easy-to-use, general program, that would allow one to build
a database of Egyptian texts, and retrieve information in it. At the
time being, I am quite far from this goal! Yet I think the current
program can be amusing and even useful.   

A second point is that there is also a hieroglyphic font with it. It
should be bettered, but it exists. So, you can use it for your
own programs. There are  both a  metafont and gsf (postscript type I)
fonts. The fonts were made with the GNU fontutils.

\section{Installation}
	You should copy the three style files where they belong; then
make a 1.2, 1, $1/1.2$, $1/(1.2)^2$ magnificated version of each hieroglyphic font. 
(A-Z and Aa.mf)

	You should also build the diacritic fonts diacr7,8,9,10 and
12, and a magstep 0 version of the Egyp font (parts of cartouche and others).
 
	Now, you are ready. You can, if you want to use
it\footnote{You'd better!}, cd to 
SeshNesout and build the sesh program. It is a text to latex
converter, with a glyph-like syntax. If you'd rather do everything in
\LaTeX, make a list of each hieroglyphic font with ``\verb.tex
testfont.''  

\section{Typesetting hieroglyphs}
	To type hieroglyphs, you need two things: the fonts, and the
file \verb|hiero.sty|, which is to be given as an option to the 
\verb/\documentstyle/ macro.

You might also want the {\em Inventaire des signes hieroglyphiques en vue
de leur saisie informatique, \/}~\cite{MANCOD} hereafter called {\em manuel de
codage\/}.
 
\subsection{The hard way}
	To type a hieroglyphic text directly, you can use the 
\verb.\hieroglyphe. macro. You type the signs like this:
\begin{center}
\verb=\hieroglyphe{A/1}= \\
to get:\\  
\hieroglyphe{A/1}
\end{center}
Beware ! the numbers aren't exactly the one in Gardiner's grammar.

	To type a complicated text, you can , almost like in glyph,
type : `\verb=-=' to separate two groups horizontally, and `\verb=:='
to separate two groups vertically.
\begin{center}
  \verb=\hieroglyphe{{Q/3-X/1}:N/1}= \\
	\hieroglyphe{{Q/3-X/1}:N/1}	
\end{center} 
nice, isn't it?

\subsection{An easier way}
There's also a C program, \verb,sesh, that follows more or less the
``manuel de codage''. It can be used to create hieroglyphic texts. I
use it personnally as a filter in emacs. Its name is \verb|sesh| (for
Sesh Nesout Ma\^a ,
\begin{hieroglyph}%
{%
\leavevmode\makeatletter%
\unhieroglyphe{\convertir{\AROBtaille}M/23\relax%%
}\AROBrempl \boite{\hboiteI{\convertir{\AROBtaille}X/1\relax%%
}\hboite{\convertir{\AROBtaille}N/35\relax%%
}}\intermots%
\unhieroglyphe{\convertir{\AROBtaille}Y/3\relax%%
}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}A/1\relax%%
}\intermots%
\boite{\hboiteI{\convertir{\AROBtaille}U/4\relax%%
}\hboite{\convertir{\AROBtaille}D/38\relax%%
}}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}Y/1\relax%%
}\intermots%
}%
\end{hieroglyph}
which was a bit long to type!

To use it, write your \LaTeX\ source with hieroglyphic texts in a
\verb|hieroglyph| environment. Then, use sesh as a filter to obtain a 
\LaTeX able result. As any polite program, sesh reads stdin and writes
on stdout. 

Signs are named, either after their translitterations, ( for example,
\linebreak[4]
\verb|xpr| is \begin{hieroglyph}%
{%
\leavevmode\makeatletter%
\unhieroglyphe{\convertir{\AROBtaille}L/1\relax%%
}}%
\end{hieroglyph}
),%
or after their Gardiner Code. For a complete list, see~\cite{MANCOD}.

You can type adjacent signs with `-' , stack signs with `:', group
signs with parenthesis, and use `\verb.*.' to separate signs on the
same level. \verb/<....>/ writes a cartouche, `\Backslash' inverts a
{\it sign\/}; and \verb|#| \ldots \verb|#| shades a text.

Example:
\begin{center}
\begin{verbatim}
i-w-<ra-mn:n-xpr>-m-aH-a:Z1*pr-f-#-mi-i-#-r:a-ra-C2-m-p*t:pt
\end{verbatim}

\mbox{
\begin{hieroglyph}%
{%
\leavevmode\makeatletter%
\unhieroglyphe{\convertir{\AROBtaille}M/17\relax%%
}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}G/46\relax%%
}\AROBrempl \cartouche{\unhieroglyphe{\convertir{\AROBtaille}N/5\relax%%
}\AROBrempl \boite{\hboiteI{\convertir{\AROBtaille}Y/5\relax%%
}\hboite{\convertir{\AROBtaille}N/35\relax%%
}}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}L/1\relax%%
}}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}G/19\relax%%
}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}O/11\relax%%
}\AROBrempl \boite{\hboiteI{\convertir{\AROBtaille}D/38\relax%%
}\hboite{\convertir{\AROBtaille}Z/1\relax%%
\hfil\convertir{\AROBtaille}O/1\relax%%
}}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}I/10\relax%%
}\hachure{\unhieroglyphe{\convertir{\AROBtaille}W/21\relax%%
}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}M/17\relax%%
}}%
\boite{\hboiteI{\convertir{\AROBtaille}D/21\relax%%
}\hboite{\convertir{\AROBtaille}D/38\relax%%
}}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}N/5\relax%%
}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}C/2\relax%%
}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}G/19\relax%%
}\AROBrempl \boite{\hboiteI{\convertir{\AROBtaille}Q/3\relax%%
\hfil\convertir{\AROBtaille}X/1\relax%%
}\hboite{\convertir{\AROBtaille}N/1\relax%%
}}\intermots%
}%
\end{hieroglyph}
}
\end{center}

\paragraph{Extensions:} There is a limited macro facility. To define a
macro, type 
\begin{verbatim}
#def  MACRONAME Body  
\end{verbatim}
on a line. MACRONAME can be any unused sequence of letters, simple
quote, and point.

This can be useful if a name appears often. Example:

\begin{center}
\tt 
\verb|\begin{|hierogl{}yph\verb|}| % to avoid interpretation !!!!!
\begin{verbatim}
#def 'tA tA:N23*Z1
tr-t:r-n-wn:n:n-k-tp-Z1-'tA
\end{hieroglyph}
\end{verbatim}

\begin{hieroglyph}%
{%
\leavevmode\makeatletter%
\unhieroglyphe{\convertir{\AROBtaille}M/6\relax%%
}\AROBrempl \boite{\hboiteI{\convertir{\AROBtaille}X/1\relax%%
}\hboite{\convertir{\AROBtaille}D/21\relax%%
}}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}N/35\relax%%
}\AROBrempl \boite{\hboiteI{\convertir{\AROBtaille}E/35\relax%%
}\hboite{\convertir{\AROBtaille}N/35\relax%%
}\hboite{\convertir{\AROBtaille}N/35\relax%%
}}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}V/31\relax%%
}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}D/1\relax%%
}\AROBrempl \unhieroglyphe{\convertir{\AROBtaille}Z/1\relax%%
}\AROBrempl \boite{\hboiteI{\convertir{\AROBtaille}N/16\relax%%
}\hboite{\convertir{\AROBtaille}N/23\relax%%
\hfil\convertir{\AROBtaille}Z/1\relax%%
}}}%
\end{hieroglyph}
\end{center}

Note that, once defined, these macroes can be used in all subsequent 
\verb|hieroglyph| environment. 

A few useful definitions: 
\begin{verbatim}
#def Hm' N42
#def bdS A7
#def bin G37
#def arm D40
#def knife T30
#def copper N34
#def di' D37
#def hrw h-r:W*ra-Z1
#def ink nw:k':A1
#def inr O39
#def iw' D54
#def k' V31A
#def nn M22-M22-n:n
#def nxt A24
#def rmn D41
#def king A42
#def sxA A2
#def wnn wn:n:n
\end{verbatim}
\paragraph{\LaTeX\ macros:} If you want the small signs to be on the
baseligne, type \verb|\SurLigne|; the default is to center them. To
switch back to centered signs, type \verb|\Centrer|. In a cartouche,
the text is always centered. You can handle the line-cutting algorithm
by changing the two \TeX\ macros \verb|\AROBrempl| and
\verb|\intermots|; the first rules what is inserted between signs, the
second between words. The default values tend to protect you from
cutting a word, at the cost of some white space. 

\section{Typesetting translitterations and references}
The commands here described are defined in the \verb=egypto.sty= file.

\subsection{Settings}

\begin{description}
  \item[\Backslash Montitre\{...\}] allows you to define the document's title 
 (To be used in Cross-references )

 \item[\Backslash eg] to use the translitteration font

 \item[\Backslash def\Backslash SourceTexte\{Name of the text\}] to tell LaTeX what
text you are  typing

\item[\Backslash def\Backslash EXEMPLE\{example\}] To use this style in english

\end{description}

\subsection{Translitteration}

 There are currently three ways to write some translitteration
 (apart from \verb/\eg/)

\begin{enumerate}
 \item the translit environment:
 it takes 3 arguments: 
\begin{itemize}
	\item name of the text
	\item page number or recto/verso (exxs \verb/{4}/ or \verb/{recto}/
	\item line number(s) (could be column number) (exxs.
\verb/{4}/ \verb/{4-9}/ 
        \item an alternative (possibly empty) reference in free text.
\end{itemize}

 One important thing is that TeX ``understands'' these numbers.
 i.e.\ there are commands to change the line number and the page 
 number. such things are usefull for cross-references

 you can  type a translitteration, and use ``\verb/\traduction/'' to start
 typing the translation.

 Example:

\begin{verbatim}
\begin{translit}{O. foobar XIV}{verso}{10-15}{LES 12,2-5}
  iw.i rx.kw mdw nTr
\traduction
  I know the hieroglyphs
\end{translit}
\end{verbatim}
 \begin{translit}{O. foobar XIV}{verso}{10-15}{LES 12,2-5}
 iw.i rx.kw mdw nTr
 \traduction
 I know the hieroglyphs
 \end{translit}

 \item the exemple environment.
 a translit environment with the word ``Exemple'' in front of 
 it, and numbered . To write ``example'',  use \linebreak[4]
 \verb/\def\EXEMPLE{Example}/

 these two environments write a line in ``\verb/*.dic/'' where \verb/*/
 is the name of your TeX file.

 ``translit'' writes:
\begin{verbatim}
 \Citation{name of the source}{references}{document's title}{
			page number in document}
\end{verbatim}

 ``exemple'' writes:
\begin{verbatim}
 \Exemple{name of the source}{references}{document's title}
	  {exemple number}{page number in document}
\end{verbatim}
(all on the same line)

\item the \verb/\traduction{}{}/ macro. It takes two arguments,
 the first beig a translitteration, the second a translation.
 you have separates foonotes 
 and, by default, the text is given in two columns 
 wich can spread over pages. useful to translate poetry.
 if you want the translation under  the translitteration, you
 can type 
         $$\hbox{\verb/\def\EcritTraduction{\EcritTraductionEnLigne}/}$$
 and 
         $$\hbox{\verb/\def\EcritTraduction{\EcritTraductionEnColonne}/}$$
 to switch back. In the column version, the second column is
 a verse-like environment
  
\end{enumerate}

\subsection{Varia}

  

\begin{description}
  \item[$<$ \rm and $>$] can be used to stress an error.
          (in \verb/\traduction{}{}/ only; prone to change)

                           
 \item[\Backslash affligne] shows the line number above a vertical
line: \affligne .

 \item[\Backslash affpage] shows the page number in a cartouche:
\affpage .

 \item[\Backslash \tt | ] increases the line number and shows it.

 \item[\Backslash \tt * ] increases the page number and shows it. 
               (the line number becomes 1)

 \item[\Backslash numligne\{VALUE\}] gives a value to the line number and shows it

 \item[\Backslash numpage\{VALUE\}] the same for page number.

 \item[\Backslash dico Y : translation (comments)] 
 Can be used to make an index of terms. ex:
 $$\verb| \dico XAa: to free  ( transitive verb )| $$
 it writes in the .dic file :
\begin{verbatim}
\DicoIndex {XAa}{ to free }{transitive verb }{P. Leyde I 350}
           {verso,13}{name of the text}{2}
  
\end{verbatim}
 that is, what you wrote, plus the references .
 It is to be used inside an environment. 
\end{description}

\subsection{Grammatical signs and al.}

 The zero-subject (i.e. the empty set) is bound to \verb/\zero/

 There is a environment for typesetting grammatical rules:
 its name is gramrule.
 a word typed there appears in slanted font, and `\verb*/~X /' 
 writes X in translitteration (the space is mandatory).
 
 The possib environment allows to type different cases, with 
 an accolade in front of them. (\verb/\\/ to part the cases)
 
 The pile environment allows to write some text in a column.
 
 Example of use:
        
\begin{verbatim*}
 \begin{gramrule} 
 ~ir + \begin{possib}
	infinitive\\
	prospective ~sDm.f \\
	~mrr.f \\
	\end{possib} 
     + \pile{whatever\\you \\want\\}
  \end{gramrule}
\end{verbatim*}
 \begin{gramrule} 
 ~ir + \begin{possib}
	infinitive\\
	prospective ~sDm.f \\
	~mrr.f \\
	\end{possib} 
     + \pile{whatever\\you \\want\\}
  \end{gramrule}

\section{To Do}
\begin{itemize}
  \item Add the possibility of reverse text. 
  \item Capital letters for translitteration (currently, it is quite
hard to type ``{\it R}{\eg a}''.
  \item A WYSYWIG interface, first using X.
  \item Improve sesh. Improve the macro mecanism. Allow one to type
some words in translitteration. Write a translitteration program.
Suppress the irritating problem of ``$z \not = s$''. Implement
additional codes.
  \item Improve the signs (both baselines and look.) 
  \item Add hieroglyphs in \verb/\dico..../;
  \item fully and strictly implement the ``manuel de codage''.
\end{itemize}

\section{Recently Done}
\begin{itemize}
  \item A right-to-left font. 
  \item Improved sesh --- I now use an hash table for the signs. The
program is still big. Allowed one to type
some words in translitteration. Add a startup file with definitions. 
  \item Hieroglyphic typesetting improved. The sizes are better
choosed, the signs can be merged with text, and are now more or less
centered on the base line.
\end{itemize}

\bibliography{bib}
\bibliographystyle{plain}

\end{document}

