% \iffalse meta-comment
%
% Copyright (C) 1989--1993 by Frank Mittelbach, Rainer Schoepf.
% All rights reserved.
% 
% This file is part of the NFSS2 (New Font Selection Scheme) package.
% 
%  This package 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.
% 
% 
% IMPORTANT NOTICE:
% 
% For error reports in case of UNCHANGED versions see readme files.
% 
% Please do not request updates from us directly.  Distribution is
% done through Mail-Servers and TeX organizations.
% 
% You are not allowed to change this file.  You may however copy
% this file to a file with a different name and then change the copy
% if you obey the restrictions on file changes described in
% readme.mz.
% 
% You are allowed to distribute this file under the condition that
% it is distributed together with all files mentioned in readme.mz8.
% If you receive only some of these files from someone, complain!
% 
% You are NOT ALLOWED to distribute this file alone.  You are NOT
% ALLOWED to take money for the distribution or use of either this
% file or a changed version, except for a nominal charge for copying
% etc.
% \fi
\def\fileversion{v2.0e}
\def\filedate{93/06/12}
\def\docdate {93/06/12}

% \CheckSum{207}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%
% \iffalse
% Copyright (C) 1993 Frank Mittelbach,
% all rights reserved.
% \fi
% 
%
% \title{The {\tt nffntcmd} style option providing
%        NFSS2 font commands}
% \author{Frank Mittelbach}
% \date{\filedate}
%
% \MakeShortVerb\|
%
% \def\dst{{\csname mediumseries\endcsname\sc docstrip}}
% \def\NFSS{{\sf NFSS}}
% \setcounter{StandardModuleDepth}{1}
%
% \changes{v2.0b}{93/05/05}{Removed all LaTeX related cmds}
%
% \maketitle
%
% \begin{abstract}
%   The commands defined in the style file {\tt nffntcmd} are part of
%   the NFSS2 kernel code. Therefore this style file is only necessary
%   if you want to use them with some format that does not run with
%   NFSS2, e.g.\ with plain \TeX, or with \LaTeX{} running NFSS1 or
%   without NFSS at all.
% \end{abstract}
%
% \section{Introduction}
%
% Font changes such as |\bf|, |\sf|, etc.\ are declarations; this means
% that their scope is delimited by the grouping structure,  either by
% the next |\end| of some environment or by explicitly using a group,
% e.g., writing something like |{\bf ...}| in the source. If you make
% the mistake of writing |\bf{...}| (thinking of |\bf| as a command
% with one argument) the result is rather striking.
% 
% Declarative commands are an artifact in the \TeX{} system and for
% several reasons it is better to avoid them on the user level
% whenever possible.  In \LaTeX3 these commands will probably all be
% replaced by environments and font commands taking one argument.
%
% This style file now defines additional font change commands (all
% starting with |\text..|) that have one argument and typeset this
% argument in the requested way. Thus these commands are for
% typesetting short pieces of text in a specific family, series or
% shape.  Table~\ref{tab:nffntcmd} shows all such commands in action.
% A further advantage of using these commands is that they
% automatically take care of any necessary italic correction on either
% side of their argument.
% \begin{table}[h]
% \begin{center}
% \begin{tabular}{lll}
% \textit{Command} & \textit{Corresponds to }& \textit{Action} \\[4pt]
% |\textrm{..}| & |\rm| &
%            Typeset argument in roman family  \\
% |\textsf{..}| & |\sf| &
%            Typeset argument in \textsf{sans serif} family  \\
% |\texttt{..}| & |\tt| &
%            Typeset argument in \texttt{typewriter} family
%                                                            \\[2pt]
% |\textmedium{..}| & |\mediumseries| &
%             Typeset argument in medium series    \\
% |\textbf{..}| & |\bf| &
%             Typeset argument in \textbf{bold} series    \\[2pt]
% |\textnormal{..}| & |\normalshape| &
%             Typeset argument in normal shape  \\
% |\textit{..}| & |\it| &
%             Typeset argument in \textit{italic} shape  \\
% |\textsl{..}| & |\sl| &
%             Typeset argument in \textsl{slanted} shape  \\
% |\textsc{..}| & |\sc| &
%             Typeset argument in \textsc{small caps} shape
%                                                            \\[2pt]
% |\emph{..}| & |\em| &
%              Typeset argument \emph{emphasized} 
% \end{tabular}
% \end{center}
% \caption{Font-change commands with arguments}
% \label{tab:nffntcmd}
% \begin{quote}
% The font change commands provided with the minor style {\tt
% nffntcmd} all start with |\text..| to emphasize that they are for
% use in normal text and to be easily memorable. They automatically take
% care of any necessary italic correction on either side of the
% argument.
% \end{quote}
% \end{table}
% 
% Thus, when using such commands, one does not have to worry about
% forgetting the italic correction when changing fonts.  Only in very
% few situations is this additional space wrong; for example,
% most typographers recommend leaving out the italic correction if a
% low punctuation character, like a comma, directly follows the font
% change.  Since this is partly a matter of taste you have to carry
% out the corrective action by hand. For this the command
% |\nocorr| is provided.  Note that you have to put |\nocorr|
% inside the argument at the left or right depending on which side of
% the text you wish to suppress the italic correction.
% \begin{quote}
% \begin{verbatim}
% \emph{When using the \NFSS{} high-level commands the
% \emph{proper} use of italic corrections is automatically taken
% care of\nocorr}. Only \emph{sometimes} one has to help \LaTeX{} by
% adding a \verb=\nocorr= command.
%\end{verbatim}
%  \end{quote}
%
% This would  result in:
% \begin{quote}
% \emph{When using the \NFSS{} high-level commands the
% \emph{proper} use of italic corrections is automatically taken
% care of\nocorr}. Only \emph{sometimes} one has to help \LaTeX{} by
% adding a \verb=\nocorr= command.
% \end{quote}
%
% 
% \StopEventually{}
%
% \section{The implementation}
%
% We start by writing to the VDU and the transcript file.
%    \begin{macrocode}
%<*style>
\wlog{Style Option: `nffntcmd'
  \fileversion\space <\filedate> (FMi)}
\wlog{English Documentation
  \space\space\space\space\space
  \space\space\space\space <\docdate> (FMi)}
%    \end{macrocode}
%    This style will work even in a plain \TeX{}, so there is no need
%    to make the standard test for a valid NFSS environment.
%
%  \begin{macro}{\textrm}
%  \begin{macro}{\textsf}
%  \begin{macro}{\texttt}
% \changes{v2.0d}{93/06/06}{Added `text@in@math}
%    We start by defining the family commands.
%    \begin{macrocode}
\def\textrm{\protect\ptextrm}
\def\textsf{\protect\ptextsf}
\def\texttt{\protect\ptexttt}
\def\ptextrm{\do@text@\relax\rm\relax}
\def\ptextsf{\do@text@\relax\sf\relax}
\def\ptexttt{\do@text@\relax\tt\relax}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\textbf}
%  \begin{macro}{\textmedium}
%    For the series attribute:
% \changes{v2.0d}{93/06/06}{Added `text@in@math}
%    \begin{macrocode}
\def\textbf{\protect\ptextbf}
\def\ptextbf{\do@text@\relax\bf\relax}
%    \end{macrocode}
%    If |\mediumseries| isn't defined (that is, if we are not under
%    NFSS) we leave out the following definition.
%    \begin{macrocode}
\ifx\mediumseries\undefined\else
  \def\textmedium{\protect\ptextmedium}
  \def\ptextmedium{\do@text@\relax\mediumseries\relax}
\fi
%    \end{macrocode}
%  \end{macro}
%  \end{macro}

%  \begin{macro}{\textit}
%  \begin{macro}{\textsl}
%  \begin{macro}{\textsc}
%  \begin{macro}{\textnormal}
% \changes{v2.0d}{93/06/06}{Added `text@in@math}
%    And for the shapes:
%    \begin{macrocode}
\def\textit{\protect\ptextit}
\def\textsl{\protect\ptextsl}
\def\textsc{\protect\ptextsc}
\def\ptextit{\do@text@\relax\it\/}
\def\ptextsl{\do@text@\relax\sl\/}
\def\ptextsc{\do@text@\sw@slant\sc\relax}
\ifx\normalshape\undefined\else
  \def\textnormal{\protect\ptextnormal}
  \def\ptextnormal{\do@text@\sw@slant\normalshape\relax}
