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

\title{A \LaTeX periment of hieroglyphic typesetting} \author{Serge
  Rosmorduc\\ rosmord@lifac1.ens-cachan.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}
    <z:a:r-D:.-rw:z-m-r:d-W:k-A1>
  \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 files EgypUtil.sty egypto.sty hierLtx.sty
hiero.sty, and OT1diacr.fd where they belong. You might need to
rena\-me OT1diacr to \linebreak[4] T1diacr.fd. If you are using a Unix
system, they should be on your TEXINPUTS path. The directory where
your sources are should do in most cases, anyway.

Then, put your fonts where they can be used. On Unix system, it's
usually somewhere in your TEXFONTS directory.

If you need another base resolution than 300dpi, you should get the
metafont sources (HieroFonts) of the fonts and 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).
 
Then you should go to the SeshNesout directory and build the sesh
program (read the README file). It is a text to latex converter, with
a ``{\it manuel de codage\/}''-like syntax\footnote{If you'd rather do
  everything in \LaTeX, make a list of each hieroglyphic font with
  ``\verb.tex testfont.'', and use hierLtx.sty instead of hiero.sty.
  Yet this is a tedious way to go.  It isn't supported anymore.}.

\section{Typesetting hieroglyphs}

To type hieroglyphs, you need three things: the fonts, and the file
\verb|hiero.sty|, which is to be given as an option to the
\verb/\documentstyle/ macro, and finaly the sesh program.

You might also want the {\em Inventaire des signes hi\'eroglyphiques
  en vue de leur saisie informatique, \/}~\cite{MANCOD} hereafter
called {\em manuel de codage\/} (in English, French, and German).
 
%   AS I DECIDED NOT TO SUPPORT THE ALL LATEX SYSTEM, I won't 
%   give any documentation on it there. Uncomment bellow if you want to
%\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 , like in the manuel,
%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{Overview}
There's 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}
sw-t:n -Y3-A1 -U4:a-Y1v
\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. 

\sloppy Signs are named, either after their translitterations (for example,
\verb|xpr| is \begin{hieroglyph}
xpr
\end{hieroglyph}%
) \fussy or after their Gardiner Code. For a complete list, and
documentation, see~\cite{MANCOD}.

A few codes are used for signs variants; these are 
\verb/pA'/ and \verb/k'/ which write 
\begin{hieroglyph}
  pA'
\end{hieroglyph} and 
\begin{hieroglyph}
  k'
\end{hieroglyph}.

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.

For the moment, however, you should avoid using '*' and parenthesis
for signs that are {\em not\/} stacked. I will change this.

I strongly recommend that you type the word-separation spaces. The
package will then try to cut the lines at word-separations, which is
nicer.

\pagebreak[3]
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}
i-w -<-ra-mn:n-xpr-> -m-aH-a:Z1*pr-=f -#-mi-i-# 
-r:a-ra-C2 -m -p*t:pt
\end{hieroglyph}
}
\end{center}

If you use a version of TeX--Xet (a patch designed to allow you to
type right-to-left text as well as left-to-right, with the benefit of
the line-cutting system), It is possible to reverse a whole part of
the text. Simply type \verb/+dg/ right-to-left, and \verb/+gd/ for
left-to-right (this is {\em not\/} part of the {\em manuel\/}).

\expandafter\ifx\csname beginL\endcsname\relax % be sure the file 
\def\beginL{\relax}             %can be compiled anyway.
\def\beginR{\relax} \def\endR{\relax} \def\endL{\relax} 

{\bf BEWARE !!!! this file was not compiled with TeX--Xet, so the
  example bellow is false. You should have gotten a dvi version of this
  file (called \verb/doc.dvi/), without this message.} \fi

Example:
\begin{hieroglyph}
  +dg G7 E1:D40 xa:a m wAs-t:niwt nbty 
  +gd anx G7 E1:D40 xa:a m wAs-t:niwt nbty
\end{hieroglyph}, made like that: 
\begin{verbatim}
  +dg G7 E1:D40 xa:a m wAs-t:niwt nbty 
  +gd anx G7 E1:D40 xa:a m wAs-t:niwt nbty
\end{verbatim}

