[Python-checkins] python/dist/src/Doc/texinputs python.sty,1.98,1.99

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Thu, 31 Oct 2002 13:04:38 -0800


Update of /cvsroot/python/python/dist/src/Doc/texinputs
In directory usw-pr-cvs1:/tmp/cvs-serv9935

Modified Files:
	python.sty 
Log Message:
Define abstract way to get the normal and smaller font sizes that work
even in the footnote context.


Index: python.sty
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v
retrieving revision 1.98
retrieving revision 1.99
diff -C2 -d -r1.98 -r1.99
*** python.sty	30 Oct 2002 22:20:27 -0000	1.98
--- python.sty	31 Oct 2002 21:04:34 -0000	1.99
***************
*** 135,138 ****
--- 135,155 ----
  \newcommand{\py@HeaderFamily}{\sffamily}
  
+ % Set up abstract ways to get the normal and smaller font sizes that
+ % work even in footnote context.
+ \newif\ifpy@infootnote \py@infootnotefalse
+ \let\py@oldfootnotetext\@footnotetext
+ \def\@footnotetext#1{%
+   \bgroup%
+     \py@infootnotetrue
+     \py@oldfootnotetext{#1}%
+   \egroup%
+ }
+ \def\py@defaultsize{%
+   \ifpy@infootnote\footnotesize\else\normalsize\fi%
+ }
+ \def\py@smallsize{%
+   \ifpy@infootnote\scriptsize\else\small\fi%
+ }
+ 
  % Redefine the 'normal' header/footer style when using "fancyhdr" package:
  \@ifundefined{fancyhf}{}{
***************
*** 818,831 ****
  \newcommand{\kbd}[1]{\code{#1}}
  \newcommand{\samp}[1]{`\code{#1}'}
- % This weird definition of \var{} allows it to always appear in roman
- % italics, and won't get funky in code fragments when we play around
- % with fonts.  This also works directly in math mode.
- % XXX \normalsize is bad in footnotes, though; we need a way to
- % determine when we're in a footnote.
  \newcommand{\var}[1]{%
    \ifmmode%
!     \hbox{\normalsize\textrm{\textit{#1\/}}}%
    \else%
!     \normalsize\textrm{\textit{#1\/}}%
    \fi%
  }
--- 835,843 ----
  \newcommand{\kbd}[1]{\code{#1}}
  \newcommand{\samp}[1]{`\code{#1}'}
  \newcommand{\var}[1]{%
    \ifmmode%
!     \hbox{\py@defaultsize\textrm{\textit{#1\/}}}%
    \else%
!     \py@defaultsize\textrm{\textit{#1\/}}%
    \fi%
  }
***************
*** 834,839 ****
  \newcommand{\strong}[1]{{\bf #1}}
  % let's experiment with a new font:
! \newcommand{\file}[1]{`{\small\textsf{#1}}'}
! \newcommand{\filenq}[1]{{\small\textsf{#1}}}
  
  % Use this def/redef approach for \url{} since hyperref defined this already,
--- 846,851 ----
  \newcommand{\strong}[1]{{\bf #1}}
  % let's experiment with a new font:
! \newcommand{\file}[1]{`\filenq{#1}'}
! \newcommand{\filenq}[1]{{\py@smallsize\textsf{#1}}}
  
  % Use this def/redef approach for \url{} since hyperref defined this already,
***************
*** 844,856 ****
      \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}%
      \py@LinkColor%                              color of the link text
!     \small\sf #1%
      \py@NormalColor%                    Turn it back off; these are declarative
      \pdfendlink}%                       and don't appear bound to the current
    }%                                    formatting "box".
  \else
!   \newcommand{\url}[1]{\mbox{\small\textsf{#1}}}
  \fi
! \newcommand{\email}[1]{{\small\textsf{#1}}}
! \newcommand{\newsgroup}[1]{{\small\textsf{#1}}}
  
  \newcommand{\py@varvars}[1]{{%
--- 856,868 ----
      \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}%
      \py@LinkColor%                              color of the link text
!     \py@smallsize\sf #1%
      \py@NormalColor%                    Turn it back off; these are declarative
      \pdfendlink}%                       and don't appear bound to the current
    }%                                    formatting "box".
  \else
!   \newcommand{\url}[1]{\mbox{\py@smallsize\textsf{#1}}}
  \fi
! \newcommand{\email}[1]{{\py@smallsize\textsf{#1}}}
! \newcommand{\newsgroup}[1]{{\py@smallsize\textsf{#1}}}
  
  \newcommand{\py@varvars}[1]{{%
***************
*** 888,897 ****
  \newcommand{\cdata}[1]{\texttt{#1}}     % C variable, typically global
  
! \newcommand{\mailheader}[1]{{\small\textsf{#1:}}}
! \newcommand{\mimetype}[1]{{\small\textsf{#1}}}
  % The \! is a "negative thin space" in math mode.
  \newcommand{\regexp}[1]{%
    {\tiny$^{^\lceil}\!\!$%
!    {\normalsize\code{#1}}% XXX should use \footnotesize in footnotes
     $\!\rfloor\!$%
    }}
--- 900,909 ----
  \newcommand{\cdata}[1]{\texttt{#1}}     % C variable, typically global
  
! \newcommand{\mailheader}[1]{{\py@smallsize\textsf{#1:}}}
! \newcommand{\mimetype}[1]{{\py@smallsize\textsf{#1}}}
  % The \! is a "negative thin space" in math mode.
  \newcommand{\regexp}[1]{%
    {\tiny$^{^\lceil}\!\!$%
!    {\py@defaultsize\code{#1}}%
     $\!\rfloor\!$%
    }}