diff options
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/breakurl/breakurl.dtx | 109 |
1 files changed, 74 insertions, 35 deletions
diff --git a/Master/texmf-dist/source/latex/breakurl/breakurl.dtx b/Master/texmf-dist/source/latex/breakurl/breakurl.dtx index d5111f4be86..fdb8b8c02b1 100644 --- a/Master/texmf-dist/source/latex/breakurl/breakurl.dtx +++ b/Master/texmf-dist/source/latex/breakurl/breakurl.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2005,2006 by Vilar Camara Neto. +% Copyright (C) 2005,2006,2007 by Vilar Camara Neto. % % This file may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -28,7 +28,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{breakurl} %<*package> - [2006/08/26 v1.20 Breakable hyperref URLs] + [2007/12/18 v1.21 Breakable hyperref URLs] %</package> %<*driver> \documentclass{ltxdoc} @@ -43,7 +43,7 @@ %</driver> % \fi -% \CheckSum{372} +% \CheckSum{379} % \CharacterTable @@ -62,6 +62,8 @@ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % +% \changes{v1.21}{2007/06/20}{\string\burlalt and \string\urlalt now work under +% pdflatex; also bug fixes from Heiko Oberdiek} % \changes{v1.20}{2006/08/26}{Changes to reflect update of hyperref package} % \changes{v1.10}{2005/09/23}{Added the command \string\urlalt, allowing one to % specify different values for displayed and actual link} @@ -83,7 +85,7 @@ % \textsf{breakurl}~\fileversion, dated~\filedate.}} % \author{Vilar Camara Neto \\ % \texttt{neto@dcc.ufmg.br}} -% \date{August 26, 2006} +% \date{December 18, 2007} % % \maketitle % @@ -96,10 +98,10 @@ % links to references, section headings, URLs, etc. % % Generating a link to a URL may be a concern if it stands near the end of a -% line of text. When the document is being generated by pdf\LaTeX, there's no -% problem: the driver can break a link across more than one line. However, the -% |dvips| driver (used when one prefers the \LaTeX{} $\rightarrow$ DVI -% $\rightarrow$ PostScript $\rightarrow$ PDF path), because of internal +% line of text. When one uses pdf\LaTeX{} to directly generate a PDF document, +% there's no problem: the driver can break a link across more than one line. +% However, the |dvips| driver (used when one prefers the \LaTeX{} $\rightarrow$ +% DVI $\rightarrow$ PostScript $\rightarrow$ PDF path), because of internal % reasons, can't issue line breaks in the middle of a link. Sometimes this % turns into a serious aesthetic problem, generating largely underfull/overfull % paragraphs; sometimes the final effect is so bad that the link can't even fit @@ -126,7 +128,7 @@ % option to the package (see Section \ref{sec:pkgoptions}). % % In the middle of the document, the syntax of |\burl| (and its synonym |\url|) -% is exactly like the original |\url|: |\burl|\marg{URL}, where \meta{URL} is, +% is the same as the original |\url|: |\burl|\marg{URL}, where \meta{URL} is, % of course, the address to point to. You don't need to care (escape) about % special characters like \texttt{\%}, \texttt{\&}, \texttt{\_}, and so on. % @@ -241,6 +243,9 @@ % % \begin{description} % +% \item[v1.21] |\burlalt| and the synonym |\urlalt| now work with pdflatex. +% Also, there are a couple of bug fixes (thank you again, Heiko). +% % \item[v1.20] An update was needed because |hyperref|'s internals were % changed. (Thanks Heiko for sending the correction patch.) Troubleshooting % now includes a note about |\sloppy|. @@ -330,8 +335,8 @@ % % Thanks to Hendri Adriaens, Donald Arseneau, Michael Friendly, Morten Høgholm, % David Le Kim, Damian Menscher, Tristan Miller, Heiko Oberdiek, Christoph -% Schiller, Xiaotian Sun, and David Tulloh for suggestions, bug reports, -% comments, and corrections. A special thanks to the participants of +% Schiller, Xiaotian Sun, Michael Toews, and David Tulloh for suggestions, bug +% reports, comments, and corrections. A special thanks to the participants of % |comp.text.tex| newsgroups for their constant effort to help hundreds of % people in the beautiful world of \TeX/\LaTeX. % @@ -340,24 +345,49 @@ % % This section describes the |breakurl.sty| source code. % +% The |breakurl| requires some packages, so let's include them: +% +% \begin{macrocode} +\RequirePackage{xkeyval} +\RequirePackage{ifpdf} +% \end{macrocode} + +% Is the document being processed by pdf\LaTeX? (Actually, is there a PDF file +% being directly generated?) Then, well, this package doesn't apply: let's just +% define |\burl| to call the default |\url|. +% +% \begin{macrocode} +\ifpdf + % Dummy package options + \DeclareOptionX{preserveurlmacro}{} + \DeclareOptionX{hyphenbreaks}{} + \DeclareOptionX{vertfit}{} + \ProcessOptionsX\relax + + \PackageWarning{breakurl}{% + You are using breakurl while processing via pdflatex.\MessageBreak + \string\burl\space will be just a synonym of \string\url.\MessageBreak} + \DeclareRobustCommand{\burl}{\url} + \DeclareRobustCommand*{\burlalt}{\hyper@normalise\burl@alt} + \def\burl@alt#1#2{\hyper@linkurl{\Hurl{#1}}{#2}} + \expandafter\endinput +\fi +% \end{macrocode} + % Since |breakurl| is an extension to |hyperref|, let's complain loudly if the % latter was not yet loaded: % % \begin{macrocode} \@ifpackageloaded{hyperref}{}{% \PackageError{breakurl}{The breakurl depends on hyperref package}% - {I can't do anything. Please type X <return>, edit the source file^^J% + {I can't do anything. Please type X <return>, edit the source file% + \MessageBreak and add \string\usepackage\string{hyperref\string} before \string\usepackage\string{breakurl\string}.} \endinput } % \end{macrocode} -% The |breakurl| requires some packages, so let's include them: -% \begin{macrocode} -\RequirePackage{xkeyval} -% \end{macrocode} - % The package options are handled by |\newif|s, which are declared and % initialised: % @@ -435,7 +465,8 @@ \else\def\burl@opt{global}\ifx\burl@temp\burl@opt \@burl@fitstrutfalse\@burl@fitglobaltrue \else - \PackageWarning{breakurl}{Unrecognized vertfit option `\burl@temp'.^^J% + \PackageWarning{breakurl}{Unrecognized vertfit option `\burl@temp'.% + \MessageBreak Adopting default `local'} \@burl@fitstrutfalse\@burl@fitglobalfalse \fi\fi\fi @@ -450,23 +481,11 @@ \ProcessOptionsX\relax % \end{macrocode} -% Is the document being processed by pdf\LaTeX? Then, well, this package -% doesn't apply: let's just define |\burl| to call the default |\url|. -% -% \begin{macrocode} -\ifx\pdfoutput\undefined\else\ifx\pdfoutput\relax\else\ifcase\pdfoutput\else - \PackageWarning{breakurl}{% - You are using breakurl while processing via pdflatex.^^J% - \string\burl\space will be just a synonym of \string\url.^^J} - \DeclareRobustCommand{\burl}{\url} - \endinput -\fi\fi\fi -% \end{macrocode} - % These supporting routines are modified versions of those found in the % |hyperref| package. They were adapted to allow a link to be progressively % built, i.e., when we say ``put a link rectangle here'', the package will % decide if this will be made. +% % \begin{macrocode} \def\burl@hyper@linkurl#1#2{% \begingroup @@ -538,6 +557,7 @@ % |\burl@alt| \marg{ActualURL} and |\burl@@alt| \marg{DisplayedURL} work % together to eat the two arguments (the actual URL to point to and the link % text to be displayed). Again, both are used by |\burl@doit|. +% % \begin{macrocode} \newif\if@burl@breakable @@ -627,8 +647,8 @@ % only then) the PDF link rectangle is built, embracing all link segments of % this line. % -% To make that work, we need some code to work at the PDF processing level. -% The supporting routines to do so are introduced in the PDF dictionary +% To make that work, we need some code to work at the PostScript processing +% level. The supporting routines to do so are introduced in the PS dictionary % initialization block via specials. Each routine is explained below. % % The variables used here are: |burl@stx| and |burl@endx|, which defines the @@ -637,18 +657,23 @@ % which define the bounding box of the current link segment (they resemble the % |hyperref|'s |pdf@llx|--|pdf@ury| counterparts); and |BU.L|, which holds the % target URL. +% % \begin{macrocode} \AtBeginDvi{% \headerps@out{% /burl@stx null def % \end{macrocode} +% % |BU.S| is called whenever a link begins: +% % \begin{macrocode} /BU.S { /burl@stx null def } def % \end{macrocode} -% |BU.SS| is called whenever each link segment begins: +% +% |BU.SS| is called whenever a link segment begins: +% % \begin{macrocode} /BU.SS { currentpoint @@ -662,7 +687,9 @@ burl@lly burl@boty gt {/burl@boty burl@lly def} if } def % \end{macrocode} -% |BU.SE| is called whenever each link segment ends: +% +% |BU.SE| is called whenever a link segment ends: +% % \begin{macrocode} /BU.SE { currentpoint @@ -671,20 +698,26 @@ burl@ury burl@topy lt {/burl@topy burl@ury def} if } def % \end{macrocode} +% % |BU.SE| is called whenever the entire link ends: +% % \begin{macrocode} /BU.E { BU.FL } def % \end{macrocode} +% % |BU.FL| is called to conditionally flush the group of link segments that we % have so far. This is meant to be called at each line break: +% % \begin{macrocode} /BU.FL { burl@stx null ne {BU.DF} if } def % \end{macrocode} +% % |BU.DF| is the routine to actually put the link rectangle in the PDF file: +% % \begin{macrocode} /BU.DF { BU.BB @@ -693,7 +726,9 @@ /burl@stx null def } def % \end{macrocode} +% % |BU.FF| adds margins to the calculated tight rectangle: +% % \begin{macrocode} /BU.BB { burl@stx HyperBorder sub /burl@stx exch def @@ -702,16 +737,20 @@ burl@topy HyperBorder sub /burl@topy exch def } def % \end{macrocode} +% % |BU.B| converts the coordinates into a rectangle: +% % \begin{macrocode} /BU.B { /Rect[burl@stx burl@boty burl@endx burl@topy] } def % \end{macrocode} +% % Finally, we must redefine |eop|, which is called just when the page ends, to % handle links that are split into more than one page. (|eop-hook| isn't the % right place to do so, since this hook is called after the dictionaries were % reverted to a previous state, vanishing the rectangle coordinates.) +% % \begin{macrocode} /eop where { begin |