Debian Codegraph @

texmf-dist/source/latex/altfont/psfont.dtx

raw
1 \def\fileversion{1.1}
2 \def\filedate{1996/06/30}
3 %\iffalse meta-comment
4 %\psfont: A \LaTeXe\ package for using PostScript fonts
5 %
6 %Copyright \copyright\ 1996 Sebastian Marius Kirsch\texttt{%
7 % $\langle$sebastian\[email protected]$\rangle$}
8 %
9 %This program is free software; you can redistribute it and/or modify
10 %it under the terms of the GNU General Public License as published by
11 %the Free Software Foundation; either version 2 of the License, or
12 %(at your option) any later version.
13 %
14 %This program is distributed in the hope that it will be useful,
15 %but WITHOUT ANY WARRANTY; without even the implied warranty of
16 %MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 %GNU General Public License for more details.
18 %
19 %You should have received a copy of the GNU General Public License
20 %along with this program; if not, write to the Free Software
21 %Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 %\fi
23 %
24 %\changes{0.9}{1996/05/18}{First version using \texttt{doc} and
25 % \texttt{docstrip}}
26 %\changes{1.0}{1996/05/31}{First public release}
27 %\changes{1.0a}{1996/06/27}{Renamed to psfont. Updating documentation.}
28 %\changes{1.0b}{1996/06/28}{Optional argument for \cmd{\Available}\ldots}
29 %\changes{1.0c}{1996/06/29}{Inserted some code from psnfss. Some very
30 %enlightning thoughts about the future of this package.}
31 %\changes{1.0d}{1996/06/29}{New command \texttt{AvailableFont}. Why split this
32 %up between \psNFSS\ and \textsf{mf}\NFSS?}
33 %\changes{1.0e}{1996/06/30}{New syntax for \texttt{Default}\ldots\texttt{Font}}
34 %\changes{1.1}{1996/06/30}{Second public release}
35 %
36 % \CheckSum{364}
37 %% \CharacterTable
38 %% {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
39 %% 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
40 %% Digits \0\1\2\3\4\5\6\7\8\9
41 %% Exclamation \! Double quote \" Hash (number) \#
42 %% Dollar \$ Percent \% Ampersand \&
43 %% Acute accent \' Left paren \( Right paren \)
44 %% Asterisk \* Plus \+ Comma \,
45 %% Minus \- Point \. Solidus \/
46 %% Colon \: Semicolon \; Less than \<
47 %% Equals \= Greater than \> Question mark \?
48 %% Commercial at \@ Left bracket \[ Backslash \\
49 %% Right bracket \] Circumflex \^ Underscore \_
50 %% Grave accent \` Left brace \{ Vertical bar \|
51 %% Right brace \} Tilde \~}
52 %%
53 %
54 %\title{\psfont: A general way to use\\
55 % PostScript fonts\thanks{This file has version number \fileversion, last
56 % revised \filedate.}}
57 %
58 %\author{Sebastian Marius Kirsch\\
59 % \texttt{sebastian\[email protected]}}
60 %
61 %\date{\filedate}
62 %
63 %\maketitle
64 %
65 %\begin{abstract}
66 % This package provides a general way to use PostScript fonts
67 % without handling with thousands of style files, one for each font you want
68 % to use. It works with a style file, \texttt{psfont.sty}, which contains all
69 % the macros, and a configuration file, \texttt{psfont.cfg}, which tells the
70 % style file about the available fonts.
71 %\end{abstract}
72 %
73 %\section{Introduction}
74 %
75 %This package lets you use one single package to load every PostScript font you
76 %would want. You don't have to load one file for each font anymore, and the
77 %package even warns you if you try to load two contradicting fonts at once,
78 %e.~g. two roman fonts. If you use the option \texttt{onlyps}, it substitutes
79 %the default PS fonts for the families you have not specified.
80 %
81 %The package is intended as a replacement for the \textsf{psfonts} package of
82 %\psNFSS, by Sebastian Rahtz
83 %(\texttt{[email protected]}). \textsf{psfonts} is not very consequent,
84 %because some of its style files redefine all three defaults, while
85 %others only change one.
86 %
87 %\section{The \texttt{docstrip} modules}
88 %
89 %This file contains five modules to direct \texttt{docstrip} in generating the
90 %external files:
91 %
92 %\begin{tabular}[t]{ll}
93 %driver & A short driver for producing the documentation\\
94 %package & The package itself\\
95 %config & The local configuration file\\
96 %Upsy & A font definition file for Adobe Symbol, from \psNFSS\\
97 %Upzd & A font definition file for Adobe Zapf Dingbats, from \psNFSS\\
98 %\end{tabular}
99 %
100 %\StopEventually
101 %
102 %\section{Producing the documentation}
103 %
104 %This short driver can be extracted by \texttt{docstrip} to produce the
105 %documentation.
106 %
107 % \begin{macrocode}
108 %<*driver>
109 \documentclass{ltxdoc}
110
111 \newcommand{\NFSS}{\textsf{NFSS}}
112 \newcommand{\psNFSS}{\textsf{psNFSS}}
113 \newcommand{\psfont}{\texttt{psfont}}
114
115 \begin{document}
116
117 \DocInput{psfont.dtx}
118
119 \end{document}
120 %</driver>
121 % \end{macrocode}
122 %
123 %\section{The Code}
124 %
125 %\subsection{Introduction}
126 %
127 %First we have to introduce ourselves.
128 %
129 % \begin{macrocode}
130 %<*package>
131 \NeedsTeXFormat{LaTeX2e}
132 \ProvidesPackage{psfont}%
133 [\filedate\space v\fileversion\space loading PostScript fonts]
134 % \end{macrocode}
135 %
136 %\subsection{Switches}
137 %
138 %Next, we define some switches. They are used to determine whether some fonts
139 %have already been loaded, so we can warn the user when he tries to load two
140 %colliding fonts.
141 %
142 % \begin{macrocode}
143 \newif\ifrm@set\rm@setfalse
144 \newif\ifsf@set\sf@setfalse
145 \newif\iftt@set\tt@setfalse
146 % \end{macrocode}
147 %
148 %\subsection{The default fonts}
149 %
150 %\DescribeMacro{\DefaultRMFont}
151 %\DescribeMacro{\DefaultSFFont}
152 %\DescribeMacro{\DefaultTTFont}
153 %These are some commands for changing the default fonts.
154 %
155 %\noindent\cmd{\DefaultRMFont}\marg{\NFSS\ font family}\\
156 %\cmd{\DefaultSFFont}\marg{\NFSS\ font family}\\
157 %\cmd{\DefaultTTFont}\marg{\NFSS\ font family}
158 %
159 % \begin{macrocode}
160 \newcommand{\DefaultRMFont}[1]{\renewcommand{\def@rmfont}{#1}}
161 \newcommand{\DefaultSFFont}[1]{\renewcommand{\def@sffont}{#1}}
162 \newcommand{\DefaultTTFont}[1]{\renewcommand{\def@ttfont}{#1}}
163 \newcommand{\def@rmfont}{}
164 \newcommand{\def@sffont}{}
165 \newcommand{\def@ttfont}{}
166 % \end{macrocode}
167 %
168 %\subsection{Declaring the options}
169 %
170 %\DescribeMacro{\AvailableRMFont}
171 %\DescribeMacro{\AvailableRMFont}
172 %\DescribeMacro{\AvailableRMFont}
173 %These commands are needed later in the configuration
174 %file. There is one command for each font family, ie.\ roman, sans serif or
175 %typewriter.
176 %
177 % \noindent
178 % \cmd{\AvailableRMFont}\oarg{additional code}\marg{long name}\marg{\NFSS\
179 % family name}\\
180 % \cmd{\AvailableSFFont}\oarg{additional code}\marg{long name}\marg{\NFSS\
181 % family name}\\
182 % \cmd{\AvailableTTFont}\oarg{additional code}\marg{long name}\marg{\NFSS\
183 % family name}
184 %
185 %They declare their first argument as an option.
186 %
187 %If the option is called, and the font family has already been defined, a
188 %\cmd{\PackageError} is reported. If not, the second argument is defined as
189 %the approriate family default.
190 %
191 %When the family default has successfully been set, the approriate switch is
192 %turned, so it is not redefined anywhere else in this file.
193 %
194 %The optional argument contains some code that is to be executed when the
195 %defaults have been set. I do not need this now, but this hook could be useful
196 %later.
197 %
198 % \begin{macrocode}
199 \newcommand{\AvailableRMFont}[3][]{%
200 \DeclareOption{#2}{%
201 \ifrm@set\PackageError{psfont}{%
202 \protect\rmfamily\space already defined as \rmdefault
203 }{%
204 You tried to load two roman families at the same time,\MessageBreak
205 e.g. times and palatino}
206 \else\renewcommand{\rmdefault}{#3}\rm@settrue
207 #1
208 \fi}
209 }
210
211 \newcommand{\AvailableSFFont}[3][]{%
212 \DeclareOption{#2}{%
213 \ifsf@set\PackageError{psfont}{%
214 \protect\sffamily\space already defined as \sfdefault
215 }{%
216 You tried to load two sans serif families at the same time,\MessageBreak
217 e.g. gill and helvetica}
218 \else\renewcommand{\sfdefault}{#3}\sf@settrue
219 #1
220 \fi}
221 }
222
223 \newcommand{\AvailableTTFont}[3][]{%
224 \DeclareOption{#2}{%
225 \iftt@set\PackageError{psfont}{%
226 \protect\ttfamily\space already defined as \ttdefault
227 }{%
228 You tried to load two typewriter families at the same time,\MessageBreak
229 e.g. courier and typewriter}
230 \else\renewcommand{\ttdefault}{#3}\tt@settrue
231 #1
232 \fi}
233 }
234 % \end{macrocode}
235 %
236 %\subsection{One command fits all}
237 %
238 %\DescribeMacro{\AvailableFont}
239 %With the macro |\AvailableFont|, all three defaults are set with one
240 %option. This is useful for managing combinations of three fonts under one
241 %name, as well as for fonts that have the variants sans serif and
242 %typewriter. (I'm told Lucida is one of those.)
243 %
244 % \begin{macrocode}
245 \newcommand{\AvailableFont}[5][]{%
246 \DeclareOption{#2}{%
247 \ifrm@set\PackageError{psfont}{%
248 \protect\rmfamily\space already defined as \rmdefault
249 }{%
250 You tried to load two roman families at the same time,\MessageBreak
251 e.g. times and palatino}
252 \else\renewcommand{\rmdefault}{#3}\rm@settrue
253 \fi
254 \ifsf@set\PackageError{psfont}{%
255 \protect\sffamily\space already defined as \sfdefault
256 }{%
257 You tried to load two sans serif families at the same time,\MessageBreak
258 e.g. gill and helvetica}
259 \else\renewcommand{\sfdefault}{#4}\sf@settrue
260 \fi
261 \iftt@set\PackageError{psfont}{%
262 \protect\ttfamily\space already defined as \ttdefault
263 }{%
264 You tried to load two typewriter families at the same time,\MessageBreak
265 e.g. courier and typewriter}
266 \else\renewcommand{\ttdefault}{#5}\tt@settrue
267 \fi
268 #1
269 }
270 }
271 % \end{macrocode}
272 %
273 %\subsection{Loading the configuration file}
274 %
275 %Next, the configuration file is loaded. If it is not found, an error is
276 %issued, because the package is quite useless without it.
277 %
278 % \begin{macrocode}
279 \InputIfFileExists{psfont.cfg}{}{%
280 \PackageError{psfont}{%
281 No local configuration file found
282 }{%
283 The psfont package was loaded without a local\MessageBreak
284 configuration file, so it doesn't know which fonts\MessageBreak
285 are available.}
286 }
287 %</package>
288 % \end{macrocode}
289 %
290 %\subsection{The configuration file}
291 %
292 %The configuration file looks like this:
293 %
294 %\subsubsection{Introduction}
295 %
296 %As usual\ldots
297 %
298 % \begin{macrocode}
299 %<*config>
300 \NeedsTeXFormat{LaTeX2e}
301 \ProvidesFile{psfont.cfg}
302 [\filedate\space v\fileversion\space Local configuration for psfont.sty]
303 % \end{macrocode}
304 %
305 %\subsubsection{Declaring default fonts}
306 %
307 %Here, the default PS fonts are defined. They are needed later, if the author
308 %does not define all PS fonts he wants to use, but wants his document to
309 %contain only PS fonts.
310 %
311 % \begin{macrocode}
312 \DefaultRMFont{ptm}
313 \DefaultSFFont{phv}
314 \DefaultTTFont{pcr}
315 % \end{macrocode}
316 %
317 %\subsubsection{Available fonts}
318 %
319 %Now the available PS fonts are defined. They are divided into three
320 %categories, roman fonts, sans serif fonts and typewriter fonts, as it is done
321 %in \LaTeXe\ itself.
322 %
323 %They are defined using the \cmd{\Available}\ldots\ macros. These macros
324 %define a symbolic name to be used as an option to the package, and take the
325 %name of the \NFSS\ font family as a second argument.
326 %
327 % \begin{macrocode}
328 \AvailableRMFont{times}{ptm}
329 \AvailableRMFont{palatino}{ppl}
330 \AvailableRMFont{newcent}{pnc}
331
332 \AvailableSFFont{helv}{phv}
333 \AvailableSFFont{gill}{pgs}
334
335 \AvailableTTFont{courier}{pcr}
336 %</config>
337 % \end{macrocode}
338 %
339 % And that's the configuration. Of course one could do much more with this
340 % configuration file, declaring new options and all. It's probably the biggest
341 % hook a package could have. :-)
342 %
343 %\subsection{\texttt{onlyps}: Using only PS fonts}
344 %
345 %\DescribeEnv{onlyps}
346 %This option redefines all other family defaults that have not yet been
347 %\cmd{\renewcommand}ed to PS fonts. It uses the default fonts as defined in
348 %the configuration file. If no default fonts have been defined, it reports a
349 %warning and does nothing.
350 %
351 % \begin{macrocode}
352 %<*package>
353 \DeclareOption{onlyps}{
354 \ifrm@set\else
355 \ifx\empty\def@rmfont
356 \PackageWarning{psfont}{No default roman font defined!}
357 \else\renewcommand{\rmdefault}{\def@rmfont}\fi
358 \fi
359 \ifsf@set\else
360 \ifx\empty\def@sffont
361 \PackageWarning{psfont}{No default sans serif font defined!}
362 \else\renewcommand{\sfdefault}{\def@sffont}\fi
363 \fi
364 \iftt@set\else
365 \ifx\empty\def@ttfont
366 \PackageWarning{psfont}{No default typewriter font defined!}
367 \else\renewcommand{\ttdefault}{\def@ttfont}\fi
368 \fi
369 }
370 % \end{macrocode}
371 %
372 %\subsection{Parts of \textsf{psfonts}}
373 %
374 %\textit{The \psfont\ package ist ultimately intended as a replacement for
375 %\textsf{psfonts} of \psNFSS. I therefore use the code of some files of
376 %\textsf{psfonts} and wrap it up in an option. All code and comments of this
377 %section are from \textsf{psfonts}, v5.2 by Sebastian Rahtz. Many thanks to
378 %Sebastian for letting me use his code!}
379 %
380 %\DescribeEnv{pifont}
381 % \begin{macrocode}
382 \DeclareOption{pifont}{
383 % \end{macrocode}
384 % Now some useful commands for Pi fonts (Dingbats, Symbol etc); they
385 % all assume you know the character number of the (unmapped) font
386 % \begin{macrocode}
387 \newcommand{\Pifont}[1]{\fontfamily{#1}\fontencoding{U}%
388 \fontseries{m}\fontshape{n}\selectfont}
389 \newcommand{\Pisymbol}[2]{{\Pifont{#1}\char#2}}
390 \newcommand{\Pifill}[2]{\leaders\hbox{\makebox[0.2in]{%
391 \Pisymbol{#1}{#2}}}\hfill\kern\z@}
392 \newcommand{\Piline}[2]{\par\noindent\hspace{0.5in}\Pifill{#1}{#2}%
393 \hspace{0.5in}\kern\z@\par}
394 \newenvironment{Pilist}[2]%
395 {\begin{list}{\Pisymbol{#1}{#2}}{}}%
396 {\end{list}}%
397 % \end{macrocode}
398 % A Pi number generator (from ideas by David Carlisle), for use in
399 % lists where items are suffixed by symbols taken in sequence from a
400 % Pi font. Usage is in lists just like enumerate.
401 %
402 % |\Pinumber| outputs the appropriate symbol, where |#2| is the name of a
403 % \LaTeX\ counter and |#1| is the font family.
404 % \begin{macrocode}
405 \def\Pinumber#1#2{\protect\Pisymbol{#1}{\arabic{#2}}}
406 \newenvironment{Piautolist}[2]{%
407 \ifnum \@enumdepth >3 \@toodeep\else
408 \advance\@enumdepth \@ne
409 % \end{macrocode}
410 % We force the labels and cross-references into a very plain style (eg
411 % no brackets around `numbers', or dots after them).
412 % \begin{macrocode}
413 \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
414 \expandafter\def\csname p@enum\romannumeral\the\@enumdepth\endcsname{}%
415 \expandafter\def\csname labelenum\romannumeral\the\@enumdepth\endcsname{%
416 \csname theenum\romannumeral\the\@enumdepth\endcsname}%
417 \expandafter\def\csname theenum\romannumeral\the\@enumdepth\endcsname{%
418 \Pinumber{#1}{enum\romannumeral\the\@enumdepth}}%
419 \list{\csname label\@enumctr\endcsname}{%
420 \@nmbrlisttrue
421 \def\@listctr{\@enumctr}%
422 \setcounter{\@enumctr}{#2}%
423 \addtocounter{\@enumctr}{-1}%
424 \def\makelabel##1{\hss\llap{##1}}}
425 \fi
426 }{\endlist}
427 % \end{macrocode}
428 % All the old Dingbat commands still work.
429 % \begin{macrocode}
430 \newcommand{\ding}{\Pisymbol{pzd}}
431 \def\dingfill#1{\leaders\hbox{\makebox[0.2in]{\Pisymbol{pzd}{#1}}}\hfill}
432 \def\dingline#1{\Piline{pzd}{#1}}
433 \newenvironment{dinglist}[1]{\begin{Pilist}{pzd}{#1}}%
434 {\end{Pilist}}
435 \newenvironment{dingautolist}[1]{\begin{Piautolist}{pzd}{#1}}%
436 {\end{Piautolist}}
437 {\Pifont{pzd}}
438 {\Pifont{psy}}
439 }
440 % \end{macrocode}
441 %\DescribeEnv{mathptm}
442 % \begin{macrocode}
443 \DeclareOption{mathptm}{
444 % \end{macrocode}
445 %This package loads the Adobe Times fonts and the mathptm fonts;
446 %The virtual fonts are produced by fontinst; they
447 %can be built by running tex on
448 %fontptcm.tex from the fontinst package.
449 % \begin{macrocode}
450 % The main text family is Times Roman
451 \def\rmdefault{ptm}
452 \DeclareSymbolFont{operators} {OT1}{ptmcm}{m}{n}
453 \DeclareSymbolFont{letters} {OML}{ptmcm}{m}{it}
454 \DeclareSymbolFont{symbols} {OMS}{pzccm}{m}{n}
455 \DeclareSymbolFont{largesymbols}{OMX}{psycm}{m}{n}
456 \DeclareSymbolFont{bold} {OT1}{ptm}{bx}{n}
457 \DeclareSymbolFont{italic} {OT1}{ptm}{m}{it}
458 % \end{macrocode}
459 % If we're in compatibility mode, defined |\mathbf| and |\mathit|.
460 % \begin{macrocode}
461 \@ifundefined{mathbf}{}{\DeclareMathAlphabet{\mathbf}{OT1}{ptm}{bx}{n}}
462 \@ifundefined{mathit}{}{\DeclareMathAlphabet{\mathit}{OT1}{ptm}{m}{it}}
463 % \end{macrocode}
464 % An |\omicron| command, to fill the gap.
465 % \begin{macrocode}
466 \DeclareMathSymbol{\omicron}{0}{operators}{`\o}
467 % \end{macrocode}
468 % Reduce the space around math operators
469 % \begin{macrocode}
470 \thinmuskip=2mu
471 \medmuskip=2.5mu plus 1mu minus 1mu
472 \thickmuskip=4mu plus 1.5mu minus 1mu
473 % \end{macrocode}
474 % No bold math.
475 % \begin{macrocode}
476 \def\boldmath{%
477 \@warning{there is no bold Symbol font}%
478 \global\let\boldmath=\relax
479 }
480 \DeclareMathSizes{5}{5}{5}{5}
481 \DeclareMathSizes{6}{6}{5}{5}
482 \DeclareMathSizes{7}{7}{5}{5}
483 \DeclareMathSizes{8}{8}{6}{5}
484 \DeclareMathSizes{9}{9}{7}{5}
485 \DeclareMathSizes{10}{10}{7.4}{6}
486 \DeclareMathSizes{10.95}{10.95}{8}{6}
487 \DeclareMathSizes{12}{12}{9}{7}
488 \DeclareMathSizes{14.4}{14.4}{10.95}{8}
489 \DeclareMathSizes{17.28}{17.28}{12}{10}
490 \DeclareMathSizes{20.74}{20.74}{14.4}{12}
491 \DeclareMathSizes{24.88}{24.88}{17.28}{14.4}
492 }
493 % \end{macrocode}
494 %
495 %\subsection{The end}
496 %
497 %At last, the options are processed.
498 %
499 % \begin{macrocode}
500 \ProcessOptions
501 %</package>
502 % \end{macrocode}
503 %
504 %\section{Additional font definitions from \textsf{psfonts}}
505 %
506 %\textit{This is again code from \textsf{psfonts} by Sebastian Rahtz. It
507 %contains some font definitions for Adobe Symbol and Adobe Zapf Dingbats.}
508 %
509 % \subsection{Adobe Symbol font}
510 % \begin{macrocode}
511 %<*Upsy>
512 \typeout{File \space Upsy.fd\space loading \space Adobe\space Symbol}%
513 \DeclareFontFamily{U}{psy}{}%
514 \DeclareFontShape{U}{psy}{m}{n}{<->psyr}{}%
515 \DeclareFontShape{U}{psy}{m}{i}{<->ssub * psy/m/n}{}%
516 %</Upsy>
517 % \end{macrocode}
518 % \subsection{Adobe Zapf Dingbats}
519 % \begin{macrocode}
520 %<*Upzd>
521 \typeout{File \space Upzd.fd\space loading \space Adobe\space ZapfDingbats}%
522 \DeclareFontFamily{U}{pzd}{}%
523 \DeclareFontShape{U}{pzd}{m}{n}{<->pzdr}{}%
524 %</Upzd>
525 % \end{macrocode}
526 %
527 %\Finale
528 %
529 %\section{ToDo}
530 %
531 %There is mainly one things that this package is missing till now:
532 %
533 %\begin{itemize}
534 %\item If the package has been loaded without any local options, it should act
535 %as if the option \texttt{onlyps} had been called. I unfortunately do not know
536 %how to detect this.
537 %\end{itemize}
538 %
539 %\section{Legal rubbish}
540 %\psfont: A \LaTeXe\ package for using PostScript fonts
541 %
542 %Copyright \copyright\ 1996 Sebastian Marius Kirsch\texttt{%
543 % $\langle$sebastian\[email protected]$\rangle$}
544 %
545 %This program is free software; you can redistribute it and/or modify
546 %it under the terms of the GNU General Public License as published by
547 %the Free Software Foundation; either version 2 of the License, or
548 %(at your option) any later version.
549 %
550 %This program is distributed in the hope that it will be useful,
551 %but WITHOUT ANY WARRANTY; without even the implied warranty of
552 %MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
553 %GNU General Public License for more details.
554 %
555 %You should have received a copy of the GNU General Public License
556 %along with this program; if not, write to the Free Software
557 %Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
558 %
559 \endinput