summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/altfont/altfont.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/altfont/altfont.dtx')
-rw-r--r--Master/texmf-dist/source/latex/altfont/altfont.dtx561
1 files changed, 561 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/altfont/altfont.dtx b/Master/texmf-dist/source/latex/altfont/altfont.dtx
new file mode 100644
index 00000000000..093f3cf9cd9
--- /dev/null
+++ b/Master/texmf-dist/source/latex/altfont/altfont.dtx
@@ -0,0 +1,561 @@
+\def\fileversion{1.1} % ^^A -*-latex-*-
+\def\filedate{1996/07/02}
+%\iffalse meta-comment
+%\altfont: A \LaTeXe\ package for using alternative fonts
+%
+%Copyright \copyright\ 1996 Sebastian Marius Kirsch\texttt{%
+% $\langle$sebastian\_kirsch@kl.maus.de$\rangle$}
+%
+%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 2 of the License, 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
+%MERCHANTABILITY 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.
+%\fi
+%
+%\changes{0.9}{1996/06/29}{Based on \texttt{psfont} v1.0d. Not restricted to
+%PostScript fonts.}
+%\changes{0.9a}{1996/06/30}{Updating documentation. Throwing out most \PS\
+%specific parts.}
+%\changes{1.0}{1996/06/30}{1st public release}
+%\changes{1.0a}{1996/07/01}{\texttt{\textbackslash AvailableFont} can have
+%empty arguments}
+%\changes{1.0a}{1996/07/01}{Adding new documentation.}
+%\changes{1.1}{1996/07/02}{2nd public release }
+%
+% \CheckSum{236}
+%% \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 \~}
+%%
+%
+%\title{\altfont: Using alternative fonts\thanks{This file has version number
+%\fileversion, last revised \filedate.}}
+%
+%\author{Sebastian Marius Kirsch\\
+% \texttt{sebastian\_kirsch@kl.maus.de}}
+%
+%\date{\filedate}
+%
+%\maketitle
+%
+%\begin{abstract}
+%With this package, you can use many alternative fonts with one single
+%package. \psNFSS\ and \mfNFSS\ use one file for every font, while I prefer
+%having everything in one package. Besides, of you load two of the font
+%changing packages, the latter one overwrites the changes of the first
+%one. Having all in one package avoids this.
+%\end{abstract}
+%
+%\section{Introduction}
+%
+%This package is intended as a replacement for some parts of both \psNFSS\ and
+%\mfNFSS. It is a replacement for the parts that actually change the default
+%fonts. It was originally written as a replacement for \textsf{psfonts} of
+%\psNFSS, but I realized that it was not very reasonable to restrict it to
+%PostScript fonts. So it is now not focused on any particular PostScript font,
+%but can be used for any font, \MF\ or PostScript. I'll discuss this in detail
+%in section \ref{sec:psmfnfss}.
+%
+%\section{Installation}
+%
+%The actual package is produced by running \TeX\ on |altfont.ins|. This
+%produces |altfont.sty|, the style file, and |altfont.cfg|, the configuration
+%file. Both files must be moved where \TeX\ can find them.
+%
+%\subsection{The configuration file}
+%
+%\DescribeMacro{\AvailableRMFont}
+%\DescribeMacro{\AvailableRMFont}
+%\DescribeMacro{\AvailableRMFont}
+%\DescribeMacro{\AvailableFont}
+%All available fonts must declared in the configuration file. This is done
+%using the macros |\AvailableRMFont|, |\AvailableSFFont|, |\AvailableTTFont|,
+%and |\AvailableFont|. They have the following syntax:
+%
+%\begin{quote}
+% \cmd{\AvailableRMFont}\oarg{additional code}\marg{long name}\marg{\NFSS\
+% family name}\\
+% \cmd{\AvailableSFFont}\oarg{additional code}\marg{long name}\marg{\NFSS\
+% family name}\\
+% \cmd{\AvailableTTFont}\oarg{additional code}\marg{long name}\marg{\NFSS\
+% family name}\\
+% \cmd{\AvailableFont}\oarg{additional code}\marg{symbolic name}%
+% \marg{roman font}\texttt{\%}\\\marg{sans serif font}\marg{typewriter font}
+%\end{quote}
+%
+%The first argument contains a symbolic name for the font, while the second
+%argument contains the internal name for the family. The symbolic name is to
+%be used as an option to the package. (It is easier to remember Times as
+%\texttt{times} than as \texttt{ptm}.)
+%
+%The optional argument contains code that is executed after the font is
+%loaded. It can be used to e.~g.\ change the font encoding or to redefine some
+%other defaults such as |\bfdefault|.
+%
+%The macro |\AvailableFont| does the same, but for three font families at
+%once. This can be used for font families that have the varinats sans serif
+%and typewriter, e.~g.\ the Computer Modern fonts, as well as for managing a
+%combination of three fonts under one short name. The arguments can also be
+%empty.
+%
+%Typical commands looks like this:
+%
+%\begin{verbatim}
+%\AvailableRMFont{times}{ptm}
+%\AvailableSFFont{helv}{phv}
+%\AvailableTTFont{Courier}{pcr}
+%\AvailableFont[\altfontenc{T1}]{dco}{cmor}{cmoss}{cmott}
+%\end{verbatim}
+%
+%\DescribeMacro{\DefaultRMFont}
+%\DescribeMacro{\DefaultSFFont}
+%\DescribeMacro{\DefaultTTFont}
+%You can also tell \altfont\ about default \PS\ fonts. If the user calls the
+%option |onlyps|, the default fonts are substituted for the fonts he has not
+%defined. This is useful when you do not want to supply every font to be used
+%in the document, but want your document to contain only \PS\ fonts. The
+%syntax of these commands looks like this:
+%
+%\begin{quote}
+% \cmd{\DefaultRMFont}\marg{\NFSS\ family name}\\
+% \cmd{\DefaultSFFont}\marg{\NFSS\ family name}\\
+% \cmd{\DefaultTTFont}\marg{\NFSS\ family name}
+%\end{quote}
+%
+%\DescribeMacro{\altfontenc}
+%If you want to change the font encoding in the \meta{additional code} section
+%of any of the |\Available|\ldots|Font| macros, you have to use |\altfontenc|
+%instead of a plain |\RequirePackage[|\ldots|]{fontenc}|. The reason for this
+%is discussed later. This is the syntax of |\altfontenc|:
+%
+%\begin{quote}
+% \cmd{\altfontenc}\marg{encoding}
+%\end{quote}
+%
+%Generally, you can neither use commands that have
+%optional arguments nor load classes or packages in the \meta{additional code}
+%section.
+%
+%\section{Syntax}
+%
+%You load the package with |\usepackage[|\ldots|]{altfont}|, as usual, with
+%the fonts you want to use in square brackets. Typical commands look like
+%this:
+%
+%\begin{verbatim}
+%\usepackage[palatino,gill,courier]{altfont}
+%\usepackage[newcent,onlyps]{altfont}
+%\usepackage[dco]{altfont}
+%\usepackage[pandora,courier]{altfont}
+%\end{verbatim}
+%
+%\section{\psNFSS\ vs. \mfNFSS}
+%\label{sec:psmfnfss}
+%
+%There are two other popular packages for using alternative fonts with \LaTeX:
+%\psNFSS\ by Sebastian Rahtz, which is responsible for \PS\ fonts, and
+%\mfNFSS\ by Frank Mittelbach and Rainer Sch\"opf, which focuses on
+%\MF\ fonts.
+%
+%In my opinion, it was not very reasonable to divide the font changing between
+%two packages. The fonts look to \LaTeX\ all the same, so why make a
+%difference in the packages?
+%
+%For fonts which are to be used as |\{rm,sf,tt}default| fonts, both packages
+%have little style files which change these defaults. But if you load two of
+%those packages, the latter overwrites the changes of the first one. These
+%packages all do the same, so why not include them into one style file?
+%
+%Well, I did this, and the result is easier to use and safer than the
+%packages from \psNFSS\ and \mfNFSS. Because of these improvements, I would
+%like my package to get included into these packages. (I know, I'm
+%unselfish. ;-)
+%
+%Since \psNFSS\ and \mfNFSS\ focuse on particular fonts, while my package can
+%be used with any font, it is not very likely to be included in either
+%package, though both could make use of it.
+%
+%\section{Legal rubbish}
+%\altfont: A \LaTeXe\ package for using alternative fonts
+%
+%Copyright \copyright\ 1996 Sebastian Marius Kirsch\texttt{%
+% $\langle$sebastian\_kirsch@kl.maus.de$\rangle$}
+%
+%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 2 of the License, 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
+%MERCHANTABILITY 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.
+%
+%\StopEventually
+%
+%\section{The \texttt{docstrip} modules}
+%
+%This file contains three modules to direct \texttt{docstrip} in generating the
+%external files:
+%
+%\begin{tabular}[t]{ll}
+%driver & A short driver for producing the documentation\\
+%package & The package itself\\
+%config & The local configuration file\\
+%\end{tabular}
+%
+%\section{Producing the documentation}
+%
+%This short driver can be extracted by \texttt{docstrip} to produce the
+%documentation.
+%
+% \begin{macrocode}
+%<*driver>
+\documentclass{ltxdoc}
+
+\usepackage{mflogo}
+\providecommand{\MF}{\textsf{METAFONT}} % for those without mflogo.sty
+
+\newcommand*{\NFSS}{\mbox{\textsf{NFSS}}}
+\newcommand*{\psNFSS}{\mbox{\textsf{psNFSS}}}
+\newcommand*{\mfNFSS}{\mbox{\textsf{mfNFSS}}}
+\newcommand*{\altfont}{\textsf{alt\-font}}
+\newcommand*{\PS}{Post\-Script}
+
+\begin{document}
+
+\DocInput{altfont.dtx}
+
+\end{document}
+%</driver>
+% \end{macrocode}
+%
+%\section{The Code}
+%
+%\subsection{Introduction}
+%
+%First we have to introduce ourselves.
+%
+% \begin{macrocode}
+%<*package>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{altfont}%
+ [\filedate\space v\fileversion\space loading alternative fonts]
+% \end{macrocode}
+%
+%\subsection{Switches}
+%
+%Next, we define some switches. They are used to determine whether some fonts
+%have already been loaded, so we can warn the user when he tries to load two
+%colliding fonts.
+%
+% \begin{macrocode}
+\newif\ifrm@set\rm@setfalse
+\newif\ifsf@set\sf@setfalse
+\newif\iftt@set\tt@setfalse
+% \end{macrocode}
+%
+%\subsection{Default \PS\ fonts}
+%
+%\begin{macro}{\DefaultRMFont}
+%\begin{macro}{\DefaultSFFont}
+%\begin{macro}{\DefaultTTFont}
+%These are some commands for changing the default \PS\ fonts.
+%
+% \begin{macrocode}
+\newcommand{\DefaultRMFont}[1]{\renewcommand{\def@rmfont}{#1}}
+\newcommand{\DefaultSFFont}[1]{\renewcommand{\def@sffont}{#1}}
+\newcommand{\DefaultTTFont}[1]{\renewcommand{\def@ttfont}{#1}}
+\newcommand{\def@rmfont}{}
+\newcommand{\def@sffont}{}
+\newcommand{\def@ttfont}{}
+% \end{macrocode}
+%\end{macro}\end{macro}\end{macro}
+%
+%\subsection{Declaring the options}
+%
+%\begin{macro}{\AvailableRMFont}
+%\begin{macro}{\AvailableSFFont}
+%\begin{macro}{\AvailableTTFont}
+%These commands are needed later in the configuration
+%file. There is one command for each font family, ie.\ roman, sans serif or
+%typewriter.
+%
+%They declare their first argument as an option.
+%
+%If the option is called, and the font family has already been defined, a
+%\cmd{\PackageError} is reported. If not, the second argument is defined as
+%the approriate family default.
+%
+%When the family default has successfully been set, the corresponding switch
+%is turned, so it is not redefined anywhere else in this file.
+%
+%The optional argument contains some code that is to be executed when the
+%defaults have been set. This is a very useful hook, e.~g.\ when a certain
+%font family is only available in OT1 or Cork encoding, we can execute a
+%|\altfontenc{OT1}| after the font is loaded. This command is a little hack to
+%get around some limitations of |\newcommand| and |\DeclareOption| and is
+%described in section \ref{sec:altfontenc}. A plain |\usepackage| will not
+%work!
+%
+% \begin{macrocode}
+\newcommand{\AvailableRMFont}[3][]{%
+ \DeclareOption{#2}{%
+ \ifrm@set\PackageError{altfont}{%
+ \protect\rmfamily\space already defined as \rmdefault
+ }{%
+ You tried to load two roman families at the same time,\MessageBreak
+ e.g. times and palatino}
+ \else\renewcommand{\rmdefault}{#3}\rm@settrue
+ #1
+ \fi}
+ }
+\newcommand{\AvailableSFFont}[3][]{%
+ \DeclareOption{#2}{%
+ \ifsf@set\PackageError{altfont}{%
+ \protect\sffamily\space already defined as \sfdefault
+ }{%
+ You tried to load two sans serif families at the same time,\MessageBreak
+ e.g. gill and helvetica}
+ \else\renewcommand{\sfdefault}{#3}\sf@settrue
+ #1
+ \fi}
+ }
+\newcommand{\AvailableTTFont}[3][]{%
+ \DeclareOption{#2}{%
+ \iftt@set\PackageError{altfont}{%
+ \protect\ttfamily\space already defined as \ttdefault
+ }{%
+ You tried to load two typewriter families at the same time,\MessageBreak
+ e.g. courier and typewriter}
+ \else\renewcommand{\ttdefault}{#3}\tt@settrue
+ #1
+ \fi}
+ }
+% \end{macrocode}
+%\end{macro}\end{macro}\end{macro}
+%
+%\subsection{One command fits all}
+%
+%\begin{macro}{\AvailableFont}
+%With the macro |\AvailableFont|, all three defaults are set with one
+%option. This is useful for managing combinations of three fonts under one
+%name, as well as for fonts that have the variants sans serif and
+%typewriter. (The Computer Modern fonts are one of those, and Lucida, I
+%think.)
+%
+%|\AvailableFont| may also have empty arguments.
+%
+% \begin{macrocode}
+\newcommand*{\AvailableFont}[5][]{%
+ \DeclareOption{#2}{%
+ \def\@temprm{#3}\def\@tempsf{#4}\def\@temptt{#5}
+ \ifx\empty\@temprm\else
+ \ifrm@set\PackageError{altfont}{%
+ \protect\rmfamily\space already defined as \rmdefault
+ }{%
+ You tried to load two roman families at the same time,
+ \MessageBreak e.g. times and palatino}
+ \else\renewcommand{\rmdefault}{#3}\rm@settrue
+ \fi
+ \fi
+ \ifx\empty\@tempsf\else
+ \ifsf@set\PackageError{altfont}{%
+ \protect\sffamily\space already defined as \sfdefault
+ }{%
+ You tried to load two sans serif families at the same time,
+ \MessageBreak e.g. gill and helvetica}
+ \else\renewcommand{\sfdefault}{#4}\sf@settrue
+ \fi
+ \fi
+ \ifx\empty\@temptt\else
+ \iftt@set\PackageError{altfont}{%
+ \protect\ttfamily\space already defined as \ttdefault
+ }{%
+ You tried to load two typewriter families at the same time,
+ \MessageBreak e.g. courier and typewriter}
+ \else\renewcommand{\ttdefault}{#5}\tt@settrue
+ \fi
+ \fi
+ #1
+ }
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Loading font encodings in \texttt{\textbackslash Available\ldots
+%Font}}
+%\label{sec:altfontenc}
+%
+%\begin{macro}{\altfontenc}
+%Working on this package, I discovered two limitations of |\newcommand| and
+%|\DeclareOption|.
+%
+%\begin{itemize}
+%\item You cannot use a command with an optional argument in the argument of
+% another command.
+%\item You cannot load a package with |\RequirePackage| or |\usepackage| in the
+% \meta{code} section of a |\DeclareOption| command.
+%\end{itemize}
+%
+%I wanted to be able to load different font encodings in the optional argument
+%of the |\Available|\ldots|Font| command, so I had to work around these
+%limitations. The result is this command:
+%
+% \begin{macrocode}
+\newcommand*{\altfontenc}[1]{\PassOptionsToPackage{#1}{fontenc}%
+ \AtEndOfPackage{\RequirePackage{fontenc}}}
+% \end{macrocode}
+%\end{macro}
+%
+%By passing the option to \texttt{fontenc} with |\PassOptionsToPackage|, I
+%avoid having an optional argument to |\RequirePackage|. By delaying the
+%|\RequirePackage|, I avoid loading a package in an option. Ugly but useful.
+%
+%\subsection{Loading the configuration file}
+%
+%Next, the configuration file is loaded. If it is not found, an error is
+%issued, because the package is quite useless without it.
+%
+% \begin{macrocode}
+\InputIfFileExists{altfont.cfg}{}{%
+ \PackageError{altfont}{%
+ No local configuration file found
+ }{%
+ The altfont package was loaded without a local\MessageBreak
+ configuration file, so it doesn't know which fonts\MessageBreak
+ are available.}
+ }
+%</package>
+% \end{macrocode}
+%
+%\subsection{The configuration file}
+%
+%The configuration file looks like this:
+%
+%\subsubsection{Introduction}
+%
+%As usual\ldots
+%
+% \begin{macrocode}
+%<*config>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesFile{altfont.cfg}%
+ [\filedate\space v\fileversion\space Local configuration for altfont.sty]
+% \end{macrocode}
+%
+%\subsubsection{Declaring default PostScript fonts}
+%
+%Here, the default PostScript fonts are defined. They are needed later, if the
+%author does not define all fonts he wants to use, but wants his document to
+%contain only \PS\ fonts. Strictly spoken, this does not belong to a package
+%for \PS\ and \MF\ fonts, but I think it is nonetheless very useful.
+%
+% \begin{macrocode}
+\DefaultRMFont{ptm}
+\DefaultSFFont{phv}
+\DefaultTTFont{pcr}
+% \end{macrocode}
+%
+%\subsubsection{Available fonts}
+%
+%Now the available fonts are defined. They are divided into three
+%categories---roman fonts, sans serif fonts and typewriter fonts, as it is
+%done in \LaTeXe\ itself.
+%
+%They are defined using the |\Available|\ldots|Font| macros. These macros
+%define a symbolic name to be used as an option to the package, and take the
+%name of the \NFSS\ font family as a second argument.
+%
+% \begin{macrocode}
+\AvailableRMFont{times}{ptm}
+\AvailableRMFont{palatino}{ppl}
+\AvailableRMFont{newcent}{pnc}
+
+\AvailableSFFont{helv}{phv}
+\AvailableSFFont{gill}{pgs}
+
+\AvailableTTFont{courier}{pcr}
+
+\AvailableFont[\altfontenc{T1}]{dco}{cmor}{cmoss}{cmott}
+\AvailableFont[\altfontenc{OT1}%
+ \DeclareFontSubstitution{OT1}{pnr}{m}{n}%
+ \renewcommand{\bfdefault}{b}%
+ \renewcommand{\itdefault}{sl}]{pandora}{pnr}{pnss}{pntt}
+%</config>
+% \end{macrocode}
+%
+%In case you wonder, the dco fonts are another package I wrote. They consist
+%of the regular dc fonts with oldstyle digits. I didn't release it yet,
+%contact me if you are interested.
+%
+%And that's the configuration. Of course one could do much more with this
+%configuration file, declaring new options and all. It's probably the biggest
+%hook a package could have. :-)
+%
+%\subsection{\texttt{onlyps}: Using only \PS\ fonts}
+%
+%\begin{macro}{onlyps}
+%This option redefines all other family defaults that have not yet been
+%\cmd{\renewcommand}ed to \PS\ fonts. It uses the default fonts as defined in
+%the configuration file. If no default fonts have been defined, an error is
+%reported.
+%
+% \begin{macrocode}
+%<*package>
+\DeclareOption{onlyps}{
+ \ifrm@set\else
+ \ifx\empty\def@rmfont
+ \PackageWarning{altfont}{No default roman font defined!}
+ \else\renewcommand{\rmdefault}{\def@rmfont}\fi
+ \fi
+ \ifsf@set\else
+ \ifx\empty\def@sffont
+ \PackageWarning{altfont}{No default sans serif font defined!}
+ \else\renewcommand{\sfdefault}{\def@sffont}\fi
+ \fi
+ \iftt@set\else
+ \ifx\empty\def@ttfont
+ \PackageWarning{altfont}{No default typewriter font defined!}
+ \else\renewcommand{\ttdefault}{\def@ttfont}\fi
+ \fi
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{The end}
+%
+%At last, the options are processed.
+%
+% \begin{macrocode}
+\ProcessOptions
+%</package>
+% \end{macrocode}
+%
+%\Finale
+\endinput