Cleanups + use cross for crop marks
[Samba.git] / docs / xslt / latex / sambadoc.cls
blobe4c7d7dd21ec6440b4ce4c4eeabb8a23fe8e81fb
1 % $Id$
2 % phstyle.cls -- Macros for formatting Prentice-Hall Books
3 % -- Compiled by J.K. Shultis, Dec. 1993
4 % -- Modified and enhanced for LaTeX2e mdh/rlm 1997/02
5 % -- Style Modifications Lori Hughes June 2002
6 % -- Modifications for Samba by Jelmer Vernooij 2003-2005
8 \NeedsTeXFormat{LaTeX2e}%
9 \ProvidesClass{sambadoc}[2005/06/13 Samba Documentation class]
10 \newif\if@ph
11 \@phfalse
12 \DeclareOption{ph}{ \@phtrue }
13 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
14 \ProcessOptions%
16 % Base everything on the default class 'report'.
17 \LoadClass{report}%
18 %================================================================================
19 % 1. Page layout dimensions
20 % 3. Define new fonts for headings
21 % 4. Define LaTeX logos (usually not needed)
22 % 5. Redefines the way "figure" amd "table" are formated in a \caption
23 % 6. Defines a \capt macro which defines (1) \captwidth, (2) \captsize
24 % and \beforetableskip.
25 % 7. New Environemnts: Eqnarray, reflist, exerlist
26 % 8. Defines and modifies FANCYHDS.STY for headers and foots
27 % 9. Change sectioning headings to bold sans serif fonts
28 %10. Turn off leader dots in Table of Contents
29 %======================================================================
31 %====================== Page Layout
32 % \oddsidemargin 0.750in \evensidemargin 0.750in \textwidth 5.00in
33 % \topmargin 0.625in \headheight 0.3in \headsep 0.2in
34 % \textheight 7.3in %\footheight .2in
35 % \footskip 0.3in
36 % \parskip 0ex \marginparwidth 1.00in \marginparsep 0.5in
37 %\setlength\arraycolsep{1pt}
39 \if@ph
40 \RequirePackage{geometry}
41 \geometry{
42 twoside,
43 papersize={7in,9.25in},
44 lmargin=.75in,
45 rmargin=.75in,
46 bmargin=.625in,
47 tmargin=.625in,
48 width=5.5in,
49 height=7.525in,
50 marginparwidth=0.35in,
51 headheight=0.2in,
52 textwidth=5in,
53 headsep=.25in,
54 footskip=.025in}
55 \usepackage[letter,cam,cross,center]{crop}
56 \fi
58 %====================== Define special fonts
59 \newfont{\BIG}{cminch} %--- One-inch font
60 \newfont{\sfbHuge}{cmssbx10 scaled\magstep5} %-- 25pt sans serif bold
61 \newfont{\sfblarge}{cmssbx10 scaled\magstep1} %-- 12pt sans serif bold
62 \newfont{\sfbeleven}{cmssbx10 scaled\magstephalf} %-- 11pt sans serif bold
63 \newfont{\sfb}{cmssbx10} %-- 10pt sans serif bold
64 \newfont{\sfeight}{cmss8} %-- 8pt sans serif
65 \newfont{\sfnine}{cmss8 at 9pt} %-- 9pt sans serif
67 \newfont{\defnem}{cmbxti10} %-- 10pt sans serif bold
68 \def\spacingset#1{\def\baselinestretch{#1}\small\normalsize}
70 %-----------Change section heading font sizes here----
71 \newfont{\sfbsection}{cmssbx10 at 13pt}
72 \newfont{\sfbsubsec}{cmssbx10 at 12pt}
73 \newfont{\sfbsubsub}{cmssbx10 at 11pt}
74 \newfont{\sfbpara}{cmssbx10}
75 %---------------------------------------------------
79 % Theorem hack
82 \def\@begintheorem#1#2{\trivlist
83 \item[\hskip \labelsep{\bfseries #1\ #2:}]\itshape}
85 %===================== Redefine the \@makecaption command
86 \long\def\@makecaption#1#2{\vskip 10\p@
87 %% \setbox\@tempboxa\hbox{#1: #2}% %% original label definition
88 \setbox\@tempboxa\hbox{\textbf{ \small #1.} \small #2}% %% bold and . instead of :
89 \ifdim \wd\@tempboxa >\hsize
90 %% #1: #2\par %% original definition
91 \textbf{ \small #1.} \small #2\par %% bold and . instead of :
92 \else
93 \hbox to\hsize{\hfil\box\@tempboxa\hfil}% %% original
94 %% \hbox to\hsize{\box\@tempboxa\hfil}% %% no centering
95 \fi}
97 %===================== New caption macro
98 \newlength{\captsize} \let\captsize=\footnotesize
99 \newlength{\captwidth} \setlength{\captwidth}{\textwidth}
100 \newlength{\beforetableskip} \setlength{\beforetableskip}{.5\baselineskip}
101 \newcommand{\capt}[1]{\begin{minipage}{\captwidth}
102 \let\normalsize=\captsize
103 \caption[#1]{#1}
104 \end{minipage}\\ \vspace{\beforetableskip}}
107 %---------- Change Figure Label
108 \newcommand{\thefigurename}{Figure} %-- set default: Figure
109 \def\fnum@figure{\thefigurename\ \thefigure}
111 % This is to get the equation numbers in the form (section.equation),
112 % and to have the equation counter reset every time the section
113 % counter is incremented.
115 \def\theequation{\thechapter.\arabic{equation}}
116 \@addtoreset{equation}{chapter}
119 %===================== New Environments
121 %------ Reference List Macro
122 \newenvironment{reflist}{\begin{list}{}{\leftmargin 1em \labelwidth 0in
123 \labelsep 0in \itemsep 0ex \rightmargin 0in}}{\end{list}}
124 \newcommand{\refitem}{\item \hspace*{-1em}} %--- item for ref list
125 \newcommand{\SC}{\scriptsize} %--- small capitals for reference lists
128 %------ New environment for better spacing in Eqnarray
129 \def\eqnarray{%
130 \stepcounter{equation}%
131 \def\@currentlabel{\p@equation\theequation}%
132 \global\@eqnswtrue
133 \m@th
134 \global\@eqcnt\z@
135 \tabskip\@centering
136 \let\\\@eqncr
137 $$\everycr{}\halign to\displaywidth\bgroup
138 \hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel
139 &\global\@eqcnt\@ne\hskip \arraycolsep \hfil${##}$\hfil
140 &\global\@eqcnt\tw@ \hskip \arraycolsep
141 $\displaystyle{##}$\hfil\tabskip\@centering
142 &\global\@eqcnt\thr@@ \hb@xt@\z@\bgroup\hss##\egroup
143 \tabskip\z@skip
147 % The hangitem environment -- like description, but text lines up with
148 % the item descriptor. You give an additional argument containing text
149 % of the width that you want indentations.
151 \def\hangitem#1{\list{}{\settowidth\labelwidth{#1}
152 \leftmargin\labelwidth\advance\leftmargin\labelsep }}
153 \let\endhangitem\endlist
155 \RequirePackage{fancyhdr}
157 %------------------- Modify Headers for Prentice-Hall Book Style
158 %---------- Setup headers and footers
159 \pagestyle{fancyplain}
161 %--- Redefine Headers
162 \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
164 \lhead[\fancyplain{}{\bf\thepage}]{\fancyplain{}{\sfnine\rightmark}}
166 %\rhead[\fancyplain{}{\footnotesize\sf\CHHEAD}]{\fancyplain{}{\bf\thepage}}
167 \rhead[\fancyplain{}{\sfnine \leftmark}]{\fancyplain{}{\bf\thepage}}
168 %--- Empty footers on every page (except initial chapter page which has
169 %--- page number) and optionally a small date stamp
170 \cfoot[\fancyplain{}{}]{\fancyplain{}{}}
171 \rfoot[\fancyplain{}{}]{\fancyplain{\hspace{\fill}\\ \bf\thepage}{}}
172 \lfoot[\fancyplain{\hspace{\fill}\\ \bf\thepage}{}]{\fancyplain{}{}}
173 %-- replace the two lines above with the two below for a date stamp footer
174 %\rfoot[\fancyplain{\scriptsize \today}{\scriptsize \today}]{\fancyplain{\bf\thepage}{}}
175 %\lfoot[\fancyplain{\bf\thepage}{}]{\fancyplain{\scriptsize \today}{\scriptsize \today}}
176 %--- Change format of section header
178 % rlm added chaptermark 10/11/96
179 \def\sectionmark#1{\markright{\ifnum \c@secnumdepth >\z@
180 {\sfeight Section}~\thesection.\quad \fi #1}}
181 \def\sectionsmark#1{\markright{#1}{#1}}
183 \def\chaptermark#1{\markboth{#1 \quad \@chapapp{}~\thechapter}{}}
184 \def\chaptersmark#1{\markboth{#1}{#1}}
189 %===================== Change Section Heads to Bold Sans Serif
190 % Create bolds sans serif sectioning headings. Also the headings have
191 % been reduced in size with less space before and after the heading.
192 % Modified from macros given in BK10.STY
194 %----------------------------- part ---------------------------------
195 \def\@part[#1]#2{%
196 \thispagestyle{empty}
197 \ifodd\c@page\hbox{}\else\clearpage\fi
198 \addtocounter{page}{-2}
199 \thispagestyle{empty}
200 \ifnum \c@secnumdepth >-2\relax
201 \refstepcounter{part}%
202 \addcontentsline{toc}{part}{Part \thepart\hspace{1em}#1}%
203 \else
204 \addcontentsline{toc}{part}{Part #1}%
206 {\centering
207 \interlinepenalty \@M
208 \normalfont
209 \ifnum \c@secnumdepth >-2\relax
210 \huge\bfseries \partname\nobreakspace\thepart
211 \par
212 \vskip 20\p@
214 \Huge \bfseries #2\par}%
215 \@endpart}
217 %------------------------- appendix -----------------------------------
219 \let\oldappendix\appendix
220 \def\appendix{\oldappendix\def\addchaptertoloe{}}
222 %------------------------- chapter -----------------------------------
223 \def\addchaptertoloe{%
224 \addtocontents{loe}{\protect\addvspace{14pt}}%
225 \addtocontents{loe}{\noindent {\bfseries Chapter~\thechapter}\protect\par}%
226 \addtocontents{loe}{\protect\addvspace{10pt}}%
229 \def\chapter{\clearpage \thispagestyle{plain} \global\@topnum\z@
230 \@afterindentfalse \secdef\@chapter\@schapter}
231 \def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
232 \refstepcounter{chapter}
233 \typeout{\@chapapp\space\thechapter.}
234 \addcontentsline{toc}{chapter}{Chapter~\protect
235 \numberline{\thechapter}\uppercase{#1}}\else
236 \addcontentsline{toc}{chapter}{Chapter~\uppercase{#1}}\fi
237 \chaptermark{#1}
238 \addchaptertoloe
239 \addtocontents{lof}{\protect\addvspace{10pt}}
240 \addtocontents{lot}{\protect\addvspace{10pt}} \if@twocolumn
241 \@topnewpage[\@makechapterhead{#2}]
242 \else \@makechapterhead{#2}
243 \@afterheading \fi}
245 \def\@schapter#1{\if@twocolumn \@topnewpage[\@makeschapterhead{#1}]
246 \else \@makeschapterhead{#1}\chaptersmark{#1}
247 \@afterheading\fi\addcontentsline{toc}{chapter}{\uppercase{#1}}}
251 \def\@makechapterhead#1{\vspace*{-20pt}{\parindent0pt\raggedright
252 \ifnum\c@secnumdepth>\m@ne\LARGE\sf\@chapapp{}~\thechapter\par
253 \vskip3pt\hrule\vskip3pt\hrule
254 \vskip30pt\fi\raggedright\Huge\sfbHuge\uppercase{#1}\par
255 \nobreak\vskip70pt}}%\chaptermark{#1}}
257 \def\@makeschapterhead#1{\vspace*{4pt}{\parindent0pt
258 \vskip3pt\hrule\vskip3pt\hrule
259 \vskip36pt\raggedright\Huge\sfbHuge\uppercase{#1}\par
260 \nobreak\vskip70pt}}%\chaptersmark{#1}}
262 %------------------------ section -----------------------------------
263 \def\section{\@startsection{section}{1}{\z@}{-3.5ex plus-1ex
264 minus -.2ex}{1.8ex}{\sfbsection}}
266 %--------------------- subsection -----------------------------------
267 \def\subsection{\@startsection{subsection}{2}{\z@}{-2.75ex plus -1ex
268 minus -.2ex}{1.2ex}{\sfbsubsec}}
270 %-------------------- subsubsection --------------------------------
271 \def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-2.75ex
272 plus -1ex minus -.2ex}{1.2ex}{\sfbsubsub}}
274 %----------------------- paragraph ----------------------------------
275 \def\paragraph{\@startsection{paragraph}{4}{\z@}{1.25ex plus
276 1ex minus .2ex}{-1em}{\sfbpara}}
278 %---------------------- subparagraph --------------------------------
279 \def\subparagraph{\@startsection{subparagraph}{4}{\parindent}{1.25ex
280 plus 1ex minus .2ex}{-1em}{\normalsize\sfb}}
284 %====================== Turn off leader dots in Table of Contents
285 \renewcommand{\@dotsep}{500}
287 \def\tableofcontents{\markboth{}{}\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
288 \fi\thispagestyle{plain} \@makeschapterhead{Contents}
289 \@afterheading
290 \chaptersmark{Contents}
291 \sectionsmark{Contents}
292 \@starttoc{toc}\if@restonecol\twocolumn\fi}
295 \def\thebibliography#1{\chapter*{Bibliography}\list
296 % \addcontentsline{toc}{chapter}{Bibliography}
297 {[\arabic{enumi}]}{\settowidth\labelwidth{2em}\leftmargin\labelwidth
298 % \advance\leftmargin\labelsep
299 \usecounter{enumi}}
300 \def\newblock{\hskip .11em plus .33em minus .07em}
301 \sloppy\clubpenalty4000\widowpenalty4000
302 \sfcode`\.=1000\relax}
303 \let\endthebibliography=\endlist
306 %% BIBLIOGRAPHY
308 %% separate citations with "], ["
309 \def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
310 \def\@citea{}\@cite{\@for\@citeb:=#2\do {\@citea\def\@citea{],
311 [}\@ifundefined {b@\@citeb}{{\bf ?}\@warning {Citation `\@citeb' on
312 page \thepage \space undefined}}%
313 {\csname b@\@citeb\endcsname}}}{#1}}
315 \def\@cite#1#2{[{#1\if@tempswa, #2\fi}]}
318 %% index
320 \def\theindex{\cleardoublepage\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
321 \columnseprule \z@
322 \columnsep 35pt\twocolumn[\@makeschapterhead{Subject Index}]
323 \chaptersmark{Subject Index}%
324 \addcontentsline{toc}{chapter}{SUBJECT INDEX}
325 \thispagestyle{plain}\parindent\z@
326 \parskip\z@ plus .3pt\relax\let\item\@idxitem}
329 \renewcommand{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
330 \hbox{}\thispagestyle{empty}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
332 \renewcommand{\numberline}[1]{\sbox\@tempboxa{#1\hspace{2pt}}%
333 \ifdim\wd\@tempboxa>\@tempdima \else \wd\@tempboxa\@tempdima\fi
334 \box\@tempboxa}
336 % Custom list of examples
337 \def\listofexamples{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
338 \fi\chapter*{List of Examples}
339 \renewcommand\@pnumwidth{0em}
340 \@starttoc{loe}\if@restonecol
341 \twocolumn\fi}
343 \def\l@example{\noindent\@dottedtocline{1}{0em}{3.5em}}
345 \renewcommand\listfigurename{\uppercase{List Of Figures}}
346 \renewcommand\listtablename{\uppercase{List Of Tables}}
348 % smb.conf syntax highlighting
349 \RequirePackage{listings}
350 \RequirePackage{xcolor}
352 \lstdefinelanguage{smbconf}{
353 morecomment=[l]{\#},
356 \newcommand{\linebreaksign}{\hbox{\ensuremath\hookleftarrow}}
358 \lstdefinestyle{smbconfblock}
360 breaklines=true,
361 backgroundcolor=\color[gray]{0.93},
362 frame=single,
363 frameround=tttt,
364 prebreak={\space\linebreaksign}
367 \newcommand{\smbconfsection}[1]{\emph{#1}}
368 \newcommand{\smbconfoption}[1]{\index{#1}\emph{#1}}
370 \setlength{\emergencystretch}{0cm}
373 \cleardoublepage
374 \pagenumbering{roman}
376 \setcounter{page}{2}
377 \setcounter{totalnumber}{8}
378 \setcounter{bottomnumber}{3}
379 \setcounter{topnumber}{3}
380 \renewcommand{\textfraction}{0.1}
381 \renewcommand{\topfraction}{1.0}
382 \renewcommand{\bottomfraction}{1.0}