\RequirePackages
in here
and thus define a flag: @usecolor is true whenever the grey option is specified
CODE
\newif\if@usecolor\@usecolortrue
\DeclareOption{grey}{\@usecolortrue}
\DeclareOption{nogrey}{\@usecolorfalse}
For the fonts, there follows a bunch of options that are all meant to be specified exclusively. It would have been possible to use
\newcommand
to ensure this, but it
gives cryptic errors. Rather check this first.
CODE
\newcommand*{\@newfontcmd}{\@ifundefined{@defaultcnfont}{\newcommand*}{%
\PackageWarning{quotchap}{%
You have tried to specify more than one font to be\MessageBreak
used for the chapter numbers. I ignore the font\MessageBreak
‘\CurrentOption’}
\providecommand*}}
Next is defining the font options. We set
\@defaultcnfont
according to Karl
Berry’s font name scheme. Providing more than one font gives an error (due to
defining an already defined command); the options exclude each other.
CODE
\DeclareOption{avantgarde}{\@newfontcmd{\@defaultcnfont}{pag}}
\DeclareOption{beramono}{\@newfontcmd{\@defaultcnfont}{fvm}}
\DeclareOption{berasans}{\@newfontcmd{\@defaultcnfont}{fvs}}
\DeclareOption{beraserif}{\@newfontcmd{\@defaultcnfont}{fve}}
\DeclareOption{biolinum}{\@newfontcmd{\@defaultcnfont}{LinuxBiolinumO-LF}}
\DeclareOption{bookman}{\@newfontcmd{\@defaultcnfont}{pbk}}
\DeclareOption{charter}{\@newfontcmd{\@defaultcnfont}{bch}}
\DeclareOption{courier}{\@newfontcmd{\@defaultcnfont}{pcr}}
\DeclareOption{helvetica}{\@newfontcmd{\@defaultcnfont}{phv}}
\DeclareOption{kpfonts}{\@newfontcmd{\@defaultcnfont}{jkp}}
\DeclareOption{libertine}{\@newfontcmd{\@defaultcnfont}{LinuxLibertineO-LF}}
\DeclareOption{lmodern}{\@newfontcmd{\@defaultcnfont}{lmr}}
\DeclareOption{newcentury}{\@newfontcmd{\@defaultcnfont}{pnc}}
\DeclareOption{palatino}{\@newfontcmd{\@defaultcnfont}{ppl}}
\DeclareOption{times}{\@newfontcmd{\@defaultcnfont}{ptm}}
\DeclareOption{utopia}{\@newfontcmd{\@defaultcnfont}{put}}
We can now let the options be processed. If no postscript font has been specified, the default is Adobe’s Bookman.
CODE
\ProcessOptions\relax
\providecommand*{\@defaultcnfont}{pbk}
If nobody said nogrey, we fetch the
color
package and define our colour.
If the color package is not included until now, we define \color
to do nothing
but gobble up its argument. An error is issued when grey is turned on and the
color package is nonexistent. When you read the documentation because of this:
color.sty
is included in the graphics bundle to be found at ctan.
CODE
Turn off the ‘grey’ option and come back again}{%
Since you did not say ‘nogrey’, quotchap defined chapter
numbers to appear\MessageBreak grey. You do not need a color
printer, since most printing devices can cope\MessageBreak with
grey scales
\if@usecolor
\IfFileExists{color.sty}{%
\RequirePackage{color}
\definecolor{chaptergrey}{rgb}{0.6,0.6,0.6}}{%
\PackageError{quotchap}{%
The color package is apparently unavailable.\MessageBreakTurn off the ‘grey’ option and come back again}{%
Since you did not say ‘nogrey’, quotchap defined chapter
numbers to appear\MessageBreak grey. You do not need a color
printer, since most printing devices can cope\MessageBreak with
grey scales
\else
\providecommand*{\color}[1]{}
\fi
Now we are ready to give the final font declarations. The commands
\sectfont
and \chapterhead{start|end}vskip
are defined in the KOMA-Script
classes the
chapter is based on, they are provided in case quotchap is used with other,
e.g. the default classes. If we are building a report, there is no \frontmatter
,
\mainmatter
and \backmatter
resp. everything is \mainmatter
, thus we have to
provide the corresponding switch used in the \chapter
command.
CODE
\AtEndOfPackage{%
\newcommand*{\chapnumfont}{%
\usefont{T1}{\@defaultcnfont}{b}{n}\fontsize{100}{130}\selectfont%
\color{chaptergrey}}
\let\size@chapter\huge
\providecommand*{\chapterheadstartvskip}{\vspace*{2.3\baselineskip}}
\providecommand*{\chapterheadendvskip}{\vspace{1.7\baselineskip}}
\providecommand*{\sectfont}{\relax}
\@ifundefined{@mainmattertrue}{\newif\if@mainmatter\@mainmattertrue}{}}