Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b5309a9

Browse files
committed
Import the alltt package and wrap that environment in a similar way to
the way we handle verbatim, so that it picks up the same indentation and minipage behavior.
1 parent e9901f3 commit b5309a9

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Doc/texinputs/python.sty

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,27 @@
185185
\end{minipage}%
186186
}
187187

188+
% This does a similar thing for the {alltt} environment:
189+
\RequirePackage{alltt}
190+
\let\py@OldAllTT=\alltt
191+
\let\py@OldEndAllTT=\endalltt
192+
193+
\renewcommand{\alltt}{%
194+
\setlength{\parindent}{1cm}%
195+
% Calculate the text width for the minipage:
196+
\setlength{\py@codewidth}{\linewidth}%
197+
\addtolength{\py@codewidth}{-\parindent}%
198+
%
199+
\par\indent%
200+
\begin{minipage}[t]{\py@codewidth}%
201+
\small%
202+
\py@OldAllTT%
203+
}
204+
\renewcommand{\endalltt}{%
205+
\py@OldEndAllTT%
206+
\end{minipage}%
207+
}
208+
188209

189210
\newcommand{\py@modulebadkey}{{--just-some-junk--}}
190211

0 commit comments

Comments
 (0)