% LaTeX2e package for using Velthuis's Devanagari font.
% =====================================================
%
% Sample input .dn file:
%
% \documentclass{article}
% \usepackage{dev}
% \begin{document}
% {\dn devaanaa.m priya.h}
% \end{document}
%
% Sample input .dn file with hyphenation:
%
% \documentclass{article}
% \begin{document}
% @hyphen
% {\dn devaanaa.m priya.h}
% \end{document}
%
%
% The Identification Part
% ~~~~~~~~~~~~~~~~~~~~~~~
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesFile{dev.sty}[1999/13/13 $Revision: 1.14 $. LaTeX2e macros
        to set up Velthuis Devanagari font.]
%
% Error message for someone running LaTeX 2.09:
%
\@ifundefined{selectfont}
{\@latexerr{This "dev" style option may only be used with LaTeX2e.^^J
        Use "dev209.sty" instead.}\@eha
        \endinput}{}
%
% Error message for someone running LaTeX2e in 2.09 compatibility mode:
%
\if@compatibility
\PackageError{dev}{%
        This `dev' package is only for use with LaTeX2e.\MessageBreak
        If you absolutely must use LaTeX 2.09 compatibility mode,\MessageBreak
        you could try using the older `dev209.sty' file instead,\MessageBreak
        but the results are not predictable}{You will not
        get any further with this approach.
        Just press "X" and quit now.}
\fi
%
%
% The Declaration of Options
% ~~~~~~~~~~~~~~~~~~~~~~~~~~
% \DeclareFontEncoding{}{}{} % Already done by standard classes.
\DeclareFontSubstitution{U}{dn}{m}{n}
%
% Hyphenation
% ~~~~~~~~~~~
% The responsibility for hyphenating Devanagari text is taken over completely by
% the preprocessor, devnag.c.  The preprocessor inserts discretionary hyphenation
% points (\-) in all the places it thinks are appropriate.
%
% In the present style file, therefore, we simply need to do two things.  First we
% want to tell TeX where the hyphen is in the font, i.e., at position 255.  This we
% do in \DeclareFontFamily macro in the font definition file, Udn.fd.
%
% Next, we want to prevent TeX doing any automatic hyphenation except where
% devnag.c inserts discretionary hyphenation points.
% This is a bit tricky: we invoke a special "language" which has been defined not
% to have any hyphenation.  This is defined in language.dat as
% "nohyphenation zerohyph.tex", i.e., a hyphenation file without any entries is
% loaded.  When the LaTeX2e format is built (initex \dump) usually a file
% hyphen.cfg will be loaded by the main latex.ltx format file.  In turn, hyphen.cfg
% loads language.dat.  If this little chain of file references fails, you can try
% doing all this manually by adding the following lines into your LaTeX format
% at the time of doing a \dump of the format file:
%
% \newlanguage\l@nohyphenation
% \language\l@nohyphenation
% \begingroup\patterns{}\endgroup % no patterns
%
% Or, since any newly defined language initially has no associated hyphenation
% patterns, it is probably enough just to uncomment the following lines in this
% style file, which saves you having to make a new format file:
%
% \newlanguage\l@nohyphenation
% \language\l@nohyphenation
%
% Okay, so here's what we do about disabling automatic hyphenation for the present
% incarnation of dev.sty.  We simply say "\language\l@nohyphenation" in the main \dn
% macro.  The use of the name \l@nohyphenation is meant to be forward-compatible
% with LaTeX2e's future, so we just do a little check here to make sure we can use
% it, and define it if it doesn't already exist:
%
%\@ifundefined{\l@nohyphenation}{\let\l@nohyphenation=\nohyphenation}{\relax}
%
%
% The Main Code Part
% ~~~~~~~~~~~~~~~~~~
% Now define the main Devanagari macro, \dn.
%
\DeclareRobustCommand\dn{%
  \usefont{U}{dn}{m}{n}%
% \language=\l@nohyphenation
  \renewcommand*{\-}{\@@hyph}%
  \hfuzz=4pt
  \tolerance=10000\pretolerance=10000
  \emergencystretch=.2\hsize % remove this line if you are not using TeX > 3.0
  \baselineskip1.27\baselineskip }
%
% Here is the macro \do@dev@catcodes that changes the catcodes
% appropriately for Devanagari:
%
\newcount\dev@chnum
%
\newcommand*\do@dev@catcodes{%
  \dev@chnum=0
  \loop\catcode\dev@chnum=11
    \ifnum\dev@chnum<12 \advance\dev@chnum by1
    \repeat
  \dev@chnum=14
  \loop\catcode\dev@chnum=11
    \ifnum\dev@chnum<31 \advance\dev@chnum by1
    \repeat
  \catcode127=11 }
