[Python-checkins] python/dist/src/Doc/texinputs python.sty, 1.110, 1.111

fdrake at users.sourceforge.net fdrake at users.sourceforge.net
Wed Dec 1 07:30:33 CET 2004


Update of /cvsroot/python/python/dist/src/Doc/texinputs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31049/texinputs

Modified Files:
	python.sty 
Log Message:
- 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


Index: python.sty
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- python.sty	21 Aug 2004 15:13:52 -0000	1.110
+++ python.sty	1 Dec 2004 06:30:31 -0000	1.111
@@ -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 at parindent=\noindent
+
 % for PDF output, use maximal compression & a lot of other stuff
 % (test for PDF recommended by Tanmoy Bhattacharya <tanmoy at qcd.lanl.gov>)
 %
@@ -56,12 +61,19 @@
     \let\pdfstartlink=\pdfannotlink
   }{}
   %
+  % The \py at parindent here is a hack -- we're forcing pdfTeX into
+  % horizontal mode since \pdfstartlink requires that.
+  \def\py at pdfstartlink{%
+    \ifvmode\py at 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 at linkToName}[2]{%
-    \pdfstartlink attr{/Border [0 0 0]} goto name{#1}%
+    \py at pdfstartlink attr{/Border [0 0 0]} goto name{#1}%
       \py at LinkColor#2\py at 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 at pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}%
     \py at LinkColor%                              color of the link text
     \py at smallsize\sf #1%
     \py at 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 at pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}%
     \py at LinkColor%                              color of the link text
     #1%
     \py at NormalColor%                    Turn it back off; these are declarative



More information about the Python-checkins mailing list