\fi
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
% 
%  \begin{macro}{\emph}
% \changes{v2.0d}{93/06/06}{Added `text@in@math}
%  \begin{macro}{\nocorr}
%    Finally we have the |\em| font change declaration of \LaTeX. The
%    corresponding definition with argument is
%    \begin{macrocode}
\def\emph{\protect\pemph}
\def\pemph{\do@text@\sw@slant\em\/}
\def\nocorr{\kern\z@}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%
%  \begin{macro}{\sw@slant}
%    The definition of the mysterious |\sw@slant| command is:
%    \begin{macrocode}
\def\sw@slant{%
%    \end{macrocode}
%    First we peek ahead to see what comes next.
%    \begin{macrocode}
  \futurelet\next\sw@@slant}
\def\sw@@slant{%
%    \end{macrocode}
%    Then we check if this is either |\nocorr| or |\kern|. The |\kern|
%    can happen if the command was used in a moving argument and the
%    |\nocorr| was expanded. Actually we would need to check for
%    |\kern\z@| in that case but we leave this out since an explicit
%    kern at the beginning of an argument to |\text...| is not likely.
%    \begin{macrocode}
  \ifx\next\nocorr
  \else
    \ifx\next\kern
    \else
%    \end{macrocode}
%    If it is neither a |\nocorr| nor a |\kern| we call |\sw@@@slant|
%    which does the real work.
%    \begin{macrocode}
      \sw@@@slant
    \fi
  \fi}
\def\sw@@@slant{%
  \relax\ifhmode
    \ifdim\lastskip>\z@
      \skip@\lastskip
      \unskip\/\hskip\skip@
    \fi
  \fi
}
%    \end{macrocode}
%    The above code means: ``If there is a positive space in front of
%    the current position (|\ifdim...|) save the amount of that space
%    (|\skip@\lastskip|), remove it (|\unskip|), add the italic
%    correction (|\/|) and finally put the space back in.''  This
%    accounts for situations where we switch from a slanted typeface
%    to an upright one.
%  \end{macro}
%
%
%  \begin{macro}{\do@text@}
%    We start checking whether we are in math mode and if so we
%    surround the text with the |\nfss@text| command which will then
%    go into the current text mode by producing an |\hbox| or something
%    similar (depending on the current definition of |\nfss@text|).
%    \begin{macrocode}
\def\do@text@#1#2#3#4{%
  \relax\ifmmode
    \expandafter\nfss@text
  \fi
%    \end{macrocode}
%    Then we execute |#1| which should be a font change, |#2| which is
%    either |\relax| or |\sw@slant|, then |#4| which is the argument
%    to the |\text...| macro supplied by the user and finally |#3|
%    which is either |\relax| or an |\/|.
%    \begin{macrocode}
    {#1#2#4#3}%
}
%    \end{macrocode}
%  \end{macro}
%
%
%
%  \begin{macro}{\nfss@text}
%    This command will by default behave like a \LaTeX{} |\mbox| but
%    may be redefined by styles such as |amstext.sty| to be a bit
%    cleverer.
%    \begin{macrocode}
\ifx\nfss@text\undefined 
  \def\nfss@text{\leavevmode\hbox}
\fi
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\protect}
%    If we are outside \LaTeX{} |\protect| is not defined and should
%    produce just |\relax|. Since this is the default
%    \begin{macrocode}
\let\protect\relax
%</style>
%    \end{macrocode}
%  \end{macro}
%
% \section{A driver for this document}
%
% The next bit of code contains the documentation driver file for
% \TeX{}, i.e., the file that will produce the documentation you are
% currently reading. It will be extracted from this file by the 
% \dst{} program.
%    \begin{macrocode}
%<*driver>
\documentstyle[doc]{article}

% dimensions from ltugboat.sty:

\setlength\textwidth{31pc} 
\setlength\textheight{54pc}
\setlength{\parindent}{0pt}
\setlength{\parskip}{2pt plus 1pt minus 1pt}
\setlength{\oddsidemargin}{8pc} 
\setlength{\marginparwidth}{8pc}
\setlength{\topmargin}{-2.5pc} 
\setlength{\headsep}{20pt}
\setlength{\columnsep}{1.5pc} 
\setlength{\columnwidth}{18.75pc}

\DisableCrossrefs

\CodelineIndex     % Index code by line number

%\OnlyDescription  % comment out for implementation details

\begin{document}
   \DocInput{nffntcmd.dtx}
\end{document}
%</driver>
%    \end{macrocode}
% 
% \DeleteShortVerb{\|}
% \Finale
%
%
\endinput

