Moving docs tree to docs-xml to make room for generated docs in the release tarball.
[gd/samba-autobuild/.git] / docs-xml / xslt / latex / sambadoc.cls
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
7
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%
15
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. Redefines the way "figure" amd "table" are formated in a \caption
22 % 5. Defines a \capt macro which defines (1) \captwidth, (2) \captsize
23 %    and \beforetableskip.
24 % 6. Defines and modifies FANCYHDS.STY for headers and foots
25 % 7. Change sectioning headings to bold sans serif fonts
26 % 8. Turn off leader dots in Table of Contents
27 %======================================================================
28
29 %====================== Page Layout
30 % \oddsidemargin 0.750in   \evensidemargin 0.750in  \textwidth 5.00in
31 % \topmargin     0.625in    \headheight     0.3in    \headsep  0.2in
32 % \textheight    7.3in     %\footheight .2in        
33 % \footskip      0.3in
34 % \parskip       0ex       \marginparwidth 1.00in  \marginparsep 0.5in
35 %\setlength\arraycolsep{1pt}
36
37 \if@ph
38         \RequirePackage{geometry}
39         \geometry{
40         twoside,
41         openleft,
42         papersize={7in,9.25in},
43         lmargin=.75in,
44         rmargin=.75in,
45         bmargin=.625in,
46         tmargin=.825in,
47         width=5.5in,
48         height=7.325in, 
49         marginparwidth=0.35in,
50         headheight=0.2in,
51         textwidth=5in,
52         headsep=.25in,
53         footskip=.025in}
54         %\usepackage[letter,cam,cross,center]{crop}
55 \fi
56
57 %====================== Define special fonts
58 \newfont{\BIG}{cminch}                             %--- One-inch font
59 \newfont{\sfbHuge}{cmssbx10 scaled\magstep5}       %-- 25pt sans serif bold
60 \newfont{\sfblarge}{cmssbx10 scaled\magstep1}      %-- 12pt sans serif bold
61 \newfont{\sfbeleven}{cmssbx10 scaled\magstephalf}  %-- 11pt sans serif bold
62 \newfont{\sfb}{cmssbx10}                           %-- 10pt sans serif bold
63 \newfont{\sfeight}{cmss8}                          %-- 8pt sans serif
64 \newfont{\sfnine}{cmss8 at 9pt}                     %-- 9pt sans serif
65
66 \newfont{\defnem}{cmbxti10}                    %-- 10pt sans serif bold
67 \def\spacingset#1{\def\baselinestretch{#1}\small\normalsize}
68
69 %-----------Change section heading font sizes here----
70 \newfont{\sfbsection}{cmssbx10 at 13pt}
71 \newfont{\sfbsubsec}{cmssbx10 at 12pt}
72 \newfont{\sfbsubsub}{cmssbx10 at 11pt}
73 \newfont{\sfbpara}{cmssbx10}
74 %---------------------------------------------------
75
76
77 %
78 % Theorem hack
79 %
80
81 \def\@begintheorem#1#2{\trivlist
82    \item[\hskip \labelsep{\bfseries #1\ #2:}]\itshape}
83
84 %===================== Redefine the \@makecaption command
85    \long\def\@makecaption#1#2{\vskip 10\p@
86 %% \setbox\@tempboxa\hbox{#1: #2}%         %% original label definition
87    \setbox\@tempboxa\hbox{\textbf{ \small #1.} \small #2}%   %% bold and . instead of :
88    \ifdim \wd\@tempboxa >\hsize
89 %%     #1: #2\par                   %% original definition
90        \textbf{ \small #1.} \small #2\par             %% bold and . instead of :
91    \else
92     \hbox to\hsize{\hfil\box\@tempboxa\hfil}%   %% original
93 %%      \hbox to\hsize{\box\@tempboxa\hfil}%             %% no centering
94    \fi}
95
96 %===================== New caption macro
97 \newlength{\captsize}         \let\captsize=\footnotesize
98 \newlength{\captwidth}        \setlength{\captwidth}{\textwidth}
99 \newlength{\beforetableskip}  \setlength{\beforetableskip}{.5\baselineskip}
100 \newcommand{\capt}[1]{\begin{minipage}{\captwidth}
101           \let\normalsize=\captsize
102           \caption[#1]{#1}
103           \end{minipage}\\ \vspace{\beforetableskip}}
104                   
105
106 %---------- Change Figure Label
107 \newcommand{\thefigurename}{Figure}   %-- set default: Figure
108 \def\fnum@figure{\thefigurename\ \thefigure}
109
110 %       This is to get the equation numbers in the form (section.equation),
111 %       and to have the equation counter reset every time the section 
112 %       counter is incremented.
113
114 \def\theequation{\thechapter.\arabic{equation}}
115 \@addtoreset{equation}{chapter}
116
117 \RequirePackage{fancyhdr}
118
119 %------------------- Modify Headers for Prentice-Hall Book Style
120 %---------- Setup headers and footers
121 \pagestyle{fancyplain}
122
123 %--- Redefine Headers
124 \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
125 %
126 \lhead[\fancyplain{}{\bf\thepage}]{\fancyplain{}{\sfnine\rightmark}}
127 %
128 %\rhead[\fancyplain{}{\footnotesize\sf\CHHEAD}]{\fancyplain{}{\bf\thepage}}
129  \rhead[\fancyplain{}{\sfnine \leftmark}]{\fancyplain{}{\bf\thepage}}
130 %--- Empty footers on every page (except initial chapter page which has
131 %--- page number) and optionally a small date stamp
132 \cfoot[\fancyplain{}{}]{\fancyplain{}{}}
133 \rfoot[\fancyplain{}{}]{\fancyplain{\hspace{\fill}\\ \bf\thepage}{}}
134 \lfoot[\fancyplain{\hspace{\fill}\\ \bf\thepage}{}]{\fancyplain{}{}}
135 %-- replace the two lines above with the two below for a date stamp footer
136 %\rfoot[\fancyplain{\scriptsize \today}{\scriptsize \today}]{\fancyplain{\bf\thepage}{}}
137 %\lfoot[\fancyplain{\bf\thepage}{}]{\fancyplain{\scriptsize \today}{\scriptsize \today}}
138 %--- Change format of section header
139 %
140 % rlm added chaptermark 10/11/96
141 \def\sectionmark#1{\markright{\ifnum \c@secnumdepth >\z@
142   {\sfeight Section}~\thesection.\quad \fi #1}}
143 \def\sectionsmark#1{\markright{#1}{#1}}
144 %
145 \def\chaptermark#1{\markboth{#1 \quad \@chapapp{}~\thechapter}{}}
146 \def\chaptersmark#1{\markboth{#1}{#1}}
147
148
149 %===================== Change Section Heads to Bold Sans Serif
150 % Create bolds sans serif sectioning headings.  Also the headings have
151 % been reduced in size with less space before and after the heading.
152 % Modified from macros given in BK10.STY
153 %
154 %----------------------------- part ---------------------------------
155 \def\@part[#1]#2{%
156         \thispagestyle{empty}
157         \ifodd\c@page\hbox{}\else\clearpage\fi
158         \addtocounter{page}{-2}
159         \thispagestyle{empty}
160         \ifnum \c@secnumdepth >-2\relax
161                 \refstepcounter{part}%
162                 \addcontentsline{toc}{part}{Part \thepart\hspace{1em}#1}%
163         \else
164                 \addcontentsline{toc}{part}{Part #1}%
165         \fi
166         {\centering
167                 \interlinepenalty \@M
168                         \normalfont
169                         \ifnum \c@secnumdepth >-2\relax
170                                 \huge\bfseries \partname\nobreakspace\thepart
171                                 \par
172                                 \vskip 20\p@
173                         \fi
174                         \Huge \bfseries #2\par}%
175         \@endpart}
176
177 %------------------------- appendix -----------------------------------
178
179 \let\oldappendix\appendix
180 \def\appendix{\oldappendix\def\addchaptertoloe{}}
181
182 %------------------------- chapter -----------------------------------
183 \def\addchaptertoloe{%
184         \addtocontents{loe}{\protect\addvspace{14pt}}%
185         \addtocontents{loe}{\noindent {\bfseries Chapter~\thechapter}\protect\par}%
186         \addtocontents{loe}{\protect\addvspace{10pt}}%
187 }
188
189 \def\chapter{\clearpage \thispagestyle{plain} \global\@topnum\z@
190 \@afterindentfalse \secdef\@chapter\@schapter} 
191 \def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
192  \refstepcounter{chapter}
193  \typeout{\@chapapp\space\thechapter.}
194  \addcontentsline{toc}{chapter}{Chapter~\protect
195  \numberline{\thechapter}\uppercase{#1}}\else
196  \addcontentsline{toc}{chapter}{Chapter~\uppercase{#1}}\fi
197  \chaptermark{#1}
198  \addchaptertoloe
199  \addtocontents{lof}{\protect\addvspace{10pt}}
200 \addtocontents{lot}{\protect\addvspace{10pt}} \if@twocolumn
201 \@topnewpage[\@makechapterhead{#2}] 
202  \else \@makechapterhead{#2}
203  \@afterheading \fi} 
204 %
205 \def\@schapter#1{\if@twocolumn \@topnewpage[\@makeschapterhead{#1}]
206  \else \@makeschapterhead{#1}\chaptersmark{#1}
207  \@afterheading\fi\addcontentsline{toc}{chapter}{\uppercase{#1}}}
208
209
210
211 \def\@makechapterhead#1{\vspace*{-20pt}{\parindent0pt\raggedright
212 \ifnum\c@secnumdepth>\m@ne\LARGE\sf\@chapapp{}~\thechapter\par
213 \vskip3pt\hrule\vskip3pt\hrule
214 \vskip30pt\fi\raggedright\Huge\sfbHuge\uppercase{#1}\par
215 \nobreak\vskip70pt}}%\chaptermark{#1}}
216
217 \def\@makeschapterhead#1{\vspace*{4pt}{\parindent0pt
218 \vskip3pt\hrule\vskip3pt\hrule
219 \vskip36pt\raggedright\Huge\sfbHuge\uppercase{#1}\par
220 \nobreak\vskip70pt}}%\chaptersmark{#1}}
221 \widowpenalty=1000
222 \clubpenalty=1000
223
224 %------------------------ section -----------------------------------
225 \def\section{\@startsection{section}{1}{\z@}{-3.5ex plus-1ex
226   minus -.2ex}{1.8ex}{\sfbsection}}
227
228 %--------------------- subsection -----------------------------------
229 \def\subsection{\@startsection{subsection}{2}{\z@}{-2.75ex plus -1ex
230     minus -.2ex}{1.2ex}{\sfbsubsec}}
231
232 %-------------------- subsubsection --------------------------------
233 \def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-2.75ex
234   plus -1ex minus -.2ex}{1.2ex}{\sfbsubsub}}
235
236 %----------------------- paragraph ----------------------------------
237 \def\paragraph{\@startsection{paragraph}{4}{\z@}{1.25ex plus
238      1ex minus .2ex}{-1em}{\sfbpara}}
239
240 %---------------------- subparagraph --------------------------------
241 \def\subparagraph{\@startsection{subparagraph}{4}{\parindent}{1.25ex
242      plus 1ex minus .2ex}{-1em}{\normalsize\sfb}}
243
244
245
246 %====================== Turn off leader dots in Table of Contents
247 \renewcommand{\@dotsep}{500}
248
249 \def\tableofcontents{\markboth{}{}\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
250  \fi\thispagestyle{plain} \@makeschapterhead{Contents} 
251  \@afterheading
252  \chaptersmark{Contents}
253  \sectionsmark{Contents}
254  \@starttoc{toc}\if@restonecol\twocolumn\fi}
255
256
257 \def\thebibliography#1{\chapter*{Bibliography}\list
258 % \addcontentsline{toc}{chapter}{Bibliography}
259  {[\arabic{enumi}]}{\settowidth\labelwidth{2em}\leftmargin\labelwidth
260 % \advance\leftmargin\labelsep
261  \usecounter{enumi}}
262  \def\newblock{\hskip .11em plus .33em minus .07em}
263  \sloppy\clubpenalty4000\widowpenalty4000
264  \sfcode`\.=1000\relax}
265 \let\endthebibliography=\endlist
266
267
268 %% BIBLIOGRAPHY
269 %
270 %% separate citations with "], ["
271 \def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
272 \def\@citea{}\@cite{\@for\@citeb:=#2\do {\@citea\def\@citea{],
273 [}\@ifundefined {b@\@citeb}{{\bf ?}\@warning {Citation `\@citeb' on
274 page \thepage \space undefined}}%
275 {\csname b@\@citeb\endcsname}}}{#1}}
276  
277 \def\@cite#1#2{[{#1\if@tempswa, #2\fi}]}
278
279
280 %% index
281
282 \def\theindex{\cleardoublepage\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
283 \columnseprule \z@
284 \columnsep 35pt\twocolumn[\@makeschapterhead{Subject Index}]
285   \chaptersmark{Subject Index}%
286  \addcontentsline{toc}{chapter}{SUBJECT INDEX}
287  \thispagestyle{plain}\parindent\z@
288  \parskip\z@ plus .3pt\relax\let\item\@idxitem}
289
290
291 \renewcommand{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
292 \hbox{}\thispagestyle{empty}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
293
294 \renewcommand{\numberline}[1]{\sbox\@tempboxa{#1\hspace{2pt}}%
295                         \ifdim\wd\@tempboxa>\@tempdima \else \wd\@tempboxa\@tempdima\fi
296                                                                            \box\@tempboxa}
297
298 % Custom list of examples
299 \def\listofexamples{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
300   \fi\chapter*{List of Examples}
301   \renewcommand\@pnumwidth{0em}
302   \@starttoc{loe}\if@restonecol
303   \twocolumn\fi}
304
305 \def\l@example{\noindent\@dottedtocline{1}{0em}{3.5em}}
306
307 \renewcommand\listfigurename{\uppercase{List Of Figures}}
308 \renewcommand\listtablename{\uppercase{List Of Tables}}
309
310 % smb.conf syntax highlighting
311 \RequirePackage{listings}
312 \RequirePackage{xcolor}
313
314 \lstdefinelanguage{smbconf}{
315         morecomment=[l]{\#},
316 }
317
318 \newcommand{\linebreaksign}{\hbox{\ensuremath\hookleftarrow}}
319
320 \lstdefinestyle{smbconfblock}
321 {
322         breaklines=true,
323         backgroundcolor=\color[gray]{0.93},
324         frame=single,
325         frameround=tttt,
326         prebreak={\space\linebreaksign},
327         basicstyle=\small
328 }
329
330 \newcommand{\smbconfsection}[1]{\emph{#1}}
331 \newcommand{\smbconfoption}[1]{\index{#1}\emph{#1}}
332
333 \setlength{\emergencystretch}{0cm}
334
335
336 \cleardoublepage
337 \pagenumbering{roman}
338
339 \setcounter{page}{2}
340 \setcounter{totalnumber}{8}
341 \setcounter{bottomnumber}{3}
342 \setcounter{topnumber}{3}
343 \renewcommand{\textfraction}{0.1}
344 \renewcommand{\topfraction}{1.0}
345 \renewcommand{\bottomfraction}{1.0}