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