% % manual.tex v2.14 % % LaTeX source file for the manual for the Devanagari for TeX" package. % Copyright (C) 1991-2003 University of Groningen, The Netherlands % % Author : Anshuman Pandey % $Id: manual.tex,v 1.6 2006/05/29 09:00:12 icebearsoft Exp $ % % 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. % % This program is distributed in the hope that it will be useful, % but without any warranty; without even the implied warranty of % merchantability or fitness for a particular purpose. See the % GNU General Public License for more details. % \documentclass[10pt]{article} \def\DevnagVersion{new} \usepackage{geometry,fancyhdr,multicol,mflogo,textcomp,parskip,array,color} \usepackage{devanagari} \renewcommand{\rmdefault}{ptm} \geometry{paperwidth=8.5in, paperheight=11in, top=.875in, bottom=1in, left=1.25in, right=1.25in, headheight=0pt, headsep=0pt, } \usepackage{hyperref} % High resolution pk fonts for pdfTeX \ifx\pdfpkresolution\undefined \else \pdfpkresolution 600 \fi \newcommand{\moddate}{27 May 2006} \newcommand{\version}{2.14} \renewcommand{\headrulewidth}{0pt} \setcounter{secnumdepth}{3} \setcounter{tocdepth}{3} \setlength{\columnseprule}{0pt} \newcommand{\devnag}{Devan\=agar{\=\i}} \def\diatop[#1|#2]{{\leavevmode\setbox1=\hbox{{#1{}}}\setbox2=\hbox{{#2{}}}% \dimen0=\ifdim\wd1>\wd2\wd1\else\wd2\fi% \dimen1=\ht2\advance\dimen1by-1ex% \setbox1=\hbox to1\dimen0{\hss#1\hss}% \rlap{\raise1\dimen1\box1}% \hbox to1\dimen0{\hss#2\hss}}}% \def\underrng #1{\oalign{#1\crcr\hidewidth \vbox to.2ex{\hbox{\char"17}\vss}\hidewidth}} \clubpenalty 10000 \widowpenalty 10000 \begin{document} \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{\thepage} \fontsize{10}{13}\selectfont \title{{\LARGE \bfseries \devnag{} for \TeX{}} \\ Version \version{}} \author{Anshuman Pandey} \date{\large \moddate{}} \maketitle \tableofcontents %\newpage \listoftables \section{Introduction} The \textit{\devnag{} for \TeX{}} (\textsf{devnag}) package provides a way to typeset high-quality \devnag{} text with \TeX{}. \devnag{} is a script used for writing and printing Sanskrit and a number of languages in Northern and Central India such as Hindi and Marathi, as well as Nepali. The \textsf{devnag} package was originally developed in May 1991 by Frans Velthuis for the University of Groningen, The Netherlands, and it was the first system to provide support for the \devnag{} script for \TeX{}. Several individuals have contributed to the \textsf{devnag} package over the years. Kevin Carmody proposed a method for managing variant glyphs. Marc Csernel revised the preprocessor to handle standard \LaTeX{} commands. Richard Mahoney generated PostScript Type~1 versions of the \devnag{} fonts. These fonts were later (in version~2.14) replaced with optimized Type~1 fonts created by Karel P\'{\i}\v{s}ka. Fran\c{c}ois Patte enhanced the \LaTeX{} package by introducing a feature to produce citations in \devnag{}. Zden\v{e}k Wagner greatly improved the \LaTeX{} package by revising macro definitions and catcodes, eliminating conflicts with other packages, and by introducing support for section headings and captions in \devnag{}. Rob Adriaanse, Hans Bakker, Roelf Barkhuis, and Henk van Linde provided advice and support to Frans Velthuis when this package was being developed. The \textsf{devnag} package is presently maintained by the following individuals: \begin{quote} \begin{tabular}{ll} % Frans Velthuis & \verb+velthuis@rc.rug.nl+ \\ John Smith & \verb+jds10@cam.ac.uk+ \\ Anshuman Pandey & \verb+apandey@u.washington.edu+ \\ Dominik Wujastyk & \verb+d.wujastyk@ucl.ac.uk+ \\ %Fran\c{c}ois Patte & \verb+patte@math-info.univ-paris5.fr+ \\ Zden\v{e}k Wagner & \verb+wagner@cesnet.cz+ \\ Kevin Carmody & \verb+i@kevincarmody.org+ \end{tabular} \end{quote} \section{Project Information} The \textit{\devnag{} for \TeX{}} package is now a project officially housed at Sarovar. The homepage is \begin{quote} \texttt{http://devnag.sarovar.org/} \end{quote} This package is available from the project homepage at Sarovar and from the Comprehensive \TeX{} Archive Network (CTAN). The CTAN path for the package at the primary UK TUG site is \begin{quote} \texttt{ftp://ftp.tex.ac.uk/tex-archive/language/devanagari/velthuis/} \end{quote} Please use the tracking system at the project homepage at Sarovar to submit feature requests, bugs, comments, and questions to the development team. \section{Producing \devnag{} Text with \TeX{}} \devnag{} text may be included in any \TeX{} document. There are three steps to producing \devnag{} text with \TeX{}. First, since \TeX{} does not support \devnag{} natively, it is necessary to type \devnag{} using \hbox{7-bit} (ASCII) roman characters that represent \devnag{} characters. Secondly, transliterated \devnag{} text must be entered within \textsf{devnag}-specific delimiters. These delimiters allow the preprocessor to recognize the \devnag{} sections of the \TeX{} document. Third, the transliterated input must be converted by the preprocessor into a format that \TeX{} understands. The preprocessor scans the document for \textsf{devnag} delimiters. Once it finds a delimiter, the program operates on the text only within the scope of the delimiter. All other document text, with the exception of \TeX{} macros and \textsf{devnag}-specific preprocessor directives, is ignored. Shown below is a \devnag{} passage followed by the 7-bit transliterated input that produced it. \begin{quote} {\dn Dm\0\322w\?/\? \7{k}z\322w\?/\? smv\?tA \7{y}\7{y}(sv,.\\ mAmkA, pA\317wXvA\396w\4v Ekm\7{k}v\0t s\2jy..\par} \end{quote} \begin{quote} \begin{verbatim} {\dn dharmak.setre kuruk.setre samavetaa yuyutsava.h | \\ maamakaa.h paa.n.davaa"scaiva kimakurvata sa.mjaya ||} \end{verbatim} \end{quote} \subsection{Macros and Font Definition Files} \begin{description} \item[\texttt{dnmacs.tex}] This file contains Plain \TeX{} macros for \textsf{devnag} and various font-sizing commands. It must be loaded at the beginning of the document with the command \verb+\input dnmacs+. \item[\texttt{devanagari.sty}] This file provides \LaTeX{} support for \textsf{devnag}. It must must be loaded in the preamble of the document with the command \verb+\usepackage{devanagari}+. Section \ref{catcodes} discusses advanced package options that may be declared with \texttt{devanagari.sty}. The associated font definition files \texttt{udn*.fd} provide NFSS support for \LaTeX{} for the \textsf{dvng} fonts. \item[\texttt{dev.sty}] This file is kept for compatibility with old documents. It merely loads \texttt{devanagari.sty}. Do not use it in new documents. \item[\texttt{dev209.sty}] This file provides legacy support for the obsolete \LaTeX{} 2.09. It should not be used. \end{description} \subsection{Text Delimiters} The preprocessor recognizes the text it is to act upon by use of delimiters, of which there are two types. The basic delimiter is the \verb+\dn+ macro. This delimiter is used by enclosing \devnag{} text between \verb+{\dn ... }+, eg. \verb+{\dn acchaa}+. The second delimiter is the \verb+$+ character. \devnag{} text is enclosed between \verb+$ ... $+, eg. \verb+$acchaa$+. The \verb+@dollars+ preprocessor directive must be specified to activate this delimiter (section \ref{dol}). The first delimiter is recommended especially for large blocks of \devnag{} text. The second delimiter is useful when there is a need to switch often between \devnag{} and roman text. Any text outside of delimiters is not parsed by the preprocessor. There are very few restrictions on what may be placed between the delimiters. The 7-bit Velthuis encoding shown in Table \ref{chars}, all punctuation marks, and all \TeX{} macro commands are acceptable input. The preprocessor will produce a warning for unrecognized input characters and commands. \subsection{Example Input Files} Two sample \devnag{} documents are bundled with this distribution. Please refer to the contents of these files for examples of producing a \devnag{} document. The file \texttt{misspaal.dn} contains an excerpt from the Hindi short story \textit{Miss Pal} by Mohan Rakesh. The file \texttt{examples.dn} contains some advanced examples of \devnag{} typesetting. Shown below are two small examples of Plain \TeX{} and \LaTeX{} documents with \devnag{} text. \begin{multicols}{2} \begin{verbatim} % Sample TeX input file \input dnmacs {\dn devaanaa.m priya.h} \bye \end{verbatim} \columnbreak \begin{verbatim} % Sample LaTeX input file \documentclass{article} \usepackage{devanagari} \begin{document} {\dn devaanaa.m priya.h} \end{document} \end{verbatim} \end{multicols} The filename of the \TeX{} document that contains \devnag{} should be given a \texttt{.dn} extension. The preprocessor will produce a filename with a \texttt{.tex} extension after processing the input file. \section{Input Encoding} \label{trans} \devnag{} text is prepared using a 7-bit (ASCII-based) transliterated input encoding in which \devnag{} characters are represented by Roman characters. The input encoding for \textsf{devnag} was developed by Frans Velthuis with the objective to keep the format of the input source text as close as possible to the accepted scholarly practices for transliteration of \devnag{}. The Velthuis encoding is widely used and has been adapted by other Indic language \TeX{} packages, and also serves as the basis of other Indic transliteration schemes. \subsection{Supplemental Notes} Attention should be paid to the following points: \begin{enumerate} \item There are different ways to produce consonant conjuncts. For example, the sequence \texttt{ktrya} can be represented as {\dn \3FCw} and as {\dn ?\3ECwy}. The creation of conjuncts may be controlled through the use of the preprocessor directives \verb+@sanskrit+, \verb+@hindi+, and \verb+@modernhindi+, and more strictly through the \verb+@lig+ directive. Please refer to Table \ref{ligs} for a list of supported conjuncts. \item There are two different ways to produce long vowels: typing the short vowel twice or by capitalizing the short vowel, eg. \texttt{aa} or \texttt{A} for {\dn aA}. \item Aspirated consonants may be produced alternately by capitalizing the voiceless counterpart. For example, the standard encoding for {\dn B} is \texttt{bha}, but it may also be produced by \texttt{Ba}; {\dn G} is \texttt{gha} or \texttt{Ga}; etc. \item For words which have two successive short vowels, a sequence of brackets \verb+{}+ may be used to separate the vowels, eg. {\dn \3FEw{}ug} \verb+pra{}uga+, as opposed to {\dn \3FEwOg} \verb+prauga+ . This is required because the combinations \verb+ai+ and \verb+au+ represent the dipthongs {\dn e\?} and {\dn aO}. \item The use of uppercase letters to indicate long vowels may be preferred in cases where ambiguity might arise. When encoding a word like {\dn kI}, the sequence \verb+kaii+ will produce the incorrect form {\dn k\4i}, while \verb+kaI+ will yield the correct form {\dn kI}. A sequence of brackets, as in the previous note, will also produce the correct form, eg. \verb+ka{}ii+. \item The standard ligatures {\dn\symbol{34}}, {\dn \3E2w}, and {\dn /} are produced by \verb+k.sa+, \verb+j~na+, and \verb+tra+. \item Candrabindu may be encoded either as a slash, as given in Table~\ref{chars}, or by \verb+~m+. % \item \verb+~a+ produces an `English a' Marathi style. For example, % Hindi {\dn V\4?sF} and Marathi {\dn V\+ delimiters. In the example below, the font command between the angle brackets will be ignored by the preprocessor, but will be removed from the output file. For example, with \verb+{\dn dharmak.setre <\font\zzz=dvng10 at 18pt> kuruk.setre}+ the preprocessor will operate on \texttt{dharmak.setre} and \texttt{kuruk.setre}, but will ignore \verb+\font\zzz=dvng10 at 18pt+ because it occurs within the \verb+<+ and \verb+>+ delimiters. \subsection{Breaking Pre-Defined Conjuncts} The preprocessor will automatically produce predefined ligatures from certain sequences of consonants. Placing the \texttt{+} character between two consonants prevents any predefined ligature representing those consonants from being produced. Instead a conjunct will be created from half-forms, or, if half-forms do not exist, full forms stopped with \textit{vir\=ama} will be used. For example, the sequence \texttt{kha} will produce {\dn K}. Using \texttt{+} to break the sequence -- \texttt{k+ha} -- will create {\dn ?h}. The use of \texttt{+} is similar to the use of \verb+{}+. For example, write \verb+t{}ha+ to produce {\dn \qq{t}{}h}, if desired instead of \verb+tha+ {\dn T}. The \texttt{+} character can be used independently of the \verb+@lig+/\verb+@nolig+ directives, and it can disable any conjunct. Note that the \texttt{+} character only disables single occurrences of a conjunct. To disable all occurrence of a conjunct use the \verb+@lig+ directive. \subsection{Supported \LaTeX{} Commands} The preprocessor recognizes some \LaTeX{} macros with arguments. The following command types are legal within delimiters. \begin{itemize} \item Font commands: Standard \TeX{} size-changing commands, eg. \verb+\small+, \verb+\large+, \verb+\huge+. \item Environments, including the three table environments: \verb+tabular+, \verb+supertabular+, and \verb+longtable+. Note: To use table environments within delimited text, the \verb+@tabs+ directive must be specified in order to enable the use of the ampersand as a tab marker instead of a marker for \textit{vir\=ama}. Refer to Section \ref{directives} for more details on preprocessor directives. \item Spaces: \verb+\hspace+, \verb+\hspace*+, \verb+\vspace+, \verb+\vspace*+, \verb+\addvspace+, \verb+\setlength+, \verb+\addtolength+, \verb+\enlargethispage+, \verb+\enlargethispage*+, and \verb+\\[+\textit{n}\verb+]+. Plain \TeX{} commands may also be used when placed between brackets: \verb+{\hskip }+, \verb+{\vskip }+, \verb+{\vadjust }+, and \verb+{\kern }+. \item Counters: \verb+\setcounter+, \verb+\stepcounter+, \verb+\addtocounter+, and \verb+\refstepcounter+. Page numbering in \devnag{} is also available through the \verb+dev+ counter. \item Boxes and rules: \verb+\parbox+, \verb+\makebox+, \verb+\framebox+, \verb+raisebox+, and \verb+\rule+. \item References: \verb+\label+, \verb+\ref+, \verb+\pageref+, \verb+\index+, \verb+\cite+, and \verb+\bibitem+. If the argument of the \verb+\index+ command is in \devnag{}, it will appear in \devnag{} in the index file. \item File commands: \verb+\input+ and \verb+\include+. \item Roman text may also be embedded within \devnag{} delimited text as long as the Roman does not exceed the length of one line. Use \verb+{\rm ... }+ to produce embedded Roman text. \end{itemize} \subsection{Using Custom \LaTeX\ Commands} \LaTeX\ users take advantage of numerous commands from various packages. All packages will never be supported directly but solution is easy. As a matter of fact, all control sequences without arguments or taking \devnag\ text as argument can be used without problem. Suppose the you want to colorize text {\dn \textcolor{red}{: t(s\qq{t}}} using the \verb;\textcolor; command from the \textsc{color} package. The bare word \textit{red} must not be converted. Conversion can be suppressed by mechanism described in section~\ref{protecting}. One can write e.\,g.: \begin{verbatim} {\dn \textcolor<{red}>{.o tatsat}} \end{verbatim} It is, however, preferable to separate meaning and form. If a macro, e.\,g.\@ \verb;\myemph; is defined, it is possible to decide later how the text will be emphasized. The text will then be entered as follows: \begin{verbatim} \def\myemph#{\textcolor{red}} {\dn \myemph{.o tatsat}} \end{verbatim} Using such an approach one does not need any escaping mechanism at all. \section{\devnag{} Fonts} The \textsf{devnag} package provides three font families in addition to the Standard family: Bombay, Calcutta, and Nepali. All families are available in regular, oblique, bold, bold oblique, and pen shapes and weights. The Bombay, Calcutta, and Nepali families provide variant glyphs which are predominant regional forms for certain characters, as shown in Table \ref{diffs}. \begin{itemize} \item \verb+\dnbombay+ switches to the Bombay family \item \verb+\dncalcutta+ switches to the Calcutta family \item \verb+\dnnepali+ switches to the Nepali family \item \verb+\dnoriginal+ switches back to the default regular family \item \verb+\dnpen+ switches to the Pen family \item \verb+\dnpenbombay+ switches to the Bombay Pen family \item \verb+\dnpencalcutta+ switches to the Calcutta Pen family \item \verb+\dnpennepali+ switches to the Nepali Pen family \end{itemize} The oblique, bold, and bold oblique shapes and weights are produced using standard \LaTeX{} macros. Oblique is obtained with either of the \verb+\textit{}+ or \verb+\itshape+ font-changing commands. Bold is obtained with either \verb+\textbf{}+ or \verb+\bfseries+. Bold oblique requires a combination of the bold and oblique commands, such as \verb+\bfseries\itshape+. To use bold, oblique, and bold oblique varieties in Plain \TeX{}, use the macros \verb+\dnbf+ and \verb+\dnit+. The regional families are accessed using the macro commands described above. See \texttt{dnmacs.tex} for further information. Font size may be controlled in \LaTeX{} with the standard font sizing commands. In Plain \TeX{}, font size may be controlled with the following macros: \verb+\dnsmall+, \verb+\dnnine+, \verb+\dnnormal+, \verb+\dnhalf+, \verb+\dnbig+, \verb+\dnlarge+, and \verb+\dnhuge+. See \texttt{dnmacs.tex} for further information. \subsection{Bombay-Style Fonts} The family name for the Bombay \devnag{} fonts is \textsf{dnb}. To access this family, use the command \verb+\dnbombay+ after the \verb+\dn+ macro. Standard \LaTeX{} font commands like \verb+\fontfamily{dnb}+ and \verb+\usefont{U}{dnb}{}{}+ may be used to access the Bombay fonts, however, these commands conflict with the preprocessor. Access to the Bombay family within \devnag{} environments should be restricted to the \verb+\dnbombay+ macro. Use the command \verb+\dnoriginal+ to return to the standard \devnag{} font. \subsection{Calcutta-Style Fonts} The family name for the Calcutta \devnag{} fonts is \textsf{dnc}. In roder to access this family, use the command \verb+\dncalcutta+ after the \verb+\dn+ macro. Standard \LaTeX{} font commands like \verb+\fontfamily{dnc}+ and \verb+\usefont{U}{dnb}{}{}+ may be used to access the Calcutta fonts, however, these commands conflict with the preprocessor. Access to the Calcutta family within \devnag{} environments should be restricted to the \verb+\dncalcutta+ macro. Use the command \verb+\dnoriginal+ to return to the standard \devnag{} font. \subsection{Nepali-Style Fonts} The family name for the Nepali \devnag{} fonts is \textsf{dnn}. To access this family, use the command \verb+\dnnepali+ after the \verb+\dn+ macro. Standard \LaTeX{} font commands like \verb+\fontfamily{dnn}+ and \verb+\usefont{U}{dnn}{}{}+ may be used to access the Nepali fonts, however, these commands conflict with the preprocessor. Access to the Nepali family within \devnag{} environments should be restricted to the \verb+\dnnepali+ macro. Use the command \verb+\dnoriginal+ to return to the standard \devnag{} font. \subsection{\devnag{} Pen Fonts} The \devnag{} Pen family is a simple modification of the Standard face created by Tom Ridgeway, which resembles Devanagari written with a pen. Standard Pen fonts are available as the family \textsf{dnp} and may be accessed within \devnag{} environments with the command \verb+\dnpen+. The Pen family for the Bombay style are available as the family \textsf{dnpb}, and may be accessed with the command \verb+\dnpenbombay+. The Pen family for the Calcutta style is called \textsf{dnpc} and may be accessed with the command \verb+\dnpencalcutta+. The Pen family for the Nepali style is called \textsf{dnpn} and may be accessed with the command \verb+\dnpennepali+. Use the command \verb+\dnpen+ to return to the standard \devnag{} Pen font. \subsection{Default \devnag{} Font (\LaTeX{} Only)} The \devnag{} package provides options \verb+bombay+, \verb+calcutta+, \verb+nepali+, \verb+pen+, \verb+penbombay+, \verb+pencalcutta+, and \verb+pennepali+ so as to set the corresponding font as the default one. It may seem that using \verb+\dncalcutta+ at the beginning of the document is sufficient. However, as we will show later in this document, the \devnag{} package may create automatically some captions as well as a running head. When producing such texts, \LaTeX{} is set to use Roman fonts and the automatic text switches to \devnag{} just by \verb+\dn+. You would thus see {\dn\dncalcutta a@yAy} in the normal text but {\dn a@yAy} in automatic captions which is undesirable. The package options inform which font style should be used as default. It is also possible to change the default font by defining macro \verb+\dnfamilydefault+. The font switching commands described in the previous subsections can be used for local changes of the style. \subsection{PostScript Type 1} The package now includes Type~1 fonts created by Karel P\'{\i}\v{s}ka using an analytic fit. The fonts included here are a subset of his release of Indic Type~1 fonts that are available from CTAN:fonts/ps-type1/indic and licensed under GPL. An accurate analytic fit of outline contour curves taken from the \MP{} output helps to avoid artifacts produced by an autotracing bitmap approach. It allows to keep preciseness of calculations and to produce the outline fonts faithful, optimal (to minimize their space amount) and hinted. Therefore the results are not only more precise than fonts presented earlier but also occupy a smaller place even if they include hinting additionally. The distribution contains the PFB and TFM files both with accurate glyph widths. The user UniqueID are present to distinguish fonts during download process in PostScript printers and other RIP devices. The AFM files have be considered as derived files not usable for TFM creation, because the \textsc{afm2tfm} program has a feature to round the glyph widths and is not able to reproduce the original metrics. Use these files only with tools that explicitly require AFM. To use the Type 1 fonts with \texttt{dvips} and pdf\TeX, it is in modern \TeX{} distributions sufficient to run \texttt{mktexlsr} or \texttt{texhash} and then issue: \begin{verbatim} updmap --enable MixedMap=dvng.map \end{verbatim} If you do not have \texttt{updmap}, you must edit the local \textsf{dvips} \texttt{psfonts.map} file to contain a reference to \texttt{dvng.map}; or copy the contents of \texttt{dvng.map} into \texttt{config.ps}. Detailed installation instructions can be found in the README file in the root directory of the CVS working copy or in the \texttt{doc/generic/velthuis/} directory in the release package. % \subsection{Creating Custom Font Varieties} % % The \MF{} source files have been organized to make it easy to produce % custom font varieties, such as larger point sizes, fonts that contain % some alternate letters but not others, and non-standard bold and oblique % fonts. For further information, see the comments in \texttt{dngen.mf}. % If you are using \LaTeX{}, you may need to modify \texttt{devanagari.sty}, and % add or modify \texttt{.fd} files. For Plain \TeX{}, you may want to % modify \texttt{dnmacs.tex}. \section{Special Topics}\label{spec} \subsection{Delimiter Scope} The \LaTeX{} font-size commands may be used within \devnag{} delimited text, however, as a general rule, the font-size command should follow the \verb+\dn+ delimiter, otherwise the font definition commands of \verb+\dn+ will be overridden. For example, items 1, 2, and 3 below produce the correct forms, but 4 does not: \begin{quote} \begin{tabular}{llcl} 1. & \verb+{\dn \large acchaa}+ & $\rightarrow$ & {\dn aQCA} \\ 2. & \verb+{\dn {\large acchaa}}+ & $\rightarrow$ & {\dn aQCA} \\ 3. & \verb+{\large {\dn acchaa}}+ & $\rightarrow$ & {\dn aQCA} \\ 4. & \verb+{\large \dn acchaa}+ & $\rightarrow$ & {\dn acchaa} \\ \end{tabular} \end{quote} \subsection{Line Spacing} Due to the super- and subscript characters of the \devnag{} script, the default line spacing (leading) often needs to be increased to prevent the crowding of lines. The parameter \verb+\baselineskip+ (\verb+\linespread+ for \LaTeX{}) controls the line spacing. \TeX{} determines and adjusts the value of \verb+\baselineskip+ after it finishes processing a paragraph. If a paragraph contains a mixture of \devnag{} and Roman text, and ends with Roman text, then \TeX{} will set the value of \verb+\baselineskip+ according to the Roman text. This may result in crowding of \devnag{} text. There are, however, solutions to this. An explicit value can be assigned to \verb+\baselineskip+ before the paragraph ends. The macro file \texttt{dnmacs.tex} shows examples of the value of \verb+\baselineskip+ at different font sizes. Default line spacing is also set in \texttt{devanagari.sty}. Alternately, `dummy' \textsf{devnag} text containing \verb+\par+ can be placed at the end of the paragraph, eg. \verb+{\dn \par}+. Even when a paragraph has only \textsf{devnag} text, the paragraph-end command must be included within \textsf{devnag} text, meaning that the closing delimiter, which ends the \textsf{devnag} text, must follow the empty line or the \verb+\par+ command that forces the paragraph to end. \subsection{Hyphenation} \label{hyphenation} The \texttt{devnag} package does more or less all that needs to be done from the point of view of hyphenating Sanskrit in \devnag{} through the \texttt{@hyphen} and \texttt{@nohyphen} directives, which are discussed in section \ref{directives}. If hyphenation is off, then there are no hyphens, and very stretchy inter-word space. This is acceptable for ragged-right settings or for text in verse form, but may produce poor results in right-justified prose text, especially if the given passage contains long compound words. If hyphenation is on then discretionary hyphens are set between all syllables. \subsection{Captions and Date Formats (\LaTeX{} only)} The language modules of the \textsf{babel} package change captions texts and date formats. Although \textsf{devanagari.sty} is not a \textsf{babel} module, similar mechanism is implemented here. Macros \verb=\datehindi= and \verb=\datemodernhindi= enable Europian style Hindi date generated by the standard \verb=\today= command. The ``traditional'' and ``modern'' variants comtain the same names of the months, they differ only in the ligatures used. You should therefore use \verb=\datemodernhindi= in documents processed with \verb=@modernhindi=. The names of the months used in the definition of \verb=\datemodernhindi= are summarized in Table~\ref{months}. \begin{table}[bth] \centering \extrarowheight 2pt \begin{tabular}{|rl|rl|}\hline 1 & {\dn jnvrF} & 7 & {\dn \7{j}lAI}\\ 2 & {\dn \327wrvrF} & 8 & {\dn ag-t}\\ 3 & {\dn mAc\0} & 9 & {\dn EstMbr}\\ 4 & {\dn a\3FEw\4l} & 10 & {\dn a?\8{t}br}\\ 5 & {\dn mI} & 11 & {\dn nvMbr}\\ 6 & {\dn \8{j}n} & 12 & {\dn EdsMbr}\\\hline \end{tabular} \caption{Names of the months in the definition of \texttt{\char92 datemodernhindi}}\label{months} \end{table} The captions are similarly switched to Hindi by \verb=\captionshindi= or \verb=\captionsmodernhindi=, respectively. Again the texts differ only in the ligatures used. The captions for the modern Hindi variant are given in Table~\ref{captions}. \begin{table}[bt] \centering \extrarowheight 2pt \begin{tabular}{|>{\tt\char92 }l|l|}\hline \multicolumn{1}{|l|}{\bfseries Macro} & \bfseries Caption \\\hline abstractname & {\dn sArA\2f}\\ appendixname & {\dn pErEf\309wV}\\ bibname & {\dn s\2df\0 g\5\306wT}\\ ccname & \\ chaptername & {\dn a@yAy}\\ contentsname & {\dn Evqy{\rs -\re}\8{s}cF}\\ enclname & {\dn }\\ figurename & {\dn Ec/}\\ headpagename & {\dn \9{p}\309wW}\\ headtoname & \\ indexname & {\dn \8{s}cF}\\ listfigurename & {\dn Ec/o{\qva} kF \8{s}cF}\\ listtablename & {\dn tAElkAao\2 kF \8{s}cF}\\ pagename & {\dn \9{p}\309wW}\\ partname & {\dn K\317wX}\\ prefacename & {\dn \3FEw-tAvnA}\\ refname & {\dn hvAl\?}\\ tablename & {\dn tAElkA}\\ seename & {\dn d\?EKe}\\ alsoname & {\dn aOr d\?EKe}\\ alsoseename & {\dn aOr d\?EKe}\\\hline \end{tabular} \caption{Modern Hindi captions}\label{captions} \end{table} The macros for the \textsc{letter} class are left intentionally empty. The idea of the \textsf{babel} package is to prepare a universal template for business letters using a set of macros. The header of the letter would make use of the \verb=\headtoname= macro which will produce ``To: Mr.\@ Kumar'' in English letters and ``Komu: pan Kumar'' in Czech letters. If we simply defined \verb=\headtoname= to {\dn ko}, the universal template would put it before the name which would be wrong. Hindi requires different word order, namely {\dn \399wF \7{k}mAr ko}. The universal templates are thus useless in Hindi and the letter template must be redesigned almost from scratch. It therefore makes no sense to define the letter macros. Two package options are provided: \verb=hindi= and \verb=modernhindi=. If used, they cause the \verb=\dn= command to switch the caption text and date format as well. The date format and captions may be switched back by macros \verb=\dateenglish=, \verb=\dateUSenglish=, and \verb=\captionsenglish=. \subsection{Customizing the date and captions} The user might prefer different caption texts. If just a few texts are to be changed, they can simply be redefined in the main document, for instace by: \begin{verbatim} \def\indexname{{\dn anukrama.nikaa}} \end{verbatim} This redefinition must appear \textbf{after} \verb=\captionshindi= or \verb=\captionsmodernhindi= was invoked. It is also possible to change all definitions. The source texts in the Velthuis transliteration can be found in the \texttt{input} directory (\verb=$TEXMF/tex/latex/devanagr=) in file \texttt{captions.dn} with some suggested variants in comments. You can either put modified definitions to your main document (after \textsf{devanagari.sty}) or to a package of your own. Remember that the preprocessor will not see your package, you must preprocess it separately. Your package must either reside in the same directory as your document or in some directory which is searched by \LaTeX. In the latter case you will have to rebuild the database by running \textsf{mktexlsr} or \textsf{texhash} in many \TeX{} distributions. Do not put your packages to standard distribution directories. You may lose them when upgrading your \TeX{} distribution. \renewcommand\thepage{{\dn\arabic{page}}} \subsection{Using \texorpdfstring{{\dn d\?vnAgrF}}{Devanagari} in Sections and References} All macros necessary for typesetting \devnag{} text are robust. The section/chapter titles as well as figure and table captions can contain \devnag{} words. However, the font is changed to the standard document font before the title is typeset. It is therefore mandatory to use \verb+\dn+ even if the section title appears inside the \verb+\dn+ environment. Thus, \verb+\chapter{{\dn mis paal}}+ will be printed correctly while \verb+{\dn\chapter{mis paal}}+ will always create garbage text. Section numbers as well as page numbers will be printed in Roman numerals. \subsection{\devnag{} Page Numbers} Changing page numbers to print \devnag{} numerals is possible by redefining the \verb+\thepage+ macro. This redefinition places the \verb+page+ counter in the scope of the \verb+\dn+ delimiter. However, note that \verb+\arabic{page}+ is enclosed within angle brackets. This is required because the preprocessor does not recognize the counter as a command. The pagination for this page till the end of Chapter~\ref{spec} occurs in \devnag{} through the following redefintion of \verb+\thepage+: \begin{quote} \verb+\renewcommand\thepage{{\dn<\arabic{page}>}}+ \end{quote} Other counters can be printed in \devnag{} by redefinition macros. For example, to change section numbering to \devnag{}, redefine \verb+\thesection+ in a manner similar to \verb+\thepage+ above, using the \verb+section+ counter instead of \verb+page+: \begin{quote} \verb+\renewcommand\thesection{{\dn<\arabic{section}>}}+ \end{quote} \subsection{Category Codes} \label{catcodes} \TeX{} assigns a category code (\verb+\catcode+) to each character. For example, normal characters are assigned to category 11, and because the backslash belongs to category 0, it is treated as the first character of macro commands. The fonts in the \textsf{devnag} package use characters with codes below 32. In previous releases of the package the category of these characters was to 11. However, these catcode assignments caused conflicts with some packages and with tables where tab characters were used. Most of these problems could be solved at the macro level, but unfortunately not all of them. The most serious problem is that words like {\dn v\char10 t} do not get correctly transfered from section titles to the table-of-contents. A modification of the preprocessor was necessary to resolve this issue. As a result, a change of character categories is no longer needed. The output of the revised preprocessor is compatible with previous releases of \texttt{devanagari.sty}. This fix solves the table-of-contents problem, but not the conflicts. The new \texttt{devanagari.sty} is still able to process files generated by the previous versions of the preprocessor. To indicate which version of the preprocessor was used to process a given \devnag{} file, a string is written to the beginning of the output \TeX{} file. The macro definition \verb+\DevnagVersion+ is written to the first line of the output file and indicates the preprocessor version. If the whole document is present in a single file, the definition will appear before reading the macro package. The package then changes its behaviour according to the existence or non-existence of the above mentioned macro. If the macro is defined, no categories are changed. If the macro is undefined, the \textsf{devanagari} package assumes that it is processing an output from an older version of the preprocessor and the categories of the characters are changed. The \textsf{nocatcodes} option is intended for use with files produced by the old preprocessor. This option changes the categories only within the \verb+\dn+ environment, not globally for the document. The \textsf{catcodes} option instructs the package to change the categories globally. This does not, however, change the categories as a part of the \verb+\dn+ command. If you assume that the categories can be changed somewhere in the middle of the document and you wish to set them properly by \verb+\dn+, you can use the \textsf{compat} option. The macro \verb+\UnDevCatcodes+ changes catcodes back to the normal values within the \verb+\dn+ environment. \clearpage % forced page break, remove it if the next section does not start % at the same page as the previous subsection \section{Vedic Macros} \renewcommand\thepage{{\arabic{page}}} These macros put Vedic intonation marks above and below individual Devanagari letters and construct other characters generally used only in Vedic text. There are two groups of these macros, one for Rig Veda, and one for Sama Veda. To use the Rig Veda macros, you must first enter the command \verb=\dnveda= at some point after \verb=\input dnmacs= in plain \TeX\ or after \verb=\usepackage{devanagari}= in \LaTeX , and to use the Sama Veda accents, you must first type \verb=\dnsamaveda=. Both of these modes redefine standard macro names already used in Plain \TeX{} and \LaTeX. In Rig Veda mode the macros \verb=\_=, \verb+\=+, \verb=\|=, and \verb=\~= are redefined, while in Sama Veda mode, \verb=\^= and \verb=\@= are redefined. If your document already uses these macros in their original sense, then use \verb=\dnveda= or \verb=\dnsamaveda= only within \verb=\dn= mode. Otherwise, use \verb=\dnveda= or \verb=\dnsamaveda= once at the beginning of the document. This approach to macro names has been used because, when intonation marks are needed, they are needed very frequently and are inserted into parts of words, so the macro names should be very short and symbolic. \subsection{Rig Veda Macros} \subsubsection{Anudatta (low) tone macro\texorpdfstring{ \texttt{\char92\_}}{}, variable width} This macro takes one argument, the text letter. Example: \verb=\dnveda ... {\dn \_{a}gnim}= This macro may be combined with \verb=\|= for a pluta mark: \verb=\_{\|{3}}=. The anudatta mark produced by this macro is nearly as wide as the letter and thus varies in width from one letter to another. \subsubsection{Anudatta (low) tone macro\texorpdfstring{ \texttt{\char92=}}{}, fixed width} This macro takes one argument, the text letter. Example: \verb+\dnveda ... {\dn \={a}gnim}+ This macro may be combined with \verb=\|= for a pluta mark: \verb+\={\|{3}}+. The anudatta mark produced by this macro has a fixed width and is centered under the letter. \subsubsection{Svarita (rising) tone macro\texorpdfstring{ \texttt{\char92|}}{}} This macro takes one argument, the text letter. Example: \verb=\dnveda ... {\dn \|{ii}Le}= This macro may be combined with \verb=\|= for a pluta mark: \verb=\|{\_{3}}=. \subsubsection{Pada separator macro\texorpdfstring{ \texttt{\char92\char126}}{}} This macro inserts a pada separtor between two Devanagari letters. Example: \verb=\dnveda ... {\dn na\_{ra}\~maa}= \subsection{Usage Samples} This subsection provides two small usage samples of Vedic macros. {\dn\dnnum\Large\dncalcutta {\dnveda \_{a}E`n\|{mF}\30Fw\? \_{\7{p}}ro\|{Eh}t\2 \_{y}\3E2w\|{-y} \_{d\?}v\_{\9{m}}E(v\|{j}\qq{m} . \ ho\|{tA}r\2 r\_{\3D7w}DA\|{t}m\qq{m} \quad \rn{1} }} The text above was typeset by: \begin{verbatim} {\dn\dnnum\Large\dncalcutta {\dnveda \_{a}gni\|{mii}Le \_{pu}ro\|{hi}ta.m \_{ya}j~na\|{sya} \_{de}va\_{m.r}tvi\|{ja}m | \ ho\|{taa}ra.m ra\_{tna}dhaa\|{ta}mam \quad 1 }} \end{verbatim} \def\samaindent{\parindent=1.0in} \def\dnitem#1{\noindent\llap{#1\space}\leftskip\parindent} {\dn\dnnum\dncalcutta {\dnsamaveda\samaindent \dnitem{\rn{1}} \^{a}{\rn{2}}\^{`n}{\rn{3}} \^{aA}{\rn{1}} \^{yA}{\rn{2}}Eh \^{vF}{\rn{3}}\^{t}{\rn{1}}\^{y\?}{\rn{2}} \9{g}\^{ZA}{\rn{3}}\^{no}{\rn{2}} \^{h}{\rn{3}}\^{\326wy}{\rn{1}}\^{dA}{\rn{2}}ty\? \\ \^{En}{\rn{1}} ho\^{tA}{\rn{2}r} sE(s \^{b}{\rn{3}}\^{Eh\0}{\rn{1}}\^{Eq}{\rn{2}} \quad \rn{1} }} The text above was typeset by: \begin{verbatim} \def\samaindent{\parindent=1.0in} \def\dnitem#1{\noindent\llap{#1\space}\leftskip\parindent} {\dn\dnnum\dncalcutta {\dnsamaveda\samaindent \dnitem{1} \^{a}{2}\^{gna}{3} \^{aa}{1} \^{yaa}{2}hi \^{vii}{3}\^{ta}{1}\^{ye}{2} g.r\^{.naa}{3}\^{no}{2} \^{ha}{3}\^{vya}{1}\^{daa}{2}taye \\ \^{ni}{1} ho\^{taa}{2ra} satsi \^{ba}{3}\^{rhi}{1}\^{.si}{2} \quad 1 }} \end{verbatim} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{table}[pt] \begin{center} \renewcommand{\arraystretch}{1.35} \begin{tabular}{|l|c|c|c|c|} \hline & \textsc{original} & \textsc{bombay} & \textsc{calcutta} & \textsc{nepali} \\ \hline \textit{a} & {\dn a} & {\dn\dnbombay a} & {\dn\dncalcutta a} & \\ \textit{\underrng{r}} & {\dn \31Bw} & {\dn\dnbombay \31Bw} & {\dn\dncalcutta \31Bw} & \\ \textit{\diatop[\=|\underrng{r}]} & {\dn \311w} & {\dn\dnbombay \311w} & {\dn\dncalcutta \311w} & \\ \textit{\underrng{l}} & {\dn \318w} & {\dn\dnbombay \318w} & {\dn\dncalcutta \318w} & \\ \textit{\diatop[\=|\underrng{l}]} & {\dn \319w} & {\dn\dnbombay \319w} & {\dn\dncalcutta \319w} & \\ \textit{cha} & {\dn C} & {\dn\dnbombay C} & {\dn\dncalcutta C} & \\ \textit{jha} & {\dn J} & {\dn\dnbombay J} & {\dn\dncalcutta J} & {\dn\dnnepali J} \\ \textit{\d{n}a} & {\dn Z} & {\dn\dnbombay Z} & {\dn\dncalcutta Z} & \\ \textit{la} & {\dn l} & {\dn\dnbombay l} & {\dn\dncalcutta l} & \\ \textit{\'sa} & {\dn f} & {\dn\dnbombay f} & {\dn\dncalcutta f} & \\ \textit{1} & {\dn\dnnum 1} & {\dn\dnnum\dnbombay 1} & {\dn\dnnum\dncalcutta 1} & {\dn\dnnum\dnnepali 1}\\ \textit{5} & {\dn\dnnum 5} & {\dn\dnnum\dnbombay 5} & {\dn\dnnum\dncalcutta 5} & \\ \textit{8} & {\dn\dnnum 8} & {\dn\dnnum\dnbombay 8} & {\dn\dnnum\dncalcutta 8} & \\ \textit{9} & {\dn\dnnum 9} & {\dn\dnnum\dnbombay 9} & {\dn\dnnum\dncalcutta 9} & {\dn\dnnum\dnnepali 9}\\ \hline \end{tabular} \end{center} \bigskip \begin{center} \renewcommand{\arraystretch}{1.35} \begin{tabular}{|l|c|c|c|c|} \hline & \textsc{original} & \textsc{bombay} & \textsc{calcutta} & \textsc{nepali} \\ \hline \textit{k\d{s}a} & {\dn "} & {\dn\dnbombay "} & {\dn\dncalcutta "} & \\ \textit{k\d{s}}- & {\dn \symbol{'43}} & {\dn\dnbombay \symbol{'43}} & {\dn\dncalcutta \symbol{'43}} & \\ \textit{\.nk\d{s}a} & {\dn \3B0w} & {\dn\dnbombay \3B0w} & {\dn\dncalcutta \3B0w} & \\ \textit{\.nk\d{s}va} & {\dn \3B1w} & {\dn\dnbombay \3B1w} & {\dn\dncalcutta \3B1w} & \\ \textit{chya} & {\dn \3D0w} & {\dn\dnbombay \3D0w} & {\dn\dncalcutta \3D0w} & \\ \textit{j\~na} & {\dn \3E2w} & {\dn\dnbombay \3E2w} & {\dn\dncalcutta \3E2w} & \\ \textit{j\~n}- & {\dn \symbol{'352}} & {\dn\dnbombay \symbol{'352}} & {\dn\dncalcutta \symbol{'352}} & \\ \textit{jh}- & {\dn \324w} & {\dn\dnbombay \324w} & {\dn\dncalcutta \324w} & {\dn\dnnepali \324w} \\ \textit{\d{n}}- & {\dn \symbol{'27}} & {\dn\dnbombay \symbol{'27}} & {\dn\dncalcutta \symbol{'27}} & \\ \textit{\d{n}\d{n}a} & {\dn \symbol{'233}} & {\dn\dnbombay \symbol{'233}} & {\dn\dncalcutta \symbol{'233}} & \\ \textit{lla} & {\dn \3A5w} & {\dn\dnbombay \3A5w} & {\dn\dncalcutta \3A5w} & \\ \textit{\'{s}}- & {\dn \symbol{'133}} & {\dn\dnbombay \symbol{'133}} & {\dn\dncalcutta \symbol{'133}} & \\ \textit{-ya} & {\dn \symbol{'053}} & {\dn\dnbombay \symbol{'053}} & {\dn\dncalcutta \symbol{'053}} & \\ \textit{h\d{n}a} & {\dn \3A2w} & {\dn\dnbombay \3A2w} & {\dn\dncalcutta \3A2w} & \\ \hline \end{tabular} \end{center} \caption{Standard and Variant \devnag{} Characters} \label{diffs} \end{table} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{center} \begin{table}[p] \renewcommand{\arraystretch}{1.35} \begin{tabular}{|lllll||lllll||lllll|} \hline \# & & \textsc{s} & \textsc{h} & \textsc{mh} & \# & & \textsc{s} & \textsc{h} & \textsc{mh} & \# & & \textsc{s} & \textsc{h} & \textsc{mh} \\ \hline 1 & {\dn k k} & {\dn\symbol{'303}} & {\dn \3C3w} & {\dn ?k} & 36 & {\dn\symbol{'32} c} & {\dn\symbol{'321}} & {\dn \316wc} & {\dn \316wc} & 71 & {\dn d r y} & {\dn\symbol{'357}} & {\dn \3EFw} & {\dn \qb{d}+}\\ 2 & {\dn k t } & {\dn\symbol{'304}} & {\dn \3C4w} & {\dn ?t} & 37 & {\dn\symbol{'32} j} & {\dn\symbol{'322}} & {\dn \316wj} & {\dn \316wj} & 72 & {\dn d v y} & {\dn\symbol{'225}} & {\dn \395w} & {\dn \392w+}\\ 3 & {\dn k n} & {\dn\symbol{'307}} & {\dn ?n} & {\dn ?n} & 38 & {\dn V k} & {\dn\symbol{'326}} & {\dn \3D6w} & {\dn \qq{V}k} & 73 & {\dn D n} & {\dn\symbol{'360}} & {\dn @n} & {\dn @n}\\ 4 & {\dn k m} & {\dn\symbol{'311}} & {\dn ?m} & {\dn ?m} & 39 & {\dn V V} & {\dn\symbol{'323}} & {\dn \3D3w} & {\dn \qq{V}V} & 74 & {\dn n n} & {\dn\symbol{'340}} & {\dn \3E0w} & {\dn \306wn}\\ 5 & {\dn k y} & {\dn\symbol{'310}} & {\dn \3C8w} & {\dn ?y} & 40 & {\dn V W} & {\dn\symbol{'341}} & {\dn \3E1w} & {\dn \qq{V}W} & 75 & {\dn p t} & {\dn\symbol{'330}} & {\dn =t} & {\dn =t}\\ 6 & {\dn k l} & {\dn\symbol{'312}} & {\dn ?l} & {\dn ?l} & 41 & {\dn V y} & {\dn\symbol{'324}} & {\dn \3D4w} & {\dn V+} & 76 & {\dn p n} & {\dn\symbol{'331}} & {\dn =n} & {\dn =n}\\ 7 & {\dn k v} & {\dn\symbol{'313}} & {\dn ?v} & {\dn ?v} & 42 & {\dn W y} & {\dn\symbol{'325}} & {\dn \3D5w} & {\dn W+} & 77 & {\dn p l} & {\dn\symbol{'332}} & {\dn =l} & {\dn =l}\\ 8 & {\dn k t y} & {\dn\symbol{'305}} & {\dn \3C5w} & {\dn ?(y} & 43 & {\dn X g} & {\dn\symbol{'263}} & {\dn \qq{X}g} & {\dn \qq{X}g} & 78 & {\dn b n} & {\dn\symbol{'247}} & {\dn Nn} & {\dn Nn}\\ 9 & {\dn k t v} & {\dn\symbol{'306}} & {\dn \3C6w} & {\dn ?(v} & 44 & {\dn X G} & {\dn\symbol{'264}} & {\dn \qq{X}G} & {\dn \qq{X}G} & 79 & {\dn b b} & {\dn\symbol{'251}} & {\dn Nb} & {\dn Nb}\\ 10 & {\dn k n y} & {\dn\symbol{'346}} & {\dn ?\306wy} & {\dn ?\306wy} & 45 & {\dn X X} & {\dn\symbol{'345}} & {\dn \3E5w} & {\dn \qq{X}X} & 80 & {\dn b v} & {\dn\symbol{'333}} & {\dn Nv} & {\dn Nv}\\ 11 & {\dn k r y} & {\dn\symbol{'347}} & {\dn \3E7w} & {\dn \3E7w} & 46 & {\dn X m} & {\dn\symbol{'273}} & {\dn \qq{X}m} & {\dn \qq{X}m} & 81 & {\dn B n} & {\dn\symbol{'336}} & {\dn