diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-11 23:50:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-11 23:50:51 +0000 |
commit | 6368edcfac29bdd44a84531d6c5de9b52e92cace (patch) | |
tree | 4e53d03c7c708ec84aa3b6da6e401eea12c1368e /Master/texmf-dist/source/latex/altfont/psfont.dtx | |
parent | 6b403fbd3f7417c41cb8c7b8011b27d7c4e87b24 (diff) |
trunk/Master/texmf-dist/source/latex/altfont
git-svn-id: svn://tug.org/texlive/trunk@138 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/altfont/psfont.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/altfont/psfont.dtx | 559 |
1 files changed, 559 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/altfont/psfont.dtx b/Master/texmf-dist/source/latex/altfont/psfont.dtx new file mode 100644 index 00000000000..f2750b7af5b --- /dev/null +++ b/Master/texmf-dist/source/latex/altfont/psfont.dtx @@ -0,0 +1,559 @@ +\def\fileversion{1.1} +\def\filedate{1996/06/30} +%\iffalse meta-comment +%\psfont: A \LaTeXe\ package for using PostScript 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/05/18}{First version using \texttt{doc} and +% \texttt{docstrip}} +%\changes{1.0}{1996/05/31}{First public release} +%\changes{1.0a}{1996/06/27}{Renamed to psfont. Updating documentation.} +%\changes{1.0b}{1996/06/28}{Optional argument for \cmd{\Available}\ldots} +%\changes{1.0c}{1996/06/29}{Inserted some code from psnfss. Some very +%enlightning thoughts about the future of this package.} +%\changes{1.0d}{1996/06/29}{New command \texttt{AvailableFont}. Why split this +%up between \psNFSS\ and \textsf{mf}\NFSS?} +%\changes{1.0e}{1996/06/30}{New syntax for \texttt{Default}\ldots\texttt{Font}} +%\changes{1.1}{1996/06/30}{Second public release} +% +% \CheckSum{364} +%% \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{\psfont: A general way to use\\ +% PostScript 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} +% This package provides a general way to use PostScript fonts +% without handling with thousands of style files, one for each font you want +% to use. It works with a style file, \texttt{psfont.sty}, which contains all +% the macros, and a configuration file, \texttt{psfont.cfg}, which tells the +% style file about the available fonts. +%\end{abstract} +% +%\section{Introduction} +% +%This package lets you use one single package to load every PostScript font you +%would want. You don't have to load one file for each font anymore, and the +%package even warns you if you try to load two contradicting fonts at once, +%e.~g. two roman fonts. If you use the option \texttt{onlyps}, it substitutes +%the default PS fonts for the families you have not specified. +% +%The package is intended as a replacement for the \textsf{psfonts} package of +%\psNFSS, by Sebastian Rahtz +%(\texttt{s.rahtz@elsevier.co.uk}). \textsf{psfonts} is not very consequent, +%because some of its style files redefine all three defaults, while +%others only change one. +% +%\section{The \texttt{docstrip} modules} +% +%This file contains five 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\\ +%Upsy & A font definition file for Adobe Symbol, from \psNFSS\\ +%Upzd & A font definition file for Adobe Zapf Dingbats, from \psNFSS\\ +%\end{tabular} +% +%\StopEventually +% +%\section{Producing the documentation} +% +%This short driver can be extracted by \texttt{docstrip} to produce the +%documentation. +% +% \begin{macrocode} +%<*driver> +\documentclass{ltxdoc} + +\newcommand{\NFSS}{\textsf{NFSS}} +\newcommand{\psNFSS}{\textsf{psNFSS}} +\newcommand{\psfont}{\texttt{psfont}} + +\begin{document} + +\DocInput{psfont.dtx} + +\end{document} +%</driver> +% \end{macrocode} +% +%\section{The Code} +% +%\subsection{Introduction} +% +%First we have to introduce ourselves. +% +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{psfont}% + [\filedate\space v\fileversion\space loading PostScript 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{The default fonts} +% +%\DescribeMacro{\DefaultRMFont} +%\DescribeMacro{\DefaultSFFont} +%\DescribeMacro{\DefaultTTFont} +%These are some commands for changing the default fonts. +% +%\noindent\cmd{\DefaultRMFont}\marg{\NFSS\ font family}\\ +%\cmd{\DefaultSFFont}\marg{\NFSS\ font family}\\ +%\cmd{\DefaultTTFont}\marg{\NFSS\ font family} +% +% \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} +% +%\subsection{Declaring the options} +% +%\DescribeMacro{\AvailableRMFont} +%\DescribeMacro{\AvailableRMFont} +%\DescribeMacro{\AvailableRMFont} +%These commands are needed later in the configuration +%file. There is one command for each font family, ie.\ roman, sans serif or +%typewriter. +% +% \noindent +% \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} +% +%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 approriate 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. I do not need this now, but this hook could be useful +%later. +% +% \begin{macrocode} +\newcommand{\AvailableRMFont}[3][]{% + \DeclareOption{#2}{% + \ifrm@set\PackageError{psfont}{% + \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{psfont}{% + \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{psfont}{% + \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} +% +%\subsection{One command fits all} +% +%\DescribeMacro{\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. (I'm told Lucida is one of those.) +% +% \begin{macrocode} +\newcommand{\AvailableFont}[5][]{% + \DeclareOption{#2}{% + \ifrm@set\PackageError{psfont}{% + \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 + \ifsf@set\PackageError{psfont}{% + \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 + \iftt@set\PackageError{psfont}{% + \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 + #1 + } +} +% \end{macrocode} +% +%\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{psfont.cfg}{}{% + \PackageError{psfont}{% + No local configuration file found + }{% + The psfont 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{psfont.cfg} + [\filedate\space v\fileversion\space Local configuration for psfont.sty] +% \end{macrocode} +% +%\subsubsection{Declaring default fonts} +% +%Here, the default PS fonts are defined. They are needed later, if the author +%does not define all PS fonts he wants to use, but wants his document to +%contain only PS fonts. +% +% \begin{macrocode} +\DefaultRMFont{ptm} +\DefaultSFFont{phv} +\DefaultTTFont{pcr} +% \end{macrocode} +% +%\subsubsection{Available fonts} +% +%Now the available PS 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 \cmd{\Available}\ldots\ 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} +%</config> +% \end{macrocode} +% +% 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} +% +%\DescribeEnv{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, it reports a +%warning and does nothing. +% +% \begin{macrocode} +%<*package> +\DeclareOption{onlyps}{ + \ifrm@set\else + \ifx\empty\def@rmfont + \PackageWarning{psfont}{No default roman font defined!} + \else\renewcommand{\rmdefault}{\def@rmfont}\fi + \fi + \ifsf@set\else + \ifx\empty\def@sffont + \PackageWarning{psfont}{No default sans serif font defined!} + \else\renewcommand{\sfdefault}{\def@sffont}\fi + \fi + \iftt@set\else + \ifx\empty\def@ttfont + \PackageWarning{psfont}{No default typewriter font defined!} + \else\renewcommand{\ttdefault}{\def@ttfont}\fi + \fi + } +% \end{macrocode} +% +%\subsection{Parts of \textsf{psfonts}} +% +%\textit{The \psfont\ package ist ultimately intended as a replacement for +%\textsf{psfonts} of \psNFSS. I therefore use the code of some files of +%\textsf{psfonts} and wrap it up in an option. All code and comments of this +%section are from \textsf{psfonts}, v5.2 by Sebastian Rahtz. Many thanks to +%Sebastian for letting me use his code!} +% +%\DescribeEnv{pifont} +% \begin{macrocode} +\DeclareOption{pifont}{ +% \end{macrocode} +% Now some useful commands for Pi fonts (Dingbats, Symbol etc); they +% all assume you know the character number of the (unmapped) font +% \begin{macrocode} +\newcommand{\Pifont}[1]{\fontfamily{#1}\fontencoding{U}% +\fontseries{m}\fontshape{n}\selectfont} +\newcommand{\Pisymbol}[2]{{\Pifont{#1}\char#2}} +\newcommand{\Pifill}[2]{\leaders\hbox{\makebox[0.2in]{% + \Pisymbol{#1}{#2}}}\hfill\kern\z@} +\newcommand{\Piline}[2]{\par\noindent\hspace{0.5in}\Pifill{#1}{#2}% + \hspace{0.5in}\kern\z@\par} +\newenvironment{Pilist}[2]% +{\begin{list}{\Pisymbol{#1}{#2}}{}}% +{\end{list}}% +% \end{macrocode} +% A Pi number generator (from ideas by David Carlisle), for use in +% lists where items are suffixed by symbols taken in sequence from a +% Pi font. Usage is in lists just like enumerate. +% +% |\Pinumber| outputs the appropriate symbol, where |#2| is the name of a +% \LaTeX\ counter and |#1| is the font family. +% \begin{macrocode} +\def\Pinumber#1#2{\protect\Pisymbol{#1}{\arabic{#2}}} +\newenvironment{Piautolist}[2]{% +\ifnum \@enumdepth >3 \@toodeep\else + \advance\@enumdepth \@ne +% \end{macrocode} +% We force the labels and cross-references into a very plain style (eg +% no brackets around `numbers', or dots after them). +% \begin{macrocode} + \edef\@enumctr{enum\romannumeral\the\@enumdepth}% + \expandafter\def\csname p@enum\romannumeral\the\@enumdepth\endcsname{}% + \expandafter\def\csname labelenum\romannumeral\the\@enumdepth\endcsname{% + \csname theenum\romannumeral\the\@enumdepth\endcsname}% + \expandafter\def\csname theenum\romannumeral\the\@enumdepth\endcsname{% + \Pinumber{#1}{enum\romannumeral\the\@enumdepth}}% + \list{\csname label\@enumctr\endcsname}{% + \@nmbrlisttrue + \def\@listctr{\@enumctr}% + \setcounter{\@enumctr}{#2}% + \addtocounter{\@enumctr}{-1}% + \def\makelabel##1{\hss\llap{##1}}} +\fi +}{\endlist} +% \end{macrocode} +% All the old Dingbat commands still work. +% \begin{macrocode} +\newcommand{\ding}{\Pisymbol{pzd}} +\def\dingfill#1{\leaders\hbox{\makebox[0.2in]{\Pisymbol{pzd}{#1}}}\hfill} +\def\dingline#1{\Piline{pzd}{#1}} +\newenvironment{dinglist}[1]{\begin{Pilist}{pzd}{#1}}% + {\end{Pilist}} +\newenvironment{dingautolist}[1]{\begin{Piautolist}{pzd}{#1}}% + {\end{Piautolist}} +{\Pifont{pzd}} +{\Pifont{psy}} +} +% \end{macrocode} +%\DescribeEnv{mathptm} +% \begin{macrocode} +\DeclareOption{mathptm}{ +% \end{macrocode} +%This package loads the Adobe Times fonts and the mathptm fonts; +%The virtual fonts are produced by fontinst; they +%can be built by running tex on +%fontptcm.tex from the fontinst package. +% \begin{macrocode} +% The main text family is Times Roman +\def\rmdefault{ptm} +\DeclareSymbolFont{operators} {OT1}{ptmcm}{m}{n} +\DeclareSymbolFont{letters} {OML}{ptmcm}{m}{it} +\DeclareSymbolFont{symbols} {OMS}{pzccm}{m}{n} +\DeclareSymbolFont{largesymbols}{OMX}{psycm}{m}{n} +\DeclareSymbolFont{bold} {OT1}{ptm}{bx}{n} +\DeclareSymbolFont{italic} {OT1}{ptm}{m}{it} +% \end{macrocode} +% If we're in compatibility mode, defined |\mathbf| and |\mathit|. +% \begin{macrocode} +\@ifundefined{mathbf}{}{\DeclareMathAlphabet{\mathbf}{OT1}{ptm}{bx}{n}} +\@ifundefined{mathit}{}{\DeclareMathAlphabet{\mathit}{OT1}{ptm}{m}{it}} +% \end{macrocode} +% An |\omicron| command, to fill the gap. +% \begin{macrocode} +\DeclareMathSymbol{\omicron}{0}{operators}{`\o} +% \end{macrocode} +% Reduce the space around math operators +% \begin{macrocode} +\thinmuskip=2mu +\medmuskip=2.5mu plus 1mu minus 1mu +\thickmuskip=4mu plus 1.5mu minus 1mu +% \end{macrocode} +% No bold math. +% \begin{macrocode} +\def\boldmath{% + \@warning{there is no bold Symbol font}% + \global\let\boldmath=\relax +} +\DeclareMathSizes{5}{5}{5}{5} +\DeclareMathSizes{6}{6}{5}{5} +\DeclareMathSizes{7}{7}{5}{5} +\DeclareMathSizes{8}{8}{6}{5} +\DeclareMathSizes{9}{9}{7}{5} +\DeclareMathSizes{10}{10}{7.4}{6} +\DeclareMathSizes{10.95}{10.95}{8}{6} +\DeclareMathSizes{12}{12}{9}{7} +\DeclareMathSizes{14.4}{14.4}{10.95}{8} +\DeclareMathSizes{17.28}{17.28}{12}{10} +\DeclareMathSizes{20.74}{20.74}{14.4}{12} +\DeclareMathSizes{24.88}{24.88}{17.28}{14.4} +} +% \end{macrocode} +% +%\subsection{The end} +% +%At last, the options are processed. +% +% \begin{macrocode} +\ProcessOptions +%</package> +% \end{macrocode} +% +%\section{Additional font definitions from \textsf{psfonts}} +% +%\textit{This is again code from \textsf{psfonts} by Sebastian Rahtz. It +%contains some font definitions for Adobe Symbol and Adobe Zapf Dingbats.} +% +% \subsection{Adobe Symbol font} +% \begin{macrocode} +%<*Upsy> +\typeout{File \space Upsy.fd\space loading \space Adobe\space Symbol}% +\DeclareFontFamily{U}{psy}{}% +\DeclareFontShape{U}{psy}{m}{n}{<->psyr}{}% +\DeclareFontShape{U}{psy}{m}{i}{<->ssub * psy/m/n}{}% +%</Upsy> +% \end{macrocode} +% \subsection{Adobe Zapf Dingbats} +% \begin{macrocode} +%<*Upzd> +\typeout{File \space Upzd.fd\space loading \space Adobe\space ZapfDingbats}% +\DeclareFontFamily{U}{pzd}{}% +\DeclareFontShape{U}{pzd}{m}{n}{<->pzdr}{}% +%</Upzd> +% \end{macrocode} +% +%\Finale +% +%\section{ToDo} +% +%There is mainly one things that this package is missing till now: +% +%\begin{itemize} +%\item If the package has been loaded without any local options, it should act +%as if the option \texttt{onlyps} had been called. I unfortunately do not know +%how to detect this. +%\end{itemize} +% +%\section{Legal rubbish} +%\psfont: A \LaTeXe\ package for using PostScript 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. +% +\endinput |