%% psbook.cls %% %% a readable introductory/overview manual style %% modelled on the PostScript books %% %% based in part on a style file by Peter Ilieve %% Paul Davis <pbd@op.net> %% %% v1.0 pad 1987 %% v2.0 pad 28-dec-00 - created from manual/marginhead for latex2e %% \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesClass{psbook}[2000/12/28 v2.0 PostScript Book class] %% % ***************************************** % * SECTIONING * % ***************************************** % % \@startsection {NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE}{LEFTSKIP} % optional * [ALTHEADING]{HEADING} % Generic command to start a section. % NAME : e.g., 'subsection' % LEVEL : a number, denoting depth of section -- e.g., chapter=1, % section = 2, etc. % INDENT : Indentation of heading from left margin %% In AFTERSKIP = 0 case if INDENT is zero then set %% heading flush right in text margin, text is assumed to %% be short and will not be broken. %% If INDENT is non-zero then it is the width of a box %% containing the heading in the text margin, this text can %% be long. % BEFORESKIP : Absolute value = skip to leave above the heading. % If negative, then paragraph indent of text following % heading is suppressed. % AFTERSKIP : if positive, then skip to leave below heading, else % negative of skip to leave to right of run-in heading. %% if zero then Sun-style special controlled by INDENT. % STYLE : commands to set style % LEFTSKIP : Amount of \leftskip to use for this section. % If '*' missing, then increments the counter. If it is present, then % there should be no [ALTHEADING] argument. % Uses the counter 'secnumdepth' whose value is the highest section % level that is to be numbered. %% \let\aftersecthook=\relax %% \def\@startsection#1#2#3#4#5#6{\if@noskipsec \leavevmode \fi \par \@tempskipa #4\relax \@afterindenttrue \ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \@afterindentfalse\fi \if@nobreak \everypar{}\else \addpenalty{\@secpenalty}\addvspace{\@tempskipa}\fi \@ifstar {\@manssect{#3}{#4}{#5}{#6}}{\@dblarg{\@mansect{#1}{#2}{#3}{#4}{#5}{#6}}}} %% \def\@mansect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth \def\@svsec{}\else \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname\hskip 1em }\fi \@tempskipa #5\relax\@tempdima #3\relax \ifdim \@tempskipa>\z@ \begingroup #6\relax \@manhangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M #8\par} \endgroup \csname #1mark\endcsname {#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else \protect\numberline{\csname the#1\endcsname}% \fi #7}% \else \ifdim \@tempskipa=\z@ \ifdim \@tempdima=\z@ \def\@svsechd{#6\llap{#8\hskip \textmarginsep}% \csname #1mark\endcsname {#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else \protect\numberline{\csname the#1\endcsname}% \fi #7} }% \else \def\@svsechd{#6\@manmarginbox{#3}{\@svsec #8}% \csname #1mark\endcsname {#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else \protect\numberline{\csname the#1\endcsname}% \fi #7} }% \fi \else \def\@svsechd{#6\hskip #3\@svsec #8\csname #1mark\endcsname {#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else \protect\numberline{\csname the#1\endcsname}% \fi #7}% }% \fi \fi \aftersecthook \@manxsect{#5}} %% \def\@manxsect#1{\@tempskipa #1\relax \ifdim \@tempskipa>\z@ \par \nobreak \vskip \@tempskipa \@afterheading \else \global\@nobreakfalse \global\@noskipsectrue \ifdim \@tempskipa=\z@ \everypar{\if@noskipsec \global\@noskipsecfalse \clubpenalty\@M \hskip -\parindent \begingroup \@svsechd \endgroup \unskip \if@afterindent \hskip \parindent\fi \else \clubpenalty \@clubpenalty \everypar{}% \fi}% \else \everypar{\if@noskipsec \global\@noskipsecfalse \clubpenalty\@M \hskip -\parindent \begingroup \@svsechd \endgroup \unskip \hskip -#1 \else \clubpenalty \@clubpenalty \everypar{}% \fi}% \fi \fi\ignorespaces} %% \def\@manssect#1#2#3#4#5{\@tempskipa #3\relax\@tempdima #1\relax \ifdim \@tempskipa>\z@ \begingroup #4\@manhangfrom{\hskip #1}{\interlinepenalty \@M #5\par}% \endgroup \else \ifdim \@tempskipa=\z@ \ifdim \@tempdima=\z@ \def\@svsechd{#4\llap{#5\hskip \textmarginsep}}% \else \def\@svsechd{#4\@manmarginbox{#1}{#5}}% \fi \else \def\@svsechd{#4\hskip #1\relax #5}% \fi \fi \@manxsect{#3}} %% %% \@manhangfrom{TEXT} : Puts TEXT in a box, and makes a hanging indentation %% of the following material up to the first \par. Should be used %% in vertical mode. %% %% \def\@manhangfrom#1{\setbox\@tempboxa=\hbox{#1} \hangindent 1\wd\@tempboxa\noindent\box\@tempboxa} %% \@manmarginbox{WIDTH}{TEXT} : Sets TEXT in a box of width WIDTH and %% puts it in the left margin with a gap of \textmarginsep between %% it and the text. The baseline of the top line of TEXT is at the %% vertical position of the call of \@manmarginbox. %% %% %% if you don't want \section headings set flush ragged left, use %% \secleft %% %% \def\secleft{\def\@secleft{\relax}} %% \def\@manmarginbox#1#2{\setbox\@tempboxa=\vtop{\hsize #1% \@ifundefined{@secleft}% {\raggedleft #2}% {\raggedright #2}}% \dp\@tempboxa=\z@\llap{\box\@tempboxa\hskip \textmarginsep}} %% %% Sectioning commands. Note the addition of \part: this gives us the %% right number of levels for this type of headings layout. %% \def\partfont{\sf} \def\sectionfont{\bf} \def\ssectionfont{\rm} \def\sssectionfont{\it} \newdimen\secafterskip %% %%\def\part{\@startsection %%{part}{1}{\partindent} %%{4.25ex plus 1ex minus .2ex}{3ex plus 1ex minus .2ex}{\Large\partfont}} %% %%\def\chapter{\@manstartsection %%{chapter}{2}{\partindent} %%{4.25ex plus 1ex minus .2ex}{3ex plus 1ex minus .2ex}{\large\partfont}} %% \def\section{\@startsection {section}{1}{\textmargin} {-1.25ex plus -1ex minus -.2ex}{\z@}{\normalsize\sectionfont}} %% \def\subsection{\@startsection {subsection}{2}{\textmargin} {-3.25ex plus -1ex minus -.2ex}{\z@}{\normalsize\ssectionfont}} %% \def\subsubsection{\@startsection {subsubsection}{3}{\textmargin} {-2.25ex plus -1ex minus -.2ex}{\z@}{\normalsize\sssectionfont}} %% \def\paragraph{\@startsection {paragraph}{4}{\z@} {-3.25ex plus 1ex minus .2ex}{\z@}{\normalsize\bf}} %% \def\subparagraph{\@startsection {subparagraph}{5}{\parindent} {3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}} %% \setcounter{secnumdepth}{0} %% \def\thechapter{\arabic{chapter}} \def\thepart{\arabic{part}} %% %%\def\partmark#1{\markboth{}{}} \def\chaptermark#1{\markboth{#1}{}} %% %% Page dimensions %% \oddsidemargin -20pt \evensidemargin -20pt \newdimen\textmargin \newdimen\textmarginsep \newdimen\partindent \newdimen\partoffset \textmargin 5cm %% width of left margin for headings \textmarginsep 10pt %% gap between marginal headings and text \partoffset 13ex %% amount of right shift for \part headings \partindent = -\textmargin \advance\partindent by \partoffset %% %% Now a redefined \@makecaption to put tag in heading margin %% \long\def\@makecaption#1#2{% \@manmarginbox{\textmargin}{{\it #1:} #2}}% %% %% %% Now use the marginal headers stuff to define useful things %% \def\title#1{\def\thetitle{#1}% \noindent\makebox[\textwidth][r]% {\parbox{11cm}{\flushright\Huge\rm \thetitle}}\vskip 10ex} %% %% Now a few page layout parameters %% \textheight 640pt \topskip 0pt \topmargin 0pt \headheight 15pt \parindent 0pt \oddsidemargin -20pt \evensidemargin -20pt \parskip \baselineskip %% %% These originate in the marginhead style option %% \textmargin 5cm \textmarginsep 10pt \partoffset 13ex \partindent = -\textmargin \advance\partindent by \partoffset %% %% include a \def for \fig that looks good with this layout %% \def\fig#1#2{\begin{figure}[htbf] \begin{center} \caption{#2} \input{#1} \end{center} \end{figure}} %% %% page style `headings' settings. %% %% note that the headings include "Section" to indicate a %% sectional heading defined using \part. I know this is a bit %% inconsistent, but one needs a level above \section even though it %% doesn't really warrant being referred to as "Part such-and-such" in %% the header. A better solution is needed. %% \def\@revdate{\today} \def\revised#1{\def\@revdate{#1}} %% \if@twoside \def\ps@headings{% \def\@oddfoot{\hfil Revision of \@revdate}% \def\@evenfoot{\hfil Revision of \@revdate}% \def\@evenhead{\ifnum \thepage>1 \rm \thepage\hskip 2em \leftmark\hfil \fi}% \def\@oddhead{\ifnum \thepage>1 \hfil \leftmark \rm\hskip 2em\thepage \fi} \def\partmark##1{\markboth {\ifnum \c@secnumdepth >\z@ Part \thepart\ --- \fi ##1}{}}}% \else \def\ps@headings{\def\@oddfoot{\hfil Revision of \@revdate}% \def\@evenfoot{}% \def\@oddhead{\ifnum \thepage>1 \hfil \rightmark \rm\hskip 2em\thepage \fi}% \def\@evenhead{}% \def\partmark##1{\markright {\ifnum \c@secnumdepth >\z@ Part \thepart\ --- \fi ##1}}}% \fi %% %% new environments %% \def\example{\list{}{% \leftmargin 1cm \rightmargin \leftmargin \tt}\item[]} %% \let\endexample=\endlist %% %% now the modified outputpage routine which increases the width %% of the header and footer to cover the \textmargin, and included the SCR %% logo on the first page. %% \def\@outputpage{% \begingroup % the \endgroup is put in by \aftergroup \let \protect \noexpand \@resetactivechars \@parboxrestore \shipout \vbox{% \set@typeset@protect \aftergroup \endgroup \aftergroup \set@typeset@protect % correct? or just restore by ending % the group? \if@specialpage \global\@specialpagefalse\@nameuse{ps@\@specialstyle}% \fi \if@twoside \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot \let\@themargin\oddsidemargin \else \let\@thehead\@evenhead \let\@thefoot\@evenfoot \let\@themargin\evensidemargin \fi \fi \reset@font \normalsize \@tempdima \textmargin %% calculate total page width \advance\@tempdima \textmarginsep \advance\@tempdima \textwidth \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@ \@begindvi \vskip \topmargin \moveright\@themargin \vbox {% \setbox\@tempboxa \vbox to\headheight{% \vfil% \color@hbox \normalcolor \hbox to\@tempdima{ \let \label \@gobble \let \index \@gobble \let \glossary \@gobble %% 21 Jun 91 \strut\@thehead}% \color@endbox \ifnum \thepage=1 \color@hbox \normalcolor \hbox to\@tempdima{% %% this includes the logo on the first page of the document %% \special{voffset=-29.75 %% hscale=1.5 %% vscale=1.5 %% psfile="/usr/local/lib/tex/macros/SCRlogo.ps"}% \hfill\vrule height 0.4pt width \textwidth} \color@endbox \else \hrule \fi}% %%\dp\@tempboxa\z@ % as the head now has fixed depth anyway \box\@tempboxa \vskip \headsep \hbox to\@tempdima{\hss\box\@outputbox}%% move the body text over \baselineskip \footskip \color@hbox \normalcolor \hbox to \@tempdima{% \let \label \@gobble \let \index \@gobble %% 22 Feb 87 \let \glossary \@gobble %% 21 Jun 91 \@thefoot }% \color@endbox }% }% \global \@colht \textheight \stepcounter{page}% \let\firstmark\botmark } %% %% extra commands %% \def\command#1{{\tt #1}} \def\com#1#2{{\bf #1}\/(#2)}% \def\>{$>$\ignorespaces}% \def\<{$<$\ignorespaces}% \def\tilde{\~{}}% \def\bs{$\backslash$} \def\file#1{{\bi #1\/}} \def\prog#1{{\sf #1}} \def\pipe{{\tt |}} %% %% instigate headings %% \ps@headings %% \endinput