2 % $Id: sambadoc.cls,v 1.4 2003/12/11 19:30:50 jelmer Exp $
5 % phstyle.cls -- Macros for formatting Prentice-Hall Books
6 % -- Compiled by J.K. Shultis, Dec. 1993
7 % -- Modified and enhanced for LaTeX2e mdh/rlm 1997/02
8 % -- Style Modifications Lori Hughes June 2002
10 \NeedsTeXFormat{LaTeX2e
}%
11 \ProvidesClass{sambadoc
}[1997/
02/
20 Prentice Hall Book Class, February
1997]
13 \DeclareOption*
{\PassOptionsToClass{\CurrentOption}{report}}
17 % Base everything on the default class 'article'.
21 %================================================================================
22 % 1. Page layout dimensions
23 % 3. Define new fonts for headings
24 % 4. Define LaTeX logos (usually ot needed)
25 % 5. Redefines the way "figure" amd "table" are formated in a \caption
26 % 6. Defines a \capt macro which defines (1) \captwidth, (2) \captsize
27 % and \beforetableskip.
28 % 7. New Environemnts: Eqnarray, reflist, exerlist
29 % 8. Defines and modifies FANCYHDS.STY for headers and foots
30 % 9. Change sectioning headings to bold sans serif fonts
31 %10. Turn off leader dots in Table of Contents
32 %======================================================================
34 %====================== Page Layout
35 % \oddsidemargin 0.750in \evensidemargin 0.750in \textwidth 5.00in
36 % \topmargin 0.625in \headheight 0.3in \headsep 0.2in
37 % \textheight 7.3in %\footheight .2in
39 % \parskip 0ex \marginparwidth 1.00in \marginparsep 0.5in
40 %\setlength\arraycolsep{1pt}
44 %====================== Define special fonts
45 \newfont{\BIG}{cminch
} %--- One-inch font
46 \newfont{\sfbHuge}{cmssbx10 scaled
\magstep5} %-- 25pt sans serif bold
47 \newfont{\sfblarge}{cmssbx10 scaled
\magstep1} %-- 12pt sans serif bold
48 \newfont{\sfbeleven}{cmssbx10 scaled
\magstephalf} %-- 11pt sans serif bold
49 \newfont{\sfb}{cmssbx10
} %-- 10pt sans serif bold
50 \newfont{\sfeight}{cmss8
} %-- 8pt sans serif
51 \newfont{\sfnine}{cmss8 at
9pt
} %-- 9pt sans serif
53 \newfont{\defnem}{cmbxti10
} %-- 10pt sans serif bold
54 \def\spacingset#1{\def\baselinestretch{#1}\small\normalsize}
56 %-----------Change section heading font sizes here----
57 \newfont{\sfbsection}{cmssbx10 at
13pt
}
58 \newfont{\sfbsubsec}{cmssbx10 at
12pt
}
59 \newfont{\sfbsubsub}{cmssbx10 at
11pt
}
60 \newfont{\sfbpara}{cmssbx10
}
61 %---------------------------------------------------
64 %===================== LaTeX and TeX type logos
66 \def\La{\TestCount=
\the\fam \leavevmode L
\raise.42ex
67 \hbox{$
\fam\TestCount\scriptstyle\kern-
.3em A$
}}
68 \def\LaTeX{\La\kern-
.15em
\TeX}
69 \def\AllTeX{{(
\La)
\TeX}}
75 \def\@begintheorem
#1#2{\trivlist
76 \item[\hskip \labelsep{\bfseries #1\
#2:
}]\itshape}
78 %===================== Redefine the \@makecaption command
79 \long\def\@makecaption
#1#2{\vskip 10\p@
80 %% \setbox\@tempboxa\hbox{#1: #2}% %% original label definition
81 \setbox\@tempboxa
\hbox{\textbf{ \small #1.
} \small #2}% %% bold and . instead of :
82 \ifdim \wd\@tempboxa >
\hsize
83 %% #1: #2\par %% original definition
84 \textbf{ \small #1.
} \small #2\par %% bold and . instead of :
86 \hbox to
\hsize{\hfil\box\@tempboxa
\hfil}% %% original
87 %% \hbox to\hsize{\box\@tempboxa\hfil}% %% no centering
90 %===================== New caption macro
91 \newlength{\captsize} \let\captsize=
\footnotesize
92 \newlength{\captwidth} \setlength{\captwidth}{\textwidth}
93 \newlength{\beforetableskip} \setlength{\beforetableskip}{.5\baselineskip}
94 \newcommand{\capt}[1]{\begin{minipage
}{\captwidth}
95 \let\normalsize=
\captsize
97 \end{minipage
}\\
\vspace{\beforetableskip}}
100 %---------- Change Figure Label
101 \newcommand{\thefigurename}{Figure
} %-- set default: Figure
102 \def\fnum@figure
{\thefigurename\
\thefigure}
104 % This is to get the equation numbers in the form (section.equation),
105 % and to have the equation counter reset every time the section
106 % counter is incremented.
108 \def\theequation{\thechapter.
\arabic{equation
}}
109 \@addtoreset
{equation
}{chapter
}
112 %===================== New Environments
114 %------ Reference List Macro
115 \newenvironment{reflist
}{\begin{list
}{}{\leftmargin 1em
\labelwidth 0in
116 \labelsep 0in
\itemsep 0ex
\rightmargin 0in
}}{\end{list
}}
117 \newcommand{\refitem}{\item \hspace*
{-
1em
}} %--- item for ref list
118 \newcommand{\SC}{\scriptsize} %--- small capitals for reference lists
121 %------ New environment for better spacing in Eqnarray
123 \stepcounter{equation
}%
124 \def\@currentlabel
{\p@equation
\theequation}%
130 $$
\everycr{}\halign to
\displaywidth\bgroup
131 \hskip\@centering$
\displaystyle\tabskip\z@skip
{##
}$\@eqnsel
132 &
\global\@eqcnt\@ne
\hskip \arraycolsep \hfil$
{##
}$
\hfil
133 &
\global\@eqcnt
\tw@
\hskip \arraycolsep
134 $
\displaystyle{##
}$
\hfil\tabskip\@centering
135 &
\global\@eqcnt
\thr@@
\hb@xt@
\z@
\bgroup\hss##
\egroup
144 %\newenvironment{Eqnarray}{\arraycolsep 0.14em\begin{eqnarray}}{\end{eqnarray}}
146 % The hangitem environment -- like description, but text lines up with
147 % the item descriptor. You give an additional argument containing text
148 % of the width that you want indentations.
150 \def\hangitem#1{\list{}{\settowidth\labelwidth{#1}
151 \leftmargin\labelwidth\advance\leftmargin\labelsep }}
152 \let\endhangitem\endlist
154 %------ Problem List Macro
156 \newenvironment{exerlist
}%
157 {\begin{list
}{\bf \theprobnum.
}%
158 {\usecounter{probnum
} \itemsep 1ex
\leftmargin 2.0em
\labelsep 0.5em
159 \rightmargin 0in
}}{\end{list
}}
164 %===================== Define FANCYHDS.STY
165 % fancyheadings.sty version 1.1
166 % Fancy headers and footers.
167 % Piet van Oostrum, Dept of Computer Science, University of Utrecht
168 % Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
169 % Telephone: +31-30-531806. piet@cs.ruu.nl (mcvax!hp4nl!ruuinf!piet)
172 \def\lhead{\@ifnextchar
[{\@xlhead
}{\@ylhead
}}
173 \def\@xlhead
[#1]#2{\gdef\@elhead
{#1}\gdef\@olhead
{#2}}
174 \def\@ylhead
#1{\gdef\@elhead
{#1}\gdef\@olhead
{#1}}
176 \def\chead{\@ifnextchar
[{\@xchead
}{\@ychead
}}
177 \def\@xchead
[#1]#2{\gdef\@echead
{#1}\gdef\@ochead
{#2}}
178 \def\@ychead
#1{\gdef\@echead
{#1}\gdef\@ochead
{#1}}
180 \def\rhead{\@ifnextchar
[{\@xrhead
}{\@yrhead
}}
181 \def\@xrhead
[#1]#2{\gdef\@erhead
{#1}\gdef\@orhead
{#2}}
182 \def\@yrhead
#1{\gdef\@erhead
{#1}\gdef\@orhead
{#1}}
184 \def\lfoot{\@ifnextchar
[{\@xlfoot
}{\@ylfoot
}}
185 \def\@xlfoot
[#1]#2{\gdef\@elfoot
{#1}\gdef\@olfoot
{#2}}
186 \def\@ylfoot
#1{\gdef\@elfoot
{#1}\gdef\@olfoot
{#1}}
188 \def\cfoot{\@ifnextchar
[{\@xcfoot
}{\@ycfoot
}}
189 \def\@xcfoot
[#1]#2{\gdef\@ecfoot
{#1}\gdef\@ocfoot
{#2}}
190 \def\@ycfoot
#1{\gdef\@ecfoot
{#1}\gdef\@ocfoot
{#1}}
192 \def\rfoot{\@ifnextchar
[{\@xrfoot
}{\@yrfoot
}}
193 \def\@xrfoot
[#1]#2{\gdef\@erfoot
{#1}\gdef\@orfoot
{#2}}
194 \def\@yrfoot
#1{\gdef\@erfoot
{#1}\gdef\@orfoot
{#1}}
196 \newdimen\headrulewidth
197 \newdimen\footrulewidth
198 \newdimen\plainheadrulewidth
199 \newdimen\plainfootrulewidth
201 \newif\if@fancyplain \@fancyplainfalse
202 \def\fancyplain#1#2{\if@fancyplain
#1\else#2\fi}
204 % Initialization of the head and foot text.
208 \plainheadrulewidth\z@
209 \plainfootrulewidth\z@
211 \lhead[\fancyplain{}{\sl\rightmark}]{\fancyplain{}{\sl\leftmark}}
212 % i.e. empty on ``plain'' pages \rightmark on even, \leftmark on odd pages
214 \rhead[\fancyplain{}{\sl\leftmark}]{\fancyplain{}{\sl\rightmark}}
215 % i.e. empty on ``plain'' pages \leftmark on even, \rightmark on odd pages
217 \cfoot{\rm\thepage} % page number
220 % Put together a header or footer given the left, center and
221 % right text, fillers at left and right and a rule.
222 % The \lap commands put the text into an hbox of zero size,
223 % so overlapping text does not generate an errormessage.
225 \def\@fancyhead
#1#2#3#4#5{#1\hbox to
\headwidth{\vbox{\hbox
226 {\rlap{\parbox[b
]{\headwidth}{\raggedright#2\strut}}\hfill
227 \parbox[b
]{\headwidth}{\centering#3\strut}\hfill
228 \llap{\parbox[b
]{\headwidth}{\raggedleft#4\strut}}}\headrule}}#5}
231 \def\@fancyfoot
#1#2#3#4#5{#1\hbox to
\headwidth{\vbox{\footrule
232 \hbox{\rlap{\parbox[t
]{\headwidth}{\raggedright#2\strut}}\hfill
233 \parbox[t
]{\headwidth}{\centering#3\strut}\hfill
234 \llap{\parbox[t
]{\headwidth}{\raggedleft#4\strut}}}}}#5}
236 \def\headrule{{\if@fancyplain
\headrulewidth\plainheadrulewidth\fi
237 \hrule\@height
\headrulewidth\@width
\headwidth \vskip-
\headrulewidth}}
239 \def\footrule{{\if@fancyplain
\footrulewidth\plainfootrulewidth\fi
240 \vskip-
0.3\normalbaselineskip\vskip-
\footrulewidth
241 \hrule\@width
\headwidth\@height
\footrulewidth\vskip-
0.3\normalbaselineskip}}
244 \let\@mkboth
\markboth
245 \@ifundefined
{chapter
}{\def\sectionmark#
#1{\markboth
246 {{\ifnum \c@secnumdepth>
\z@
%MEUH
247 \thesection\hskip 1em
\relax \fi #
#1}}{}}
248 \def\subsectionmark#
#1{\markright {\ifnum \c@secnumdepth >\@ne
249 \thesubsection\hskip 1em
\relax \fi #
#1}}}
251 {\def\chaptermark#
#1{\markboth {{\ifnum \c@secnumdepth>
\m@ne
%MEUH
252 \@chapapp\
\thechapter. \
\fi #
#1}}{}}
253 \def\sectionmark#
#1{\markright{{\ifnum \c@secnumdepth >
\z@
%MEUH
254 \thesection. \
\fi #
#1}}}}
256 \headwidth\textwidth}
257 \def\ps@fancyplain
{\ps@fancy
\let\ps@plain
\ps@plain@fancy
}
258 \def\ps@plain@fancy
{\@fancyplaintrue
\ps@@fancy
}
260 \def\@oddhead
{\@fancyhead
\relax\@olhead\@ochead\@orhead
\hss}
261 \def\@oddfoot
{\@fancyfoot
\relax\@olfoot\@ocfoot\@orfoot
\hss}
262 \def\@evenhead
{\@fancyhead
\hss\@elhead\@echead\@erhead
\relax}
263 \def\@evenfoot
{\@fancyfoot
\hss\@elfoot\@ecfoot\@erfoot
\relax}
265 %------------------- Modify Headers for Prentice-Hall Book Style
266 %---------- Setup headers and footers
267 \pagestyle{fancyplain
}
268 \plainfootrulewidth 0pt
%---- no foot rule for chapter page
269 \footrulewidth 0pt
%---- no rule for foot
274 \renewcommand\normalsize{%
275 \@setfontsize
\normalsize{10.5pt
}{12pt
}
276 \abovedisplayskip 10\p@ \@plus2
\p@ \@minus5
\p@
277 \abovedisplayshortskip \z@ \@plus3
\p@
278 \belowdisplayshortskip 6\p@ \@plus3
\p@ \@minus3
\p@
279 \belowdisplayskip \abovedisplayskip
284 %--- Redefine Headers
285 \renewcommand{\sectionmark}[1]{\markright{\thesection\
#1}}
287 \lhead[\fancyplain{}{\bf\thepage}]{\fancyplain{}{\sfnine\rightmark}}
289 %\rhead[\fancyplain{}{\footnotesize\sf\CHHEAD}]{\fancyplain{}{\bf\thepage}}
290 \rhead[\fancyplain{}{\sfnine \leftmark}]{\fancyplain{}{\bf\thepage}}
291 %--- Empty footers on every page (except initial chapter page which has
292 %--- page number) and optionally a small date stamp
293 \cfoot[\fancyplain{}{}]{\fancyplain{}{}}
294 \rfoot[\fancyplain{}{}]{\fancyplain{\hspace{\fill}\\
\bf\thepage}{}}
295 \lfoot[\fancyplain{\hspace{\fill}\\
\bf\thepage}{}]{\fancyplain{}{}}
296 %-- replace the two lines above with the two below for a date stamp footer
297 %\rfoot[\fancyplain{\scriptsize \today}{\scriptsize \today}]{\fancyplain{\bf\thepage}{}}
298 %\lfoot[\fancyplain{\bf\thepage}{}]{\fancyplain{\scriptsize \today}{\scriptsize \today}}
299 %--- Change format of section header
301 % rlm added chaptermark 10/11/96
302 \def\sectionmark#1{\markright{\ifnum \c@secnumdepth >
\z@
303 {\sfeight Section
}~
\thesection.
\quad \fi #1}}
304 \def\sectionsmark#1{\markright{#1}{#1}}
306 \def\chaptermark#1{\markboth{#1 \quad \@chapapp
{}~
\thechapter}{}}
307 \def\chaptersmark#1{\markboth{#1}{#1}}
312 %===================== Change Section Heads to Bold Sans Serif
313 % Create bolds sans serif sectioning headings. Also the headings have
314 % been reduced in size with less space before and after the heading.
315 % Modified from macros given in BK10.STY
317 %----------------------------- part ---------------------------------
319 \thispagestyle{empty
}
320 \ifodd\c@page
\hbox{}\else\clearpage\fi
321 \addtocounter{page
}{-
2}
322 \thispagestyle{empty
}
323 \ifnum \c@secnumdepth >-
2\relax
324 \refstepcounter{part
}%
325 \addcontentsline{toc
}{part
}{Part
\thepart\hspace{1em
}#1}%
327 \addcontentsline{toc
}{part
}{Part
#1}%
330 \interlinepenalty \@M
332 \ifnum \c@secnumdepth >-
2\relax
333 \huge\bfseries \partname\nobreakspace\thepart
337 \Huge \bfseries #2\par}%
340 %------------------------- appendix -----------------------------------
342 \let\oldappendix\appendix
343 \def\appendix{\oldappendix\def\addchaptertoloe{}}
345 %------------------------- chapter -----------------------------------
346 \def\addchaptertoloe{%
347 \addtocontents{loe
}{\protect\addvspace{14pt
}}%
348 \addtocontents{loe
}{\noindent {\bfseries Chapter~
\thechapter}\protect\par}%
349 \addtocontents{loe
}{\protect\addvspace{10pt
}}%
352 \def\chapter{\clearpage \thispagestyle{plain
} \global\@topnum
\z@
353 \@afterindentfalse
\secdef\@chapter\@schapter
}
354 \def\@chapter
[#1]#2{\ifnum \c@secnumdepth >
\m@ne
355 \refstepcounter{chapter
}
356 \typeout{\@chapapp
\space\thechapter.
}
357 \addcontentsline{toc
}{chapter
}{Chapter~
\protect
358 \numberline{\thechapter}\uppercase{#1}}\else
359 \addcontentsline{toc
}{chapter
}{Chapter~
\uppercase{#1}}\fi
362 \addtocontents{lof
}{\protect\addvspace{10pt
}}
363 \addtocontents{lot
}{\protect\addvspace{10pt
}} \if@twocolumn
364 \@topnewpage
[\@makechapterhead
{#2}]
365 \else \@makechapterhead
{#2}
368 \def\@schapter
#1{\if@twocolumn \@topnewpage
[\@makeschapterhead
{#1}]
369 \else \@makeschapterhead
{#1}\chaptersmark{#1}
370 \@afterheading
\fi\addcontentsline{toc
}{chapter
}{\uppercase{#1}}}
374 \def\@makechapterhead
#1{\vspace*
{-
20pt
}{\parindent0pt\raggedright
375 \ifnum\c@secnumdepth>
\m@ne
\LARGE\sf\@chapapp
{}~
\thechapter\par
376 \vskip3pt\hrule\vskip3pt\hrule
377 \vskip30pt\fi\raggedright\Huge\sfbHuge\uppercase{#1}\par
378 \nobreak\vskip70pt}}%\chaptermark{#1}}
380 \def\@makeschapterhead
#1{\vspace*
{4pt
}{\parindent0pt
381 \vskip3pt\hrule\vskip3pt\hrule
382 \vskip36pt\raggedright\Huge\sfbHuge\uppercase{#1}\par
383 \nobreak\vskip70pt}}%\chaptersmark{#1}}
385 %------------------------ section -----------------------------------
386 \def\section{\@startsection
{section
}{1}{\z@
}{-
3.5ex plus-
1ex
387 minus -
.2ex
}{1.8ex
}{\sfbsection}}
389 %--------------------- subsection -----------------------------------
390 \def\subsection{\@startsection
{subsection
}{2}{\z@
}{-
2.75ex plus -
1ex
391 minus -
.2ex
}{1.2ex
}{\sfbsubsec}}
393 %-------------------- subsubsection --------------------------------
394 \def\subsubsection{\@startsection
{subsubsection
}{3}{\z@
}{-
2.75ex
395 plus -
1ex minus -
.2ex
}{1.2ex
}{\sfbsubsub}}
397 %----------------------- paragraph ----------------------------------
398 \def\paragraph{\@startsection
{paragraph
}{4}{\z@
}{1.25ex plus
399 1ex minus
.2ex
}{-
1em
}{\sfbpara}}
401 %---------------------- subparagraph --------------------------------
402 \def\subparagraph{\@startsection
{subparagraph
}{4}{\parindent}{1.25ex
403 plus
1ex minus
.2ex
}{-
1em
}{\normalsize\sfb}}
407 %====================== Turn off leader dots in Table of Contents
408 \renewcommand{\@dotsep
}{500}
410 \def\tableofcontents{\markboth{}{}\@restonecolfalse
\if@twocolumn\@restonecoltrue
\onecolumn
411 \fi\thispagestyle{plain
} \@makeschapterhead
{Contents
}
413 \chaptersmark{Contents
}
414 \sectionsmark{Contents
}
415 \@starttoc
{toc
}\if@restonecol
\twocolumn\fi}
418 \def\thebibliography#1{\chapter*
{Bibliography
}\list
419 % \addcontentsline{toc}{chapter}{Bibliography}
420 {[\arabic{enumi
}]}{\settowidth\labelwidth{2em
}\leftmargin\labelwidth
421 % \advance\leftmargin\labelsep
423 \def\newblock{\hskip .11em plus
.33em minus
.07em
}
424 \sloppy\clubpenalty4000\widowpenalty4000
425 \sfcode`\.=
1000\relax}
426 \let\endthebibliography=
\endlist
431 %% separate citations with "], ["
432 \def\@citex
[#1]#2{\if@filesw
\immediate\write\@auxout
{\string\citation{#2}}\fi
433 \def\@citea
{}\@cite
{\@for\@citeb:=
#2\do {\@citea
\def\@citea
{],
434 [}\@ifundefined
{b@\@citeb
}{{\bf ?
}\@warning
{Citation `\@citeb' on
435 page
\thepage \space undefined
}}%
436 {\csname b@\@citeb
\endcsname}}}{#1}}
438 \def\@cite
#1#2{[{#1\if@tempswa,
#2\fi}]}
443 %\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
445 %\columnsep 35pt\twocolumn[\@makeschapterhead{Subject Index}]
446 % \addcontentsline{toc}{chapter}{SUBJECT INDEX}
447 % \thispagestyle{plain}\parindent\z@
448 % \parskip\z@ plus .3pt\relax\let\item\@idxitem}
450 \def\theindex{\cleardoublepage\@restonecoltrue
\if@twocolumn\@restonecolfalse
\fi
452 \columnsep 35pt
\twocolumn[\@makeschapterhead
{Subject Index
}]
453 \chaptersmark{Subject Index
}%
454 \addcontentsline{toc
}{chapter
}{SUBJECT INDEX
}
455 \thispagestyle{plain
}\parindent\z@
456 \parskip\z@ plus
.3pt
\relax\let\item\@idxitem
}
459 \renewcommand{\cleardoublepage}{\clearpage\if@twoside
\ifodd\c@page
\else
460 \hbox{}\thispagestyle{empty
}\newpage\if@twocolumn
\hbox{}\newpage\fi\fi\fi}
462 \renewcommand{\numberline}[1]{\sbox\@tempboxa
{#1\hspace{2pt
}}%
463 \ifdim\wd\@tempboxa>\@tempdima
\else \wd\@tempboxa\@tempdima
\fi
466 \def\listofexamples{\@restonecolfalse
\if@twocolumn\@restonecoltrue
\onecolumn
467 \fi\chapter*
{List of Examples
}
468 \renewcommand\@pnumwidth
{0em
}
469 \@starttoc
{loe
}\if@restonecol
472 \def\l@example
{\noindent\@dottedtocline
{1}{0em
}{3.5em
}}
477 \renewcommand\listfigurename{\uppercase{List Of Figures
}}
478 \renewcommand\listtablename{\uppercase{List Of Tables
}}
480 \setlength{\emergencystretch}{0cm
}
482 \pagenumbering{roman
}
485 \setcounter{totalnumber
}{8}
486 \setcounter{bottomnumber
}{3}
487 \setcounter{topnumber
}{3}
488 \renewcommand{\textfraction}{0.1}
489 \renewcommand{\topfraction}{1.0}
490 \renewcommand{\bottomfraction}{1.0}
492 \usepackage[twoside
]{geometry
}
503 marginparwidth=
0.35in,
508 \setlength{\headwidth}{\textwidth}
510 % smb.conf syntax highlighting
511 \usepackage{listings
}
514 \lstdefinelanguage{smbconf
}{
518 \newcommand{\linebreaksign}{\hbox{\ensuremath\hookleftarrow}}
520 \lstdefinestyle{smbconfblock
}
523 backgroundcolor=
\color{lightgray
},
526 prebreak=
{\space\linebreaksign}
529 \newcommand{\smbconfsection}[1]{\emph{#1}}
530 \newcommand{\smbconfoption}[1]{\index{#1}\emph{#1}}