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