[Python-checkins] CVS: python/dist/src/Doc/texinputs python.sty,1.83,1.84

Fred L. Drake fdrake@users.sourceforge.net
Mon, 29 Oct 2001 13:02:30 -0800


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

Modified Files:
	python.sty 
Log Message:
Revise the PDF support in the LaTeX style sheet.  This still isn't quite
right, but the tests for whether we are generating PDF are a bit more
readable, and some unnecessary indirection has been removed.


Index: python.sty
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -d -r1.83 -r1.84
*** python.sty	2001/10/09 18:01:23	1.83
--- python.sty	2001/10/29 21:02:28	1.84
***************
*** 27,32 ****
--- 27,34 ----
  \py@doing@page@targetsfalse
  
+ \newif\ifpdf\pdffalse
  \ifx\pdfoutput\undefined\else\ifcase\pdfoutput
  \else
+   \pdftrue
    \input{pdfcolor}
    \let\py@LinkColor=\NavyBlue
***************
*** 254,265 ****
  % Refer to a module's documentation using a hyperlink of the module's
  % name, at least if we're building PDF:
! \@ifundefined{pdfannotlink}{%
!   \newcommand{\refmodule}[2][\py@modulebadkey]{\module{#2}}
! }{%
    \newcommand{\refmodule}[2][\py@modulebadkey]{%
      \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi%
      \py@linkToName{label-module-\py@modulekey}{\module{#2}}%
    }
! }
  
  % support for the module index
--- 256,267 ----
  % Refer to a module's documentation using a hyperlink of the module's
  % name, at least if we're building PDF:
! \ifpdf
    \newcommand{\refmodule}[2][\py@modulebadkey]{%
      \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi%
      \py@linkToName{label-module-\py@modulekey}{\module{#2}}%
    }
! \else
!   \newcommand{\refmodule}[2][\py@modulebadkey]{\module{#2}}
! \fi
  
  % support for the module index
***************
*** 435,445 ****
  }
  
! \@ifundefined{pdfoutput}{
!   \newcommand{\py@ModSynopsisSummary}[4]{\bfcode{#2} & #4\\}
! }{
    \newcommand{\py@ModSynopsisSummary}[4]{%
      \py@linkToName{label-module-#1}{\bfcode{#2}} & #4\\
    }
! }
  \newenvironment{synopsistable}{
    % key, name, type, synopsis
--- 437,447 ----
  }
  
! \ifpdf
    \newcommand{\py@ModSynopsisSummary}[4]{%
      \py@linkToName{label-module-#1}{\bfcode{#2}} & #4\\
    }
! \else
!   \newcommand{\py@ModSynopsisSummary}[4]{\bfcode{#2} & #4\\}
! \fi
  \newenvironment{synopsistable}{
    % key, name, type, synopsis
***************
*** 785,800 ****
  % Use this def/redef approach for \url{} since hyperref defined this already,
  % but only if we actually used hyperref:
! \@ifundefined{pdfannotlink}{
!   \newcommand{\py@url}[1]{\mbox{\small\textsf{#1}}}
! }{
!   \newcommand{\py@url}[1]{{%
      \pdfannotlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}%
      \py@LinkColor%                              color of the link text
!     \mbox{\small\textsf{#1}}%
      \py@NormalColor%                    Turn it back off; these are declarative
      \pdfendlink}%                       and don't appear bound to the current
    }%                                    formatting "box".
! }
! \let\url=\py@url
  \newcommand{\email}[1]{{\small\textsf{#1}}}
  \newcommand{\newsgroup}[1]{{\small\textsf{#1}}}
--- 787,801 ----
  % Use this def/redef approach for \url{} since hyperref defined this already,
  % but only if we actually used hyperref:
! \ifpdf
!   \newcommand{\url}[1]{{%
      \pdfannotlink 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}}}
***************
*** 844,848 ****
  \newcommand{\envvar}[1]{%
    #1%
!   \index{#1@{#1}}%
    \index{environment variables!{#1}}%
  }
--- 845,849 ----
  \newcommand{\envvar}[1]{%
    #1%
!   \index{#1}%
    \index{environment variables!{#1}}%
  }
***************
*** 860,869 ****
  % Note that \longprogramopt provides the '--'!
  \newcommand{\longprogramopt}[1]{\strong{-{}-#1}}
  % \ulink{link text}{URL}
! \newcommand{\ulink}[2]{#1}
  
  % cited titles:  \citetitle{Title of Work}
  %       online:  \citetitle[url-to-resource]{Title of Work}
! \newcommand{\citetitle}[2][URL]{\emph{#2}}
  
  
--- 861,890 ----
  % Note that \longprogramopt provides the '--'!
  \newcommand{\longprogramopt}[1]{\strong{-{}-#1}}
+ 
  % \ulink{link text}{URL}
! \ifpdf
!   % The \noindent here is a hack -- we're forcing pdfTeX into
!   % horizontal mode since \pdfannotlink requires that.
!   \newcommand{\ulink}[2]{\noindent{%
!     \pdfannotlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}%
!     \py@LinkColor%                              color of the link text
!     #1%
!     \py@NormalColor%                    Turn it back off; these are declarative
!     \pdfendlink}%                       and don't appear bound to the current
!   }%                                    formatting "box".
! \else
!   \newcommand{\ulink}[2]{#1}
! \fi
  
  % cited titles:  \citetitle{Title of Work}
  %       online:  \citetitle[url-to-resource]{Title of Work}
! \ifpdf
!   \newcommand{\citetitle}[2][\py@modulebadkey]{%
!     \ifx\py@modulebadkey#1\emph{#2}\else\ulink{\emph{#2}}{#1}\fi%
!   }
! \else
!   \newcommand{\citetitle}[2][URL]{#1}
! \fi
! 
  
  
***************
*** 1020,1042 ****
  % sentences and be terminated with the proper punctuation.
  
! \@ifundefined{pdfannotlink}{%
    \newcommand{\py@seemodule}[3][\py@modulebadkey]{%
      \par%
      \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi%
      \begin{fulllineitems}
!       \item[Module \module{#2} (section \ref{module-\py@modulekey}):]
        #3
      \end{fulllineitems}
    }
! }{\newcommand{\py@seemodule}[3][\py@modulebadkey]{%
      \par%
      \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi%
      \begin{fulllineitems}
!       \item[\py@linkToName{label-module-\py@modulekey}{Module \module{#2}}
!             (section \ref{module-\py@modulekey}):]
        #3
      \end{fulllineitems}
    }
! }
  % \seetitle[url]{title}{why it's interesting}
  \newcommand{\py@seetitle}[3][\py@modulebadkey]{%
--- 1041,1065 ----
  % sentences and be terminated with the proper punctuation.
  
! \ifpdf
    \newcommand{\py@seemodule}[3][\py@modulebadkey]{%
      \par%
      \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi%
      \begin{fulllineitems}
!       \item[\py@linkToName{label-module-\py@modulekey}{Module \module{#2}}
!             (section \ref{module-\py@modulekey}):]
        #3
      \end{fulllineitems}
    }
! \else
!   \newcommand{\py@seemodule}[3][\py@modulebadkey]{%
      \par%
      \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi%
      \begin{fulllineitems}
!       \item[Module \module{#2} (section \ref{module-\py@modulekey}):]
        #3
      \end{fulllineitems}
    }
! \fi
! 
  % \seetitle[url]{title}{why it's interesting}
  \newcommand{\py@seetitle}[3][\py@modulebadkey]{%