%
% We execute the macro straight away, which means these catcodes are in
% force throughout the whole document, not just in the Devanagari part
% of the text.  This can sometimes cause spurious "Omega" characters if,
% in some special conditions, TeX reads a line feed outside the \dn environment,
% and so forth.
% The alternative, i.e., calling the catcodes locally within Devanagari text, leads
% to even worse "illegal character" problems with \chapter and \section headings, etc.
% This dilemma may be soluble in the longer run, but is not being addressed in
% the current release (1999).
%
\do@dev@catcodes
%
% Here are the macros that set the particular characters in the font:
%
\newdimen\itdim
%
\DeclareRobustCommand*\subscr[1]{\/\itdim=\lastkern
  \unkern\kern-\itdim \lower\dp0 \hbox to\itdim{#1\hfil}}
%
\DeclareRobustCommand*\0{\llap{\char13}}
\DeclareRobustCommand*\1{\llap{\char32}}
\DeclareRobustCommand*\2{\llap{\char92}}
\def\3#1w{{\char"#1}}
\DeclareRobustCommand*\4{\llap{\char123}}
\DeclareRobustCommand*\5{\llap{\char125}}
\DeclareRobustCommand*\6[1]{\setbox0=\hbox{#1}#1\subscr{\char126}}
\DeclareRobustCommand*\7[1]{\setbox0=\hbox{#1}#1\subscr{\char0}}
\DeclareRobustCommand*\8[1]{\setbox0=\hbox{#1}#1\subscr{\char1}}
\DeclareRobustCommand*\9[1]{\setbox0=\hbox{#1}#1\subscr{\char2}}
\DeclareRobustCommand*\qa[2]{\setbox0=\hbox{#1}#1\subscr{\char253\kern1.5ex\lower1.25ex
  \hbox{\char#2}\kern-1.5ex}}
\DeclareRobustCommand*\qb[1]{\setbox0=\hbox{#1}#1\subscr{\char253}}
% New \qc ligature command introduced by devnag version 2:
\DeclareRobustCommand*\qc[2]{\setbox0=\hbox{#1}#1\subscr{\char126\kern1.5ex\lower1.25ex
  \hbox{\char#2}\kern-1.5ex}}
\DeclareRobustCommand*\qq[1]{\setbox0=\hbox{#1}#1\subscr{\char94}}
\DeclareRobustCommand*\qx[1]{\setbox0=\hbox{#1}#1\subscr{\char14}}
\DeclareRobustCommand*\qy[1]{\setbox0=\hbox{#1}#1\subscr{\char31}}
\DeclareRobustCommand*\qz[1]{\setbox0=\hbox{#1}#1\subscr{\char124}}
\DeclareRobustCommand*\qva{\kern0.5ex\2\kern-0.5ex}
\DeclareRobustCommand*\qvb{\kern1ex\0\kern-1ex}
\DeclareRobustCommand*\qvc{\kern1ex\rdt\kern-1ex}
\DeclareRobustCommand*\?{\llap{\char3}}
\DeclareRobustCommand*\<{\llap{\char4}}
\DeclareRobustCommand*\rs{\rm\thinspace}
\let\re=\thinspace
\DeclareRobustCommand*\rdt{\llap{\char19}}
\DeclareRobustCommand*\dnnum{\let\nstyle=d}
\DeclareRobustCommand*\cmnum{\let\nstyle=r}
\cmnum
\DeclareRobustCommand*\rn[1]{\if\nstyle r{\rm #1}\else#1\fi}
%
%
% Fixes
% ~~~~~
% Here are some fixes for specific situations, provided by Francois Patte.
%
% Because TeX interprets [ and ] of the biblabel as dn char 133 and
% 135 the package cite is needed to use the command cite in the nagari
% text. This section corrects this behaviour.
% -- F. Patte.
%
\IfFileExists{cite.sty}
 {%
\RequirePackage{cite} }%
{ \newcommand\citeleft{}%
  \newcommand\citeright{}%
  \newcommand\citemid{}%
\typeout{}
\typeout{Package dev Info: Package cite.sty doesn't exist on your
 system.^^J
\space\space\space\space\space\space\space\space\space\space
\space\space\space\space\space\space\space
 This package is needed if you want to make a
 bibliography ^^J
\space\space\space\space\space\space\space\space\space\space
\space\space\space\space\space\space\space
within the Devanagari text.}
}
\typeout{}
%
\renewcommand{\citeleft}{{\rm\bfseries[$\!$[}}
\renewcommand{\citeright}{{\rm\bfseries ]$\!$]}}
\renewcommand\@biblabel[1]{{\rm\bfseries [$\!$[}
#1{\rm\bfseries ]$\!$]}}
\renewcommand\citemid{{\LARGE{\dn\char'24 }}} %
%
% end the cite correction by F. Patte.
%
%
% This section corrects the use of LaTeX commands within the
% Devanagari text for those who want a nagari text with an European
% make-up: e.g. \item in enumerate environment will produce
% the number followed by a danda because the period stands for a danda
% in Velthuis'translation scheme.
% -- F. Patte.
%
\@ifundefined{@dev}
 {%
  \renewcommand\@biblabel[1]{{\rm\bfseries [$\!$[
  #1 ]$\!$]}}
  \renewcommand{\MakeUppercase}{}
 \newcommand{\notedn}[1]{\footnote{\dn #1}}
%
\@ifundefined{chapter}{}{%
%
\newcommand{\old@part}{} % Test if \old@part can be used.
\let\old@part\part
%
\renewcommand{\part}{%
  \@ifstar{\new@partstar}{%
    \@ifnextchar[{\new@partopt}{\new@part}%
  }%
}
\newcommand{\new@partstar}[1]{%
  \old@part*{#1}%
}
\newcommand{\new@partopt}[2][]{%
  \old@part[#1\rm]{#2\rm}%
}
\newcommand{\new@part}[1]{%
  \old@part{#1\rm}%
}
%
\newcommand{\old@chapter}{} % Test if \old@chapter can be used.
\let\old@chapter\chapter

\renewcommand{\chapter}{%
  \@ifstar{\new@chapterstar}{%
    \@ifnextchar[{\new@chapteropt}{\new@chapter}%
  }%
}
\newcommand{\new@chapterstar}[1]{%
  \old@chapter*{#1}%
}
\newcommand{\new@chapteropt}[2][]{%
  \old@chapter[#1\rm]{#2\rm}%
}
\newcommand{\new@chapter}[1]{%
  \old@chapter{#1\rm}%
}
}
  \AtBeginDocument{%
    \renewcommand\labelenumi{{\rm\theenumi.}}%
    \renewcommand\labelenumii{{\rm(\theenumii)}}%
%    \iflanguage{french}{%
%          \renewcommand\labelitemi{{\rm\bfseries\textendash}}%
%          \renewcommand\labelitemii{{\rm\bfseries\textendash}}%
%          \renewcommand\labelitemiii{{\rm\bfseries\textendash}}%
%          \renewcommand\labelitemiv{{\rm\bfseries\textendash}}%
%    }{%
%          \renewcommand\labelitemi{{\rm\textbullet}}%
%          \renewcommand\labelitemii{\normalfont\bfseries \textendash}
%          \renewcommand\labelitemiii{\textasteriskcentered}
%          \renewcommand\labelitemiv{\textperiodcentered}
%      }%
 }
}{}
%
% The end.
% ~~~~~~~~
\endinput



Here is the log file, created by RCS.

% % $Log: dev.sty $
% % Revision 1.14  1998/08/26 17:41:54  UCGADKW
% % o just get the revision numbers back on track.
% %
% % Revision 1.10  1998/08/26 17:30:46  UCGADKW
% % o  Changed name of dev2e.sty to dev.sty
% % o  Many other changes to make the package more "LaTeX2e-like".
% % o  Followed the suggestions of Francois Patte and David Kastrup,
% %    to whom many thanks (but no blame for my errors).
% % o  Most unsatisfactory change: moved \do@dev@catcodes back into
% %    the open, instead of being just active inside {\dn } environments.
% %    This was necessary to avoid "illegal character" messages from
% %    text inside \section{} arguments, etc.
% %
% % Revision 1.9  1998/06/22 12:19:08  UCGADKW
% % o  Corrected \ProvidesFile usage and added "Revision: 1.12" string to it;
% % o  Moved RCS log entries to after \endinput.
% %
% % Revision 1.11  1998/06/22 12:11:17  UCGADKW
% % o  added $Revision: 1.14 $ to \ProvidesFile;
% % o  moved RCS log to after \endinput.
% %
% % Revision 1.10  1998/06/22 12:10:00  UCGADKW
% % o  added $Revision $ to \ProvidesFile;
% % o  moved RCS Log to after \endinput.
% %
% % Revision 1.9  1998/06/22 12:05:20  UCGADKW
% % o  corrected \ProvidesFile argument.
% %
% % Revision 1.8  1998/06/15 12:52:12  dom
% % *** empty log message ***
% %
% % Revision 1.7  1998/06/15 12:50:00  dom
% % o  \chyph now referred to from OT1dn.fd;
% % o  Tidied up banner message.
% %
% % Revision 1.6  1995/05/26 13:48:56  dom
% % *** empty log message ***
% %
% % Revision 1.5  1995/01/24 12:33:48  dom
% % o replaced \if statements with tokens,
% % o made an official "hyphenate" option.
% %
% Revision 1.2  1994/06/15  16:22:13  Dominik_Wujastyk
% o  tidied up comments.
%
% Revision 1.1  1994/06/15  16:15:17  Dominik_Wujastyk
% Initial revision
%