{\em Note that you can separate words with white spaces, without
  writing `-' before them. You can, anyway, follow the ``manuel''\/}

\subsection{Macros}
There is a limited macro facility (again, not part of the {\em manuel\/}). To
define a macro, type
\begin{verbatim}
#def MACRONAME Body#
\end{verbatim}
Note the second `\verb/#/' sign.  MACRONAME can be any unused sequence
of letters, simple quote, and point.

This can be useful if a name appears often. 

Example:

\begin{minipage}{15em}
\tt
\noindent\verb|\begin{|hierogl{}yph\verb|}| % to avoid interpretation !!!!!
\vspace{-2ex}
\begin{verbatim}
#def 'tA tA:N23*Z1#
tr-t:r-n-wn:n:n-k-tp-Z1-'tA
\end{hieroglyph}
\end{verbatim}
\end{minipage}
\vspace{1ex}

\begin{hieroglyph}
#def 'tA tA:N23*Z1#
tr-t:r-n-wn:n:n-k-tp-Z1-'tA
\end{hieroglyph}
\vspace{1ex}

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

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}

\subsection{\LaTeX\ macros}

If you want the small signs to be on the baseligne, type
\verb|\SurLigne| out of a hieroglyph environment; the default is to
center signs. 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|\Hrp| and \verb|\Hitmts|; 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. \sloppy
 a translit environment with the word ``Exemple'' in front of 
 it, and numbered. To write ``example'',  use
 \verb/\def\EXEMPLE{Example}/

\fussy
 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 being 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, which is 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:
  $$\hbox{\verb| \dico{XAa}{to free}{transitive verb}|}$$  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 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.
  Implement additional codes. Add a startup file with definitions.
\item Improve the signs (both baselines and look.)
\item Add hieroglyphs in \verb/\dico..../;
\item fully and strictly implement the ``manuel de codage''.
\item Add a possibility of reversed text in normal latex (not a
  priority. I think a built-in-tex support for right-to-left writings
  is a must for \TeX, and that these kinds of extensions should be
  used).
\end{itemize}

\section{Recently Done}
\begin{itemize}
\item A right-to-left font, and a support for tex--xet.
\item Improved sesh --- I now use an hash table for the signs. The
  {\em manuel\/} is more or less supported, and should be so very quickly.
\item Hieroglyphic typesetting improved. The sizes are better choosed,
  the signs can be merged with text, and are now centered on the base
  line.
\item Can use NFSS2 now. (but still support the old system.)
\end{itemize}

\section{Exemples}

