comparison Doc/texinputs/python.sty @ 34807:2380f9d1ebab legacy-trunk

clean up the underscore mess for the typeset formats so that subscripts work in math displays (thanks to Bo Peng on the Doc-SIG)
author Fred Drake <fdrake@acm.org>
date Thu, 24 Mar 2005 06:21:37 +0000
parents 0349257e1ed5
children 66322fca91b4
comparison
equal deleted inserted replaced
34806:4b9df4856f37 34807:2380f9d1ebab
5 \NeedsTeXFormat{LaTeX2e}[1995/12/01] 5 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
6 \ProvidesPackage{python} 6 \ProvidesPackage{python}
7 [1998/01/11 LaTeX package (Python markup)] 7 [1998/01/11 LaTeX package (Python markup)]
8 8
9 \RequirePackage{longtable} 9 \RequirePackage{longtable}
10 \RequirePackage{underscore}
10 11
11 % Uncomment these two lines to ignore the paper size and make the page 12 % Uncomment these two lines to ignore the paper size and make the page
12 % size more like a typical published manual. 13 % size more like a typical published manual.
13 %\renewcommand{\paperheight}{9in} 14 %\renewcommand{\paperheight}{9in}
14 %\renewcommand{\paperwidth}{8.5in} % typical squarish manual 15 %\renewcommand{\paperwidth}{8.5in} % typical squarish manual
539 {3.25ex \@plus1ex \@minus .2ex}% 540 {3.25ex \@plus1ex \@minus .2ex}%
540 {-1em}% 541 {-1em}%
541 {\reset@font\normalsize\py@HeaderFamily}} 542 {\reset@font\normalsize\py@HeaderFamily}}
542 543
543 544
544 % This gets the underscores closer to the right width; the only change
545 % from standard LaTeX is the width specified.
546
547 \DeclareTextCommandDefault{\textunderscore}{%
548 \leavevmode \kern.06em\vbox{\hrule\@width.55em}}
549
550 % Underscore hack (only act like subscript operator if in math mode)
551 %
552 % The following is due to Mark Wooding (the old version didn't work with
553 % Latex 2e.
554
555 \DeclareRobustCommand\hackscore{%
556 \ifmmode_\else\textunderscore\fi%
557 }
558 \begingroup
559 \catcode`\_\active
560 \def\next{%
561 \AtBeginDocument{\catcode`\_\active\def_{\hackscore{}}}%
562 }
563 \expandafter\endgroup\next
564
565
566 % Now for a lot of semantically-loaded environments that do a ton of magical 545 % Now for a lot of semantically-loaded environments that do a ton of magical
567 % things to get the right formatting and index entries for the stuff in 546 % things to get the right formatting and index entries for the stuff in
568 % Python modules and C API. 547 % Python modules and C API.
569 548
570 549