Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.113 diff -u -F^f -r1.113 python.sty --- python.sty 24 Mar 2005 06:21:38 -0000 1.113 +++ python.sty 17 Sep 2005 11:57:18 -0000 @@ -199,2 +199,2 @@ } } -% This sets up the {verbatim} environment to be indented and a minipage, -% and to have all the other mostly nice properties that we want for -% code samples. +%% % This sets up the {verbatim} environment to be indented, set in a +%% % smaller font and to have all the other mostly nice properties +%% % that we want for code samples. -\let\py@OldVerbatim=\verbatim -\let\py@OldEndVerbatim=\endverbatim \RequirePackage{verbatim} -\let\py@OldVerbatimInput=\verbatiminput -% Variable used by begin code command -\newlength{\py@codewidth} - -\renewcommand{\verbatim}{% - \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@OldVerbatim% -} -\renewcommand{\endverbatim}{% - \py@OldEndVerbatim% - \end{minipage}% -} -\renewcommand{\verbatiminput}[1]{% - {\setlength{\parindent}{1cm}% - % Calculate the text width for the minipage: - \setlength{\py@codewidth}{\linewidth}% - \addtolength{\py@codewidth}{-\parindent}% - % - \small% - \begin{list}{}{\setlength{\leftmargin}{1cm}} - \item% - \py@OldVerbatimInput{#1}% - \end{list} - }% -} - -% 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}% - \let\e=\textbackslash% - % - \par\indent% - \begin{minipage}[t]{\py@codewidth}% - \small% - \py@OldAllTT% -} -\renewcommand{\endalltt}{% - \py@OldEndAllTT% - \end{minipage}% -} +\def\verbatim@font{\normalfont\small\ttfamily + \hyphenchar\font\m@ne + \let\do\do@noligs + \verbatim@nolig@list} +\addto@hook\every@verbatim{\topsep 0pt% + \advance\@totalleftmargin\leftmargini} + +%% % The original definition of the {alltt} environment (from the +%% % alltt package) lacks the \every@verbatim hook, so in order to +%% % make it behave like {verbatim} we must provide a modified +%% % definition here: + +\begingroup +\lccode`\~=`\' +\lowercase{\endgroup +\newenvironment{alltt}{% + \the\every@verbatim + \trivlist + \item\relax + \if@minipage + \else + \vskip\parskip + \fi + \leftskip\@totalleftmargin + \rightskip\z@skip + \parindent\z@ + \parfillskip\@flushglue + \parskip\z@skip + \@@par + \@tempswafalse + \def\par{% + \if@tempswa + \leavevmode\null\@@par\penalty\interlinepenalty + \else + \@tempswatrue + \ifhmode\@@par\penalty\interlinepenalty\fi + \fi} + \obeylines + \verbatim@font + \let\org@prime~% + \@noligs + \everymath\expandafter{\the\everymath + \catcode`\'=12 \let~\org@prime} + \everydisplay\expandafter{\the\everydisplay + \catcode`\'=12 \let~\org@prime} + \let\org@dospecials\dospecials + \g@remfrom@specials{\\} + \g@remfrom@specials{\{} + \g@remfrom@specials{\}} + \let\do\@makeother + \dospecials + \let\dospecials\org@dospecials + \frenchspacing\@vobeyspaces + \everypar \expandafter{\the\everypar \unpenalty}} +{\endtrivlist}} +\def\g@remfrom@specials#1{% + \def\@new@specials{} + \def\@remove##1{% + \ifx##1#1\else + \g@addto@macro\@new@specials{\do ##1}\fi} + \let\do\@remove\dospecials + \let\dospecials\@new@specials + } \newcommand{\py@modulebadkey}{{--just-some-junk--}}