Here are a few examples, taken from various texts : Lef\`ebvre's {\it
  Grammaire de l'\'Egyptien Classique\footnote{ Please, note that the
    style french.sty is not used there (and should be used) to allow
    people to typeset this text without it.},\/} Gardiner's {\it Egyptian
  Grammar,\/} and Westcar.
\vspace{2em}

 \noindent{\bf \Large Le pseudoparticipe}

 \paragraph{} 
 Il exprime particuli\`erement l'{\bf \'etat} ou la {\bf condition} de qqn,
 ou de qq.ch. Deux cas sont \`a distinguer, selon que le substantif (ou
 pronom) auquel est appos\'e le pseudoparticipe est sujet ou objet du
 verbe de la phrase.

 \begin{enumerate}
 \item le pseudoparticipe peut qualifier un substantif (ou pronom) {\em
     sujet\/} de certains verbes, comme 
   \begin{hieroglyph} 
     wr:r-S:ra
   \end{hieroglyph} 
   {\eg wrS\/} `` passer tout le jour \`a '', 
   \begin{hieroglyph}
     s-Dr:r-A55
   \end{hieroglyph}
   {\eg sDr\/} `` passer toute la nuit \`a '',  
   \begin{hieroglyph}
     #def iw' D54#
     pr:r-iw'
   \end{hieroglyph} 
   {\eg pri\/} au sens de `` devenir '' ;
   \begin{hieroglyph}
     Dr:r
   \end{hieroglyph} 
   {\eg Dr\/} `` finir '' (par faire telle ou telle chose).
   Ex.: 
   \begin{hieroglyph} 
     #def neg D35#
     #def bin G37#
     neg s-Dr:r-a:A55
     z:A1 H-q:r-w-bin :r d-mi-i-N23-A1
   \end{hieroglyph}
   {\eg n sDr s Hqrw r dmi.i\/} jamais un homme ne passa la nuit \`a
   avoir faim dans ma ville ({\it Menthuw.\/} 11). Litt. \`a l'\'etat
   d'avoir faim.

   S'il est sourd et que sa bouche ne puisse plus s'ouvrir, 
   \begin{hieroglyph} 
     #def nn M22-M22-n:n#
     p:r-r:iw' a:t*F51-Z2:f nb:t
     nn-A7
   \end{hieroglyph} 
   tous ses membres deviennent faibles ({\it Ebers\/} 99, 20--21).

   \begin{hieroglyph}
     #def Hm' N42#
     Dr:r-i-n:f Hm'-s-A1
   \end{hieroglyph} 
   {\eg Dr.in.f Hms(w)\/} à la fin il s'assit ({\it Leb.\/} 75).

   Comparer l'emploi, comme auxiliaires, devant {\eg sDm.n.f,\/} de {\eg
     pri,\/} {\eg sDr\/} et {\eg Dr,\/} \S 331.

 \item Il peut qualifier un substantif ...
 \end{enumerate}


 \noindent{\bf EXERCICE XXII}  

 \par ({\it a\/}) {\it Translate into English : \/}

 {\EnGros
 \begin{hieroglyph}
   +l (1) +s d:h-n:tp-=k-=w r ns-=Snwt:Snwt HAt:a m niwt:t-Z1 ns-A9-t m
   i-p:t st-t:Z2-niwt +l (2) +s i-w gm-m-=n:=f Hm':t-B1 t:n
   Hm':z-A3-ti-i tp:Z1-=s Hr:Z1 mA-\!A-st-t-rd-=s
 \end{hieroglyph}
 }


 \noindent{\bf Un texte sym\'etrique}

 \begin{center}

   \mbox{\begin{hieroglyph}
     +gd +dg anx G5 E1 D40 xa m R19-t:niwt sw:t bit:t <ra-mn-xpr>
     +gd G5 E1 D40 xa m R19-t:niwt sw:t bit:t <ra-mn-xpr> 
 \end{hieroglyph}}

 \end{center}


 \noindent{\bf Un extrait de Westcar} 

 {\EnGros\SurLigne
   \begin{hieroglyph}
     #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# #def swA Z9# #def neg D35# $-aHa-a:iw' p-W
     ir:=n sw-t:n zA G5-di':di'-f-Spsi r md-d:=t-A2-$ $-D:d-=f-$
     #-..-A2-n-z:p*.-..-..-..-..# m r:x-t:Y1 n n:t-tyw-Z3A swA:iw' neg
     r:x-Y1:n-t-W -mA:Aa11-a:t*Z5-Y1:Z2 r g:r-grg i-W wn:n x:r
     Hm-Z1-G7-=k m h-A-W-Y1:Z2-=k' D:z-=k' D:d-=i-=n Hm-Z1-G7-=f
     i-Ss:z-t-A2 p-W G5-di':di'-f-Spsi zA-G7-=A1 D:d-=i-=n sw-t:n zA
     G5-di':di'-f-Spsi i-W wn:n n:D-s-bin:A1 Dd-Dd-i-Y1:A1 r:n-A2-=f
     Hm':z-A7-=f m Dd-Dd-Y1 <s-nfr-f:r-W> -mA:Aa11 -xrw-W-A2 i-W:f m
     n:D-s-bin:A1 n rnp-t:100-10 i-W:=f Hr-Z1 M42-m-A2 t:X3-N18:Z2
     100*100*100:200 r-mn:n-rmn:F51 n E1-Z1 m i-W:f-F51:Z2 H-n:a
     s-wr:r-i-mw-A2 H-q:t-Hnqt:Z2 d:z-Hnqt 100 r mn:n-Y1 m h-r-W-ra-Z1
     p:n i-W:=f r:x-Y1 Tz-100:arm tp-Z1 H-s-q-swA:arm i-W:=f r:x-Y1
     t:n-nw-W-qmA-pA'-Y1:Z2 ipt:t*pr-Z3A n:t wn:n-t:pr n:t G26:t*y
 \end{hieroglyph}
 }

\bibliography{bib}
\bibliographystyle{plain}

\end{document}

