Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1 | % |
| 2 | % manual.cls for the Python documentation |
| 3 | % |
| 4 | |
| 5 | \NeedsTeXFormat{LaTeX2e}[1995/12/01] |
| 6 | \ProvidesClass{manual} |
Fred Drake | 28f1391 | 1998-03-04 21:47:59 +0000 | [diff] [blame] | 7 | [1998/03/03 Document class (Python manual)] |
| 8 | |
Fred Drake | 724473f | 1998-04-25 04:12:17 +0000 | [diff] [blame] | 9 | \RequirePackage{pypaper} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 10 | |
Fred Drake | 724473f | 1998-04-25 04:12:17 +0000 | [diff] [blame] | 11 | % Change the options here to get a different set of basic options, but only |
| 12 | % if you have to. Paper and font size should be adjusted in pypaper.sty. |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 13 | % |
Fred Drake | 724473f | 1998-04-25 04:12:17 +0000 | [diff] [blame] | 14 | \LoadClass[\py@paper,\py@ptsize,twoside,openright]{report} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 15 | |
Fred Drake | d85b5a4 | 1999-06-29 18:15:59 +0000 | [diff] [blame] | 16 | \setcounter{secnumdepth}{2} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 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 | % |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 29 | \RequirePackage{fancyhdr}\typeout{Using fancier footers than usual.} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 30 | |
| 31 | |
Fred Drake | 5573031 | 1998-03-25 15:41:23 +0000 | [diff] [blame] | 32 | % Required packages: |
| 33 | % |
| 34 | % The "fncychap" package is used to get the nice chapter headers. The |
| 35 | % .sty file is distributed with Python, so you should not need to disable |
| 36 | % it. You'd also end up with a mixed page style; uglier than stock LaTeX! |
| 37 | % |
| 38 | \RequirePackage[Bjarne]{fncychap}\typeout{Using fancy chapter headings.} |
| 39 | % Do horizontal rules it this way to match: |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 40 | \newcommand{\py@doHorizontalRule}{\mghrulefill{\RW}} |
Fred Drake | 5573031 | 1998-03-25 15:41:23 +0000 | [diff] [blame] | 41 | % |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 42 | % |
| 43 | % This gives us all the Python-specific markup that we really want. |
| 44 | % This should come last. Do not change this. |
| 45 | % |
| 46 | \RequirePackage{python} |
Fred Drake | 28f1391 | 1998-03-04 21:47:59 +0000 | [diff] [blame] | 47 | |
Fred Drake | 1cc6d53 | 1998-07-23 17:36:14 +0000 | [diff] [blame] | 48 | % support for module synopsis sections: |
| 49 | \newcommand{\py@ModSynopsisFilename}{\jobname\thechapter.syn} |
| 50 | \let\py@OldChapter=\chapter |
| 51 | \renewcommand{\chapter}{ |
| 52 | \py@ProcessModSynopsis |
| 53 | \py@closeModSynopsisFile |
| 54 | \py@OldChapter |
| 55 | } |
| 56 | |
Fred Drake | 28f1391 | 1998-03-04 21:47:59 +0000 | [diff] [blame] | 57 | |
| 58 | % Change the title page to look a bit better, and fit in with the |
| 59 | % fncychap ``Bjarne'' style a bit better. |
| 60 | % |
| 61 | \renewcommand{\maketitle}{% |
| 62 | \begin{titlepage}% |
| 63 | \let\footnotesize\small |
| 64 | \let\footnoterule\relax |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 65 | \py@doHorizontalRule% |
Fred Drake | 8bdf0bf | 2000-09-05 15:19:56 +0000 | [diff] [blame] | 66 | \@ifundefined{pdfinfo}{}{{ |
| 67 | % This \def is required to deal with multi-line authors; it |
| 68 | % changes \\ to ', ' (comma-space), making it pass muster for |
| 69 | % generating document info in the PDF file. |
| 70 | \def\\{, } |
Fred Drake | c0b2e45 | 1998-03-25 14:53:43 +0000 | [diff] [blame] | 71 | \pdfinfo{ |
| 72 | /Author (\@author) |
| 73 | /Title (\@title) |
| 74 | } |
Fred Drake | 8bdf0bf | 2000-09-05 15:19:56 +0000 | [diff] [blame] | 75 | }} |
Fred Drake | 28f1391 | 1998-03-04 21:47:59 +0000 | [diff] [blame] | 76 | \begin{flushright}% |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 77 | {\rm\Huge\py@HeaderFamily \@title \par}% |
Fred Drake | 7fe80a1 | 2002-03-15 22:38:16 +0000 | [diff] [blame] | 78 | {\em\LARGE\py@HeaderFamily \py@release\releaseinfo \par} |
Fred Drake | 28f1391 | 1998-03-04 21:47:59 +0000 | [diff] [blame] | 79 | \vfill |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 80 | {\LARGE\py@HeaderFamily \@author \par} |
Fred Drake | 28f1391 | 1998-03-04 21:47:59 +0000 | [diff] [blame] | 81 | \vfill\vfill |
| 82 | {\large |
| 83 | \@date \par |
| 84 | \vfill |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 85 | \py@authoraddress \par |
Fred Drake | 28f1391 | 1998-03-04 21:47:59 +0000 | [diff] [blame] | 86 | }% |
| 87 | \end{flushright}%\par |
| 88 | \@thanks |
| 89 | \end{titlepage}% |
| 90 | \setcounter{footnote}{0}% |
| 91 | \let\thanks\relax\let\maketitle\relax |
| 92 | \gdef\@thanks{}\gdef\@author{}\gdef\@title{} |
| 93 | } |
| 94 | |
| 95 | |
Fred Drake | aa54e2d | 1998-03-05 16:41:42 +0000 | [diff] [blame] | 96 | % Catch the end of the {abstract} environment, but here make sure the |
| 97 | % abstract is followed by a blank page if the 'openright' option is used. |
| 98 | % |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 99 | \let\py@OldEndAbstract=\endabstract |
Fred Drake | aa54e2d | 1998-03-05 16:41:42 +0000 | [diff] [blame] | 100 | \renewcommand{\endabstract}{ |
| 101 | \if@openright |
| 102 | \ifodd\value{page} |
| 103 | \typeout{Adding blank page after the abstract.} |
| 104 | \vfil\pagebreak |
| 105 | \fi |
| 106 | \fi |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 107 | \py@OldEndAbstract |
Fred Drake | aa54e2d | 1998-03-05 16:41:42 +0000 | [diff] [blame] | 108 | } |
| 109 | |
Fred Drake | 28f1391 | 1998-03-04 21:47:59 +0000 | [diff] [blame] | 110 | % This wraps the \tableofcontents macro with all the magic to get the |
| 111 | % spacing right and have the right number of pages if the 'openright' |
| 112 | % option has been used. This eliminates a fair amount of crud in the |
| 113 | % individual document files. |
| 114 | % |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 115 | \let\py@OldTableofcontents=\tableofcontents |
Fred Drake | 28f1391 | 1998-03-04 21:47:59 +0000 | [diff] [blame] | 116 | \renewcommand{\tableofcontents}{% |
| 117 | \setcounter{page}{1}% |
| 118 | \pagebreak% |
| 119 | \pagestyle{plain}% |
| 120 | {% |
| 121 | \parskip = 0mm% |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 122 | \py@OldTableofcontents% |
Fred Drake | 28f1391 | 1998-03-04 21:47:59 +0000 | [diff] [blame] | 123 | \if@openright% |
| 124 | \ifodd\value{page}% |
| 125 | \typeout{Adding blank page after the table of contents.}% |
| 126 | \pagebreak\hspace{0pt}% |
| 127 | \fi% |
| 128 | \fi% |
| 129 | \cleardoublepage% |
| 130 | }% |
| 131 | \pagenumbering{arabic}% |
| 132 | \@ifundefined{fancyhf}{}{\pagestyle{normal}}% |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 133 | \py@doing@page@targetstrue% |
Fred Drake | 28f1391 | 1998-03-04 21:47:59 +0000 | [diff] [blame] | 134 | } |
Fred Drake | 255284b | 1998-04-20 16:55:14 +0000 | [diff] [blame] | 135 | % This is needed to get the width of the section # area wide enough in the |
| 136 | % library reference. Doing it here keeps it the same for all the manuals. |
| 137 | % |
| 138 | \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}} |
| 139 | \renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}} |
Fred Drake | 889f53d | 1998-07-24 13:54:29 +0000 | [diff] [blame] | 140 | \setcounter{tocdepth}{1} |
Fred Drake | d579ed8 | 1998-04-17 02:45:41 +0000 | [diff] [blame] | 141 | |
| 142 | |
| 143 | % Fix the theindex environment to add an entry to the Table of |
| 144 | % Contents; this is much nicer than just having to jump to the end of |
| 145 | % the book and flip around, especially with multiple indexes. |
| 146 | % |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 147 | \let\py@OldTheindex=\theindex |
Fred Drake | d579ed8 | 1998-04-17 02:45:41 +0000 | [diff] [blame] | 148 | \renewcommand{\theindex}{ |
| 149 | \cleardoublepage |
Fred Drake | 2a3ab4f | 1998-04-28 18:31:50 +0000 | [diff] [blame] | 150 | \py@OldTheindex |
Fred Drake | d579ed8 | 1998-04-17 02:45:41 +0000 | [diff] [blame] | 151 | \addcontentsline{toc}{chapter}{\indexname} |
| 152 | } |