Mercurial > cpython-lru_cache-weakref
comparison Doc/texinputs/python.sty @ 22637:d778ea9de780 legacy-trunk
Extend \verbatiminput so that the typeset version provides the same appearance
as a verbatim environment. (The HTML version is already fine.)
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Thu, 28 Mar 2002 22:28:43 +0000 |
| parents | 66e85a732ddd |
| children | 3c876ff29a83 |
comparison
equal
deleted
inserted
replaced
| 22636:0f801626c2d3 | 22637:d778ea9de780 |
|---|---|
| 173 % code samples. | 173 % code samples. |
| 174 | 174 |
| 175 \let\py@OldVerbatim=\verbatim | 175 \let\py@OldVerbatim=\verbatim |
| 176 \let\py@OldEndVerbatim=\endverbatim | 176 \let\py@OldEndVerbatim=\endverbatim |
| 177 \RequirePackage{verbatim} | 177 \RequirePackage{verbatim} |
| 178 \let\py@OldVerbatimInput=\verbatiminput | |
| 178 | 179 |
| 179 % Variable used by begin code command | 180 % Variable used by begin code command |
| 180 \newlength{\py@codewidth} | 181 \newlength{\py@codewidth} |
| 181 | 182 |
| 182 \renewcommand{\verbatim}{% | 183 \renewcommand{\verbatim}{% |
| 191 \py@OldVerbatim% | 192 \py@OldVerbatim% |
| 192 } | 193 } |
| 193 \renewcommand{\endverbatim}{% | 194 \renewcommand{\endverbatim}{% |
| 194 \py@OldEndVerbatim% | 195 \py@OldEndVerbatim% |
| 195 \end{minipage}% | 196 \end{minipage}% |
| 197 } | |
| 198 \renewcommand{\verbatiminput}[1]{% | |
| 199 {\setlength{\parindent}{1cm}% | |
| 200 % Calculate the text width for the minipage: | |
| 201 \setlength{\py@codewidth}{\linewidth}% | |
| 202 \addtolength{\py@codewidth}{-\parindent}% | |
| 203 % | |
| 204 \small% | |
| 205 \begin{list}{}{\setlength{\leftmargin}{1cm}} | |
| 206 \item% | |
| 207 \py@OldVerbatimInput{#1}% | |
| 208 \end{list} | |
| 209 }% | |
| 196 } | 210 } |
| 197 | 211 |
| 198 % This does a similar thing for the {alltt} environment: | 212 % This does a similar thing for the {alltt} environment: |
| 199 \RequirePackage{alltt} | 213 \RequirePackage{alltt} |
| 200 \let\py@OldAllTT=\alltt | 214 \let\py@OldAllTT=\alltt |
