| 1 | %
|
|---|
| 2 | % howto.cls for the Python documentation
|
|---|
| 3 | %
|
|---|
| 4 |
|
|---|
| 5 | \NeedsTeXFormat{LaTeX2e}[1995/12/01]
|
|---|
| 6 | \ProvidesClass{howto}
|
|---|
| 7 | [1998/02/25 Document class (Python HOWTO)]
|
|---|
| 8 |
|
|---|
| 9 | \RequirePackage{pypaper}
|
|---|
| 10 | \RequirePackage{fancybox}
|
|---|
| 11 |
|
|---|
| 12 | % Change the options here to get a different set of basic options, This
|
|---|
| 13 | % is where to add things like "a4paper" or "10pt".
|
|---|
| 14 | %
|
|---|
| 15 | \LoadClass[\py@paper,\py@ptsize,twoside]{article}
|
|---|
| 16 |
|
|---|
| 17 | \setcounter{secnumdepth}{1}
|
|---|
| 18 |
|
|---|
| 19 | % Optional packages:
|
|---|
| 20 | %
|
|---|
| 21 | % If processing of these documents fails at your TeX installation,
|
|---|
| 22 | % these may be commented out (independently) to make things work.
|
|---|
| 23 | % These are both supplied with the current version of the teTeX
|
|---|
| 24 | % distribution.
|
|---|
| 25 | %
|
|---|
| 26 | % The "fancyhdr" package makes nicer page footers reasonable to
|
|---|
| 27 | % implement, and is used to put the chapter and section information in
|
|---|
| 28 | % the footers.
|
|---|
| 29 | %
|
|---|
| 30 | \RequirePackage{fancyhdr}\typeout{Using fancier footers than usual.}
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | % Required package:
|
|---|
| 34 | %
|
|---|
| 35 | % This gives us all the Python-specific markup that we really want.
|
|---|
| 36 | % This should come last. Do not change this.
|
|---|
| 37 | %
|
|---|
| 38 | \RequirePackage{python}
|
|---|
| 39 |
|
|---|
| 40 | % support for module synopsis sections:
|
|---|
| 41 | \newcommand{\py@ModSynopsisFilename}{\jobname.syn}
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 | % need to do one of these....
|
|---|
| 45 | \newcommand{\py@doHorizontalRule}{\rule{\textwidth}{1pt}}
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 | % Change the title page to look a bit better, and fit in with the
|
|---|
| 49 | % fncychap ``Bjarne'' style a bit better.
|
|---|
| 50 | %
|
|---|
| 51 | \renewcommand{\maketitle}{
|
|---|
| 52 | \py@doHorizontalRule
|
|---|
| 53 | \ifpdf
|
|---|
| 54 | \begingroup
|
|---|
| 55 | % This \def is required to deal with multi-line authors; it
|
|---|
| 56 | % changes \\ to ', ' (comma-space), making it pass muster for
|
|---|
| 57 | % generating document info in the PDF file.
|
|---|
| 58 | \def\\{, }
|
|---|
| 59 | \pdfinfo{
|
|---|
| 60 | /Author (\@author)
|
|---|
| 61 | /Title (\@title)
|
|---|
| 62 | }
|
|---|
| 63 | \endgroup
|
|---|
| 64 | \fi
|
|---|
| 65 | \begin{flushright}
|
|---|
| 66 | {\rm\Huge\py@HeaderFamily \@title} \par
|
|---|
| 67 | {\em\large\py@HeaderFamily \py@release\releaseinfo} \par
|
|---|
| 68 | \vspace{25pt}
|
|---|
| 69 | {\Large\py@HeaderFamily \@author} \par
|
|---|
| 70 | \vspace{25pt}
|
|---|
| 71 | \@date \par
|
|---|
| 72 | \py@authoraddress \par
|
|---|
| 73 | \end{flushright}
|
|---|
| 74 | \@thanks
|
|---|
| 75 | \setcounter{footnote}{0}
|
|---|
| 76 | \let\thanks\relax\let\maketitle\relax
|
|---|
| 77 | \gdef\@thanks{}\gdef\@author{}\gdef\@title{}
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 | \let\py@OldTableofcontents=\tableofcontents
|
|---|
| 82 | \renewcommand{\tableofcontents}{
|
|---|
| 83 | \begingroup
|
|---|
| 84 | \parskip = 0mm
|
|---|
| 85 | \py@OldTableofcontents
|
|---|
| 86 | \endgroup
|
|---|
| 87 | \py@doHorizontalRule
|
|---|
| 88 | \vspace{12pt}
|
|---|
| 89 | \py@doing@page@targetstrue
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | % Fix the theindex environment to add an entry to the Table of
|
|---|
| 93 | % Contents; this is much nicer than just having to jump to the end of
|
|---|
| 94 | % the book and flip around, especially with multiple indexes.
|
|---|
| 95 | %
|
|---|
| 96 | \let\py@OldTheindex=\theindex
|
|---|
| 97 | \renewcommand{\theindex}{
|
|---|
| 98 | \clearpage
|
|---|
| 99 | \py@OldTheindex
|
|---|
| 100 | \addcontentsline{toc}{section}{\indexname}
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | \@ifundefined{fancyhf}{
|
|---|
| 104 | \pagestyle{plain}}{
|
|---|
| 105 | \pagestyle{normal}} % start this way; change for
|
|---|
| 106 | \pagenumbering{arabic} % ToC & chapters
|
|---|
| 107 | \setcounter{secnumdepth}{2}
|
|---|
| 108 |
|
|---|
| 109 | \thispagestyle{empty}
|
|---|