Import the alltt package and wrap that environment in a similar way to
authorFred Drake <fdrake@acm.org>
Tue, 10 Apr 2001 15:53:06 +0000 (15:53 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 10 Apr 2001 15:53:06 +0000 (15:53 +0000)
the way we handle verbatim, so that it picks up the same indentation and
minipage behavior.

Doc/texinputs/python.sty

index 216f0b0b95d20a4859ce783166087aabb5213514..8a61d8775368c22d56360393afa2138c58b51ff4 100644 (file)
   \end{minipage}%
 }
 
+% This does a similar thing for the {alltt} environment:
+\RequirePackage{alltt}
+\let\py@OldAllTT=\alltt
+\let\py@OldEndAllTT=\endalltt
+
+\renewcommand{\alltt}{%
+  \setlength{\parindent}{1cm}%
+  % Calculate the text width for the minipage:
+  \setlength{\py@codewidth}{\linewidth}%
+  \addtolength{\py@codewidth}{-\parindent}%
+  %
+  \par\indent%
+  \begin{minipage}[t]{\py@codewidth}%
+    \small%
+    \py@OldAllTT%
+}
+\renewcommand{\endalltt}{%
+    \py@OldEndAllTT%
+  \end{minipage}%
+}
+
 
 \newcommand{\py@modulebadkey}{{--just-some-junk--}}