diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/tex/latex/breakurl/breakurl.sty | 277 |
1 files changed, 277 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/breakurl/breakurl.sty b/Master/texmf-dist/tex/latex/breakurl/breakurl.sty new file mode 100644 index 00000000000..868070f55df --- /dev/null +++ b/Master/texmf-dist/tex/latex/breakurl/breakurl.sty @@ -0,0 +1,277 @@ +%% +%% This is file `breakurl.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% breakurl.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2005 by Vilar Camara Neto. +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.2 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.2 or later is part of all distributions of +%% LaTeX version 1999/12/01 or later. +%% +%% Currently this work has the LPPL maintenance status "maintained". +%% +%% The Current Maintainer of this work is Vilar Camara Neto. +%% +%% This work consists of the files breakurl.dtx and +%% breakurl.ins and the derived file breakurl.sty. +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{breakurl} + [2005/09/23 v1.10 Breakable hyperref URLs] + + +\@ifpackageloaded{hyperref}{}{% + \PackageError{breakurl}{The breakurl depends on hyperref package}% + {I can't do anything. Please type X <return>, edit the source file^^J% + and add \string\usepackage\string{hyperref\string} before + \string\usepackage\string{breakurl\string}.} + \endinput +} + +\RequirePackage{xkeyval} + +\newif\if@preserveurlmacro\@preserveurlmacrofalse +\newif\if@burl@fitstrut\@burl@fitstrutfalse +\newif\if@burl@fitglobal\@burl@fitglobalfalse + +\newtoks\burl@toks + +\def\burl@charlist{} +\def\burl@addtocharlist#1{% + \expandafter\gdef\expandafter\burl@charlist\expandafter{% + \burl@charlist #1}% +} + +\bgroup +\catcode`\&=12\relax +\hyper@normalise\burl@addtocharlist{:/.?#&_,;!} +\egroup + +\def\burl@growmif#1{% + \expandafter\def\expandafter\burl@mif\expandafter{% + \burl@mif\def\burl@ttt{#1}\ifx\burl@ttt\@nextchar\@burl@breakabletrue\else + }% +} +\def\burl@growmfi{% + \expandafter\def\expandafter\burl@mfi\expandafter{\burl@mfi\fi}% +} +\def\burl@melse{% + \if@burl@breakable\burl@flush\linebreak[0]\@burl@breakablefalse\fi + \expandafter\expandafter\expandafter\burl@toks + \expandafter\expandafter\expandafter{% + \expandafter\the\expandafter\burl@toks\@nextchar}% +} +\def\burl@defifstructure{% + \def\burl@mif{}% + \def\burl@mfi{}% + \expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=% + \burl@charlist\do{% + \expandafter\burl@growmif\@nextchar + \burl@growmfi + }% +} + +\AtEndOfPackage{\burl@defifstructure} + +\def\burl@setvertfit#1{% + \lowercase{\def\burl@temp{#1}}% + \def\burl@opt{local}\ifx\burl@temp\burl@opt + \@burl@fitstrutfalse\@burl@fitglobalfalse + \else\def\burl@opt{strut}\ifx\burl@temp\burl@opt + \@burl@fitstruttrue\@burl@fitglobalfalse + \else\def\burl@opt{global}\ifx\burl@temp\burl@opt + \@burl@fitstrutfalse\@burl@fitglobaltrue + \else + \PackageWarning{breakurl}{Unrecognized vertfit option `\burl@temp'.^^J% + Adopting default `local'} + \@burl@fitstrutfalse\@burl@fitglobalfalse + \fi\fi\fi +} + +\DeclareOptionX{preserveurlmacro}{\@preserveurlmacrotrue} +\DeclareOptionX{hyphenbreaks}{\bgroup + \catcode`\&=12\relax\hyper@normalise\burl@addtocharlist{-}% + \egroup} +\DeclareOptionX{vertfit}[local]{\burl@setvertfit{#1}} + +\ProcessOptionsX\relax + +\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 + +\def\burl@hyper@linkurl#1#2{% + \begingroup + \hyper@chars + \leavevmode + \burl@condpdflink{#1}% + \endgroup +} + +\def\burl@condpdflink#1{% + \leavevmode + \if@burl@fitstrut + \sbox\pdf@box{#1\strut}% + \else\if@burl@fitglobal + \sbox\pdf@box{\burl@url}% + \else + \sbox\pdf@box{#1}% + \fi\fi + \dimen@\ht\pdf@box\dimen@ii\dp\pdf@box + \sbox\pdf@box{#1}% + \leavevmode + \ifdim\dimen@ii=\z@ + \literalps@out{BU.SS}% + \else + \lower\dimen@ii\hbox{\literalps@out{BU.SS}}% + \fi + \ifHy@breaklinks\unhbox\else\box\fi\pdf@box + \ifdim\dimen@=\z@ + \literalps@out{BU.SE}% + \else + \raise\dimen@\hbox{\literalps@out{BU.SE}}% + \fi + \pdf@addtoksx{H.B}% +} + +\DeclareRobustCommand*{\burl}{% + \begingroup + \let\hyper@linkurl=\burl@hyper@linkurl + \catcode`\&=12\relax + \hyper@normalise\burl@ +} + +\DeclareRobustCommand*{\burlalt}{% + \begingroup + \let\hyper@linkurl=\burl@hyper@linkurl + \catcode`\&=12\relax + \hyper@normalise\burl@alt +} + +\newif\if@burl@breakable + +\bgroup +\catcode`\&=12\relax +\gdef\burl@#1{% + \def\burl@url{#1}% + \def\burl@urltext{#1}% + \burl@doit +} + +\gdef\burl@alt#1{% + \def\burl@url{#1}% + \hyper@normalise\burl@@alt +} +\gdef\burl@@alt#1{% + \def\burl@urltext{#1}% + \burl@doit +} + +\gdef\burl@doit{% + \burl@toks{}% + \let\burl@UrlRight=\UrlRight + \let\UrlRight=\empty + \Hy@colorlink{\@ifundefined{@urlcolor}{\@linkcolor}{\@urlcolor}}% + \@burl@breakablefalse + \expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=% + \burl@urltext\do{% + \expandafter\burl@mif\expandafter\burl@melse\burl@mfi + \if@burl@breakable + \expandafter\expandafter\expandafter\burl@toks + \expandafter\expandafter\expandafter{% + \expandafter\the\expandafter\burl@toks\@nextchar}% + \fi + }% + \let\UrlRight=\burl@UrlRight + \burl@flush + \literalps@out{BU.E}% + \Hy@endcolorlink + \endgroup +} +\egroup + +\def\the@burl@toks{\the\burl@toks} + +\def\burl@flush{% + \expandafter\def\expandafter\burl@toks@def\expandafter{\the\burl@toks}% + \literalps@out{/BU.L (\burl@url) def}% + \hyper@linkurl{\expandafter\Hurl\expandafter{\burl@toks@def}}{\burl@url}% + \global\burl@toks{}% + \let\UrlLeft=\empty +}% + +\if@preserveurlmacro\else\let\url\burl\let\urlalt\burlalt\fi + +\AtBeginDvi{% + \headerps@out{% + /burl@stx null def + /BU.S { + /burl@stx null def + } def + /BU.SS { + currentpoint + /burl@lly exch def + /burl@llx exch def + burl@stx null ne {burl@endx burl@llx ne {BU.FL BU.S} if} if + burl@stx null eq { + burl@llx dup /burl@stx exch def /burl@endx exch def + burl@lly dup /burl@boty exch def /burl@topy exch def + } if + burl@lly burl@boty gt {/burl@boty burl@lly def} if + } def + /BU.SE { + currentpoint + /burl@ury exch def + dup /burl@urx exch def /burl@endx exch def + burl@ury burl@topy lt {/burl@topy burl@ury def} if + } def + /BU.E { + BU.FL + } def + /BU.FL { + burl@stx null ne {BU.DF} if + } def + /BU.DF { + BU.BB + [ /H /I /Border [\@pdfborder] /Color [\@urlbordercolor] + /Action << /Subtype /URI /URI BU.L >> /Subtype /Link BU.B /ANN pdfmark + /burl@stx null def + } def + /BU.BB { + burl@stx HyperBorder sub /burl@stx exch def + burl@endx HyperBorder add /burl@endx exch def + burl@boty HyperBorder add /burl@boty exch def + burl@topy HyperBorder sub /burl@topy exch def + } def + /BU.B { + /Rect[burl@stx burl@boty burl@endx burl@topy] + } def + /eop where { + begin + /@ldeopburl /eop load def + /eop { SDict begin BU.FL end @ldeopburl } def + end + } { + /eop { SDict begin BU.FL end } def + } ifelse + }% +} +\endinput +%% +%% End of file `breakurl.sty'. |