diff options
author | Fred Drake <fdrake@acm.org> | 2004-12-01 06:30:31 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2004-12-01 06:30:31 (GMT) |
commit | cdd6e4d753c6024e1e7503fa4b1f67928da35296 (patch) | |
tree | 2df0fd347d768305c3f06b1aa338efd6e7c16fc4 /Doc/texinputs | |
parent | cf05f4728008217de54144c437a5433ce0ffbab2 (diff) | |
download | cpython-cdd6e4d753c6024e1e7503fa4b1f67928da35296.zip cpython-cdd6e4d753c6024e1e7503fa4b1f67928da35296.tar.gz cpython-cdd6e4d753c6024e1e7503fa4b1f67928da35296.tar.bz2 |
- fix up internal hyperlink generation in PDF formatting so that links at
the beginning of a paragraph do not generate errors; this affected
things like \refmodule when it came first in a paragraph
- clean up the .sty file to separate out the treatment of the start
of a new paragraph
Diffstat (limited to 'Doc/texinputs')
-rw-r--r-- | Doc/texinputs/python.sty | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/Doc/texinputs/python.sty b/Doc/texinputs/python.sty index dd043e1..a79a957 100644 --- a/Doc/texinputs/python.sty +++ b/Doc/texinputs/python.sty @@ -20,6 +20,11 @@ %\RequirePackage{showkeys} %\RequirePackage{showidx} +% If we ever want to indent paragraphs, this needs to be changed. +% This is used inside the macros defined here instead of coding +% \noindent directly. +\let\py@parindent=\noindent + % for PDF output, use maximal compression & a lot of other stuff % (test for PDF recommended by Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov>) % @@ -56,12 +61,19 @@ \let\pdfstartlink=\pdfannotlink }{} % + % The \py@parindent here is a hack -- we're forcing pdfTeX into + % horizontal mode since \pdfstartlink requires that. + \def\py@pdfstartlink{% + \ifvmode\py@parindent\fi% + \pdfstartlink% + } + % % Macro that takes two args: the name to link to and the content of % the link. This takes care of the PDF magic, getting the colors % the same for each link, and avoids having lots of garbage all over % this style file. \newcommand{\py@linkToName}[2]{% - \pdfstartlink attr{/Border [0 0 0]} goto name{#1}% + \py@pdfstartlink attr{/Border [0 0 0]} goto name{#1}% \py@LinkColor#2\py@NormalColor% \pdfendlink% } @@ -857,8 +869,7 @@ % but only if we actually used hyperref: \ifpdf \newcommand{\url}[1]{{% - \noindent% - \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}% + \py@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 @@ -933,11 +944,9 @@ % \ulink{link text}{URL} \ifpdf - % The \noindent here is a hack -- we're forcing pdfTeX into - % horizontal mode since \pdfstartlink requires that. - % For PDF, we *should* only generate a link when the URL is absolute. - \newcommand{\ulink}[2]{\noindent{% - \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}% + \newcommand{\ulink}[2]{{% + % For PDF, we *should* only generate a link when the URL is absolute. + \py@pdfstartlink 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 |