|
6 | 6 | \ProvidesPackage{python} |
7 | 7 | [1998/01/11 LaTeX package (Python markup)] |
8 | 8 |
|
| 9 | +% Uncomment these two lines to ignore the paper size and make the page |
| 10 | +% size more like a typical published manual. |
| 11 | +%\renewcommand{\paperheight}{9in} |
| 12 | +%\renewcommand{\paperwidth}{8.5in} % typical squarish manual |
| 13 | +%\renewcommand{\paperwidth}{7in} % O'Reilly ``Programmming Python'' |
| 14 | + |
9 | 15 | % These packages can be used to add marginal annotations which indicate |
10 | 16 | % index entries and labels; useful for reviewing this messy documentation! |
11 | 17 | % |
|
91 | 97 | \advance \topmargin by -\headsep |
92 | 98 |
|
93 | 99 | % attempt to work a little better for A4 users |
94 | | -\@ifundefined{paperheight}{ |
95 | | - \textheight 9in |
96 | | -}{ |
97 | | - \textheight \paperheight |
98 | | - \advance\textheight by -2in |
99 | | -} |
| 100 | +\textheight \paperheight |
| 101 | +\advance\textheight by -2in |
100 | 102 |
|
101 | 103 | \oddsidemargin 0pt |
102 | | -\evensidemargin \oddsidemargin |
| 104 | +\evensidemargin 0pt |
| 105 | +%\evensidemargin -.25in % for ``manual size'' documents |
103 | 106 | \marginparwidth 0.5in |
104 | 107 |
|
105 | | -\@ifundefined{paperwidth}{ |
106 | | - \textwidth 6.5in |
107 | | -}{ |
108 | | - \textwidth \paperwidth |
109 | | - \advance\textwidth by -2in |
110 | | -} |
| 108 | +\textwidth \paperwidth |
| 109 | +\advance\textwidth by -2in |
111 | 110 |
|
112 | 111 |
|
113 | 112 | % Style parameters and macros used by most documents here |
|
162 | 161 | % and to have all the other mostly nice properties that we want for |
163 | 162 | % code samples. |
164 | 163 |
|
| 164 | +\let\py@OldVerbatim=\verbatim |
| 165 | +\let\py@OldEndVerbatim=\endverbatim |
| 166 | +\RequirePackage{verbatim} |
| 167 | + |
165 | 168 | % Variable used by begin code command |
166 | 169 | \newlength{\py@codewidth} |
167 | 170 |
|
168 | | -\newcommand{\py@examplevspace}{2mm} |
169 | | -\newcommand{\py@exampleindent}{1cm} |
170 | | - |
171 | | -\let\py@OldVerbatim=\verbatim |
172 | | -\let\py@OldEndVerbatim=\endverbatim |
173 | 171 | \renewcommand{\verbatim}{% |
174 | | - \begingroup% |
175 | | - \setlength{\parindent}\py@exampleindent% |
| 172 | + \setlength{\parindent}{1cm}% |
176 | 173 | % Calculate the text width for the minipage: |
177 | 174 | \setlength{\py@codewidth}{\linewidth}% |
178 | 175 | \addtolength{\py@codewidth}{-\parindent}% |
179 | 176 | % |
180 | | - \par% |
181 | | - \vspace\py@examplevspace% |
182 | | - \indent% |
| 177 | + \par\indent% |
183 | 178 | \begin{minipage}[t]{\py@codewidth}% |
184 | 179 | \small% |
185 | 180 | \py@OldVerbatim% |
186 | 181 | } |
187 | 182 | \renewcommand{\endverbatim}{% |
188 | 183 | \py@OldEndVerbatim% |
189 | 184 | \end{minipage}% |
190 | | - \endgroup% |
191 | 185 | } |
192 | 186 |
|
193 | 187 |
|
|
264 | 258 | \@ifundefined{py@modplat@\py@thismodulekey}{ |
265 | 259 | \write\modindexfile{\protect\indexentry{#1@{\texttt{#1}}}{\thepage}}% |
266 | 260 | }{\write\modindexfile{\protect\indexentry{#1@{\texttt{#1} % |
267 | | - \emph{(\platformof[\py@thismodulekey]{})}}}{\thepage}}% |
| 261 | + \emph{(\py@platformof[\py@thismodulekey]{})}}}{\thepage}}% |
268 | 262 | } |
269 | 263 | \fi% |
270 | 264 | } |
271 | 265 |
|
| 266 | +% *** XXX *** THE NEXT FOUR MACROS ARE NOW OBSOLETE !!! *** |
| 267 | + |
272 | 268 | % built-in & Python modules in the main distribution |
273 | | -\newcommand{\bimodindex}[1]{\py@modindex{#1}{built-in }} |
274 | | -\newcommand{\stmodindex}[1]{\py@modindex{#1}{standard }} |
| 269 | +\newcommand{\bimodindex}[1]{\py@modindex{#1}{built-in }% |
| 270 | + \typeout{*** MACRO bimodindex IS OBSOLETE -- USE declaremodule INSTEAD!}} |
| 271 | +\newcommand{\stmodindex}[1]{\py@modindex{#1}{standard }% |
| 272 | + \typeout{*** MACRO stmodindex IS OBSOLETE -- USE declaremodule INSTEAD!}} |
275 | 273 |
|
276 | 274 | % Python & extension modules outside the main distribution |
277 | | -\newcommand{\modindex}[1]{\py@modindex{#1}{}} |
278 | | -\newcommand{\exmodindex}[1]{\py@modindex{#1}{extension }} |
| 275 | +\newcommand{\modindex}[1]{\py@modindex{#1}{}% |
| 276 | + \typeout{*** MACRO modindex IS OBSOLETE -- USE declaremodule INSTEAD!}} |
| 277 | +\newcommand{\exmodindex}[1]{\py@modindex{#1}{extension }% |
| 278 | + \typeout{*** MACRO exmodindex IS OBSOLETE -- USE declaremodule INSTEAD!}} |
279 | 279 |
|
280 | 280 | % Additional string for an index entry |
281 | 281 | \newcommand{\index@subitem}{} |
|
296 | 296 | \newcommand{\py@thismodulekey}{} |
297 | 297 | \newcommand{\py@thismoduletype}{} |
298 | 298 |
|
299 | | -\newcommand{\py@standardIndexModule}[1]{\stmodindex{#1}} |
300 | | -\newcommand{\py@builtinIndexModule}[1]{\bimodindex{#1}} |
301 | | -\newcommand{\py@extensionIndexModule}[1]{\exmodindex{#1}} |
302 | | -\newcommand{\py@IndexModule}[1]{\modindex{#1}} |
| 299 | +\newcommand{\py@standardIndexModule}[1]{\py@modindex{#1}{standard }} |
| 300 | +\newcommand{\py@builtinIndexModule}[1]{\py@modindex{#1}{built-in }} |
| 301 | +\newcommand{\py@extensionIndexModule}[1]{\py@modindex{#1}{extension }} |
| 302 | +\newcommand{\py@IndexModule}[1]{\py@modindex{#1}{}} |
303 | 303 |
|
304 | 304 | \newif\ifpy@HaveModSynopsis \py@HaveModSynopsisfalse |
305 | 305 | \newif\ifpy@ModSynopsisFileIsOpen \py@ModSynopsisFileIsOpenfalse |
|
325 | 325 | \openout\py@ModPlatformFile=\py@ModPlatformFilename |
326 | 326 | \py@ModPlatformFileIsOpentrue |
327 | 327 | \fi |
328 | | - \@ifundefined{py@modplat@\py@thismodulekey}{ |
329 | | - \py@writeModPlatformFile{% |
330 | | - \newcommand{\csname py@modplat@\py@thismodulekey\endcsname}{#1}}% |
331 | | - }{\py@writeModPlatformFile{% |
332 | | - \newcommand{\string\py@modplat@\py@thismodulekey}{#1}% |
333 | | - } |
334 | | - } |
335 | 328 | } |
336 | 329 | \InputIfFileExists{\jobname.pla}{}{} |
337 | | -\newcommand{\platformof}[2][\py@modulebadkey]{% |
| 330 | +\newcommand{\py@platformof}[2][\py@modulebadkey]{% |
338 | 331 | \ifx\py@modulebadkey#1 \def\py@key{#2}% |
339 | 332 | \else \def\py@key{#1}% |
340 | 333 | \fi% |
|
852 | 845 | } |
853 | 846 | } |
854 | 847 | \newenvironment{seealso}[0]{ |
| 848 | + \par |
855 | 849 | \strong{See Also:}\par |
856 | 850 | \def\seetext##1{\par{##1}} |
857 | 851 | \let\seemodule=\py@seemodule |
|
0 commit comments