From 3062f54d06ccad7035b82b56fd5476dcac02c505 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 25 Jan 2009 16:13:25 +0000 Subject: breakurl 1.30 (23jan09) git-svn-id: svn://tug.org/texlive/trunk@11968 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/breakurl/README | 2 +- Master/texmf-dist/doc/latex/breakurl/breakurl.pdf | Bin 120165 -> 121331 bytes .../texmf-dist/source/latex/breakurl/breakurl.dtx | 180 ++++++++++++--------- Master/texmf-dist/tex/latex/breakurl/breakurl.sty | 93 ++++++----- 4 files changed, 163 insertions(+), 112 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/breakurl/README b/Master/texmf-dist/doc/latex/breakurl/README index 365e01ea4b5..2345b83baf1 100644 --- a/Master/texmf-dist/doc/latex/breakurl/README +++ b/Master/texmf-dist/doc/latex/breakurl/README @@ -1,4 +1,4 @@ -README for breakurl, version 1.23 (2008/07/15) +README for breakurl, version 1.30 (2009/01/24) INTRODUCTION diff --git a/Master/texmf-dist/doc/latex/breakurl/breakurl.pdf b/Master/texmf-dist/doc/latex/breakurl/breakurl.pdf index b0a86e1991a..c64445ab777 100644 Binary files a/Master/texmf-dist/doc/latex/breakurl/breakurl.pdf and b/Master/texmf-dist/doc/latex/breakurl/breakurl.pdf differ diff --git a/Master/texmf-dist/source/latex/breakurl/breakurl.dtx b/Master/texmf-dist/source/latex/breakurl/breakurl.dtx index 96d593af626..0adac7a40ac 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,2007,2008 by Vilar Camara Neto. +% Copyright (C) 2005,2006,2007,2008,2009 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 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{breakurl} %<*package> - [2008/07/15 v1.23 Breakable hyperref URLs] + [2009/01/24 v1.30 Breakable hyperref URLs] % %<*driver> \documentclass{ltxdoc} @@ -43,7 +43,7 @@ % % \fi -% \CheckSum{378} +% \CheckSum{391} % \CharacterTable @@ -62,6 +62,7 @@ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % +% \changes{v1.30}{2009/01/24}{Breaks are now allowed before percent signs} % \changes{v1.23}{2008/07/15}{\string\hypersetup can now be used anywhere} % \changes{v1.22}{2008/04/05}{Corrected a misuse of \string\leavevmode which % generated blank lines inside tables} @@ -90,12 +91,14 @@ % \textsf{breakurl}~\fileversion, dated~\filedate.}} % \author{Vilar Camara Neto \\ % \texttt{neto@dcc.ufmg.br}} -% \date{July 15, 2008} +% \date{January 24, 2009} % % \maketitle % % \StopEventually % +% \sloppy +% % \section{Introduction} % % The \pkg{hyperref} package brings a lot of interesting tools to ``boost'' @@ -117,20 +120,22 @@ % ``breakable URL''). Instead of generating one long, atomic link, this command % breaks it into small pieces, allowing line breaks between them. Each sequence % of pieces that stand together in one line are converted to a hot (clickable) -% link in the PDF document. +% link in the PDF document. Also, by default the |\url| command is turned into +% a synonym of |\burl|, so there's no need to do a search-replace operation to +% immediately start using the package. % % % \section{How to use it} % \label{sec:howtouse} % -% At the preamble, just put a |\usepackage{breakurl}| somewhere \emph{after} -% the |\usepackage{hyperref}|. The |\burl| command is defined and, by default, -% the package also turns the |\url| command into a synonym of |\burl|. This -% might come in handy, for example, if you use Bib\TeX{}, your |.bib|-file has -% lots of |\url| commands and you don't want to replace them by |\burl|. If, -% for some reason, you want to preserve the original behavior of |\url| (i.e., -% it creates an unbreakable link), you must supply the |preserveurlmacro| -% option to the package (see Section \ref{sec:pkgoptions}). +% At the preamble, just put |\usepackage{breakurl}| somewhere \emph{after} +% |\usepackage{hyperref}|. The |\burl| command is defined and, by default, the +% package also turns the |\url| command into a synonym of |\burl|. This might +% come in handy, for example, if you use Bib\TeX{}, your |.bib|-file has lots +% of |\url| commands and you don't want to replace them by |\burl|. If, for +% some reason, you want to preserve the original behavior of |\url| (i.e., it +% creates an unbreakable link), you must supply the |preserveurlmacro| option +% to the package (see Section \ref{sec:pkgoptions}). % % In the middle of the document, the syntax of |\burl| (and its synonym |\url|) % is the same as the original |\url|: |\burl|\marg{URL}, where \meta{URL} is, @@ -147,7 +152,6 @@ % % The default behavior of the package is to break the link after any sequence % of these characters: -% % \begin{center} % \begin{tabular}{lll} % `|:|' (colon) & @@ -162,15 +166,19 @@ % `|!|' (exclamation mark) % \end{tabular} % \end{center} +% and before occurrences of any of these: +% \begin{center} +% \begin{tabular}{l} +% `|%|' (percent sign) +% \end{tabular} +% \end{center} % -% You can add `|-|' (hyphen) to this list (see below), but read why I decided -% to keep it out of the default list. -% -% Remember that breaks are allowed \emph{after} a sequence of these characters, -% so a link starting with |http://| will never break before the second slash. +% Remember that (with exception of percent sign) breaks are only allowed +% \emph{after} a sequence of these characters, so a link starting with +% |http://| will never break before the second slash. % -% Also note that I decided not to include the `|-|' (hyphen) character in this -% default list. It's to avoid a possible confusion when someone encounters a +% Also note that I decided not to include the `|-|' (hyphen) character in the +% default lists. It's to avoid a possible confusion when someone encounters a % break after a hyphen, e.g.: % % \begin{quote} @@ -178,7 +186,7 @@ % |page.com|, which shows\ldots % \end{quote} % -% Here comes the doubt: the author is pointing to |http://internet-page.com| or +% Here comes the doubt: The author is pointing to |http://internet-page.com| or % to |http://internetpage.com|? The \pkg{breakurl} package \emph{never} adds a % hyphen when a link is broken across lines --- so, the first choice would be % the right one ---, but we can't assume that the reader knows this rule; so, I @@ -228,9 +236,9 @@ % As stated in the introduction, the \pkg{breakurl} is designed for those % compiling documents via \LaTeX{}, not pdf\LaTeX. In the latter case, the % package doesn't (re)define the |\url| command: it only defines |\burl| to be -% a synonym of whatever |\url| is defined (e.g., via |url| or \pkg{hyperref} -% packages). Of course, |\burl| may behave differently compared to -% (non-pdf)\LaTeX, because then the system will use other rules to make line +% a synonym of whatever |\url| is defined (e.g., via \pkg{url} or +% \pkg{hyperref} packages). Of course, |\burl| may behave differently compared +% to (non-pdf)\LaTeX, because then the system will use other rules to make line % breaks, spacing, etc. % % Also, this package was not designed to nor tested against other drivers: it's @@ -243,6 +251,8 @@ % % \begin{description} % +% \item[v1.30] Breaks are now allowed before percent sign (|%|). +% % \item[v1.23] |\hypersetup| now works anywhere. % % \item[v1.22] Corrected blank lines appearing inside tables. @@ -257,8 +267,8 @@ % \item[v1.10] A new command, |\burlalt| (and the synonym |\urlalt|), allows % one to specify different values for actual and displayed link. % -% \item[v1.01] Fixed a bug that was happening when a link is split into more -% than one page. +% \item[v1.01] Fixed a bug that was happening when a link is split across +% pages. % % \item[v1.00] The |\UrlLeft| and |\UrlRight| (defined and explained in the % |url| package) are now partially supported. By ``partially'' I mean: @@ -323,15 +333,17 @@ % so it may be ignored even when URLs aren't used. Check the following % paragraph: % +% \fussy +% % Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin % zzzzzzzzzzzzzzzzzzzzzzz\ldots % +% \sloppy +% % To overcome this (and make right margins a hard limit) use the command % |\sloppy|, preferably before |\begin{document}|. This makes the previous % paragraph look like: % -% \sloppy -% % Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin % zzzzzzzzzzzzzzzzzzzzzzz\ldots % @@ -344,11 +356,11 @@ % % Thanks to Hendri Adriaens, Donald Arseneau, Michael Friendly, Morten Høgholm, % David Le Kim, Damian Menscher, Tristan Miller, Heiko Oberdiek, Christoph -% Schiller, Xiaotian Sun, Michael Toews, David Tulloh, Adrian Vogel, and -% Jinsong Zhao for suggestions, bug reports, comments, and corrections. A +% Schiller, Xiaotian Sun, Michael Toews, David Tulloh, Adrian Vogel, Yu Zhang, +% and Jinsong Zhao 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. +% constant effort to help thousands of people in the beautiful world of \TeX{} +% and \LaTeX. % % % \section{Source code} @@ -415,47 +427,46 @@ \newtoks\burl@toks % \end{macrocode} -% \DescribeMacro{\burl@charlist} +% \DescribeMacro{\burl@charlistbefore} +% \DescribeMacro{\burl@charlistafter} % \DescribeMacro{\burl@defifstructure} % The following support routines are designed to build the conditional % structure that is the kernel of |\burl|: comparing each incoming character % with the list of ``breakable'' characters and taking decisions on that. This % conditional structure is built by |\burl@defifstructure| --- which is called % only at the end of package loading, because the character list (stored in -% |\burl@charlist|) can be modified by the |hyphenbreaks| option. +% |\burl@charlistbefore|) can be modified by the |hyphenbreaks| option. % % \begin{macrocode} -\def\burl@charlist{} -\def\burl@addtocharlist#1{% - \expandafter\gdef\expandafter\burl@charlist\expandafter{% - \burl@charlist #1}% -} +\let\burl@charlistbefore\empty +\let\burl@charlistafter\empty + +\def\burl@addtocharlistbefore{\g@addto@macro\burl@charlistbefore} +\def\burl@addtocharlistafter{\g@addto@macro\burl@charlistafter} \bgroup -\catcode`\&=12\relax -\hyper@normalise\burl@addtocharlist{:/.?#&_,;!} + \catcode`\&=12\relax + \hyper@normalise\burl@addtocharlistbefore{%} + \hyper@normalise\burl@addtocharlistafter{:/.?#&_,;!} \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@growmif#1#2{% + \g@addto@macro\burl@mif{\def\burl@ttt{#1}\ifx\burl@ttt\@nextchar#2\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}% + \g@addto@macro\burl@mfi{\fi}% } \def\burl@defifstructure{% - \def\burl@mif{}% - \def\burl@mfi{}% + \let\burl@mif\empty + \let\burl@mfi\empty \expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=% - \burl@charlist\do{% - \expandafter\burl@growmif\@nextchar + \burl@charlistbefore\do{% + \expandafter\burl@growmif\@nextchar\@burl@breakbeforetrue + \burl@growmfi + }% + \expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=% + \burl@charlistafter\do{% + \expandafter\burl@growmif\@nextchar\@burl@breakaftertrue \burl@growmfi }% } @@ -483,9 +494,12 @@ } \DeclareOptionX{preserveurlmacro}{\@preserveurlmacrotrue} -\DeclareOptionX{hyphenbreaks}{\bgroup - \catcode`\&=12\relax\hyper@normalise\burl@addtocharlist{-}% - \egroup} +\DeclareOptionX{hyphenbreaks}{% + \bgroup + \catcode`\&=12\relax + \hyper@normalise\burl@addtocharlistafter{-}% + \egroup +} \DeclareOptionX{vertfit}[local]{\burl@setvertfit{#1}} \ProcessOptionsX\relax @@ -571,7 +585,9 @@ % text to be displayed). Again, both are used by |\burl@doit|. % % \begin{macrocode} -\newif\if@burl@breakable +\newif\if@burl@breakbefore +\newif\if@burl@breakafter +\newif\if@burl@prevbreakafter \bgroup \catcode`\&=12\relax @@ -608,20 +624,36 @@ % \begin{macrocode} \gdef\burl@doit{% \burl@toks{}% - \let\burl@UrlRight=\UrlRight - \let\UrlRight=\empty + \let\burl@UrlRight\UrlRight + \let\UrlRight\empty + \@burl@prevbreakafterfalse \@ifundefined{@urlcolor}{\Hy@colorlink\@linkcolor}{\Hy@colorlink\@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}% + \if@burl@breakafter\@burl@prevbreakaftertrue + \else\@burl@prevbreakafterfalse\fi + \@burl@breakbeforefalse + \@burl@breakafterfalse + \expandafter\burl@mif\burl@mfi + \if@burl@breakbefore + % Breakable if the current char is in the `can break before' list + \burl@flush\linebreak[0]% + \else + \if@burl@prevbreakafter + \if@burl@breakafter\else + % Breakable if the current char is not in any of the `can break' + % lists, but the previous is in the `can break after' list. + % This mechanism accounts for sequences of `break after' characters, + % where a break is allowed only after the last one + \burl@flush\linebreak[0]% + \fi + \fi \fi + \expandafter\expandafter\expandafter\burl@toks + \expandafter\expandafter\expandafter{% + \expandafter\the\expandafter\burl@toks\@nextchar}% }% - \let\UrlRight=\burl@UrlRight + \let\UrlRight\burl@UrlRight \burl@flush \literalps@out{BU.E}% \Hy@endcolorlink @@ -642,7 +674,7 @@ \literalps@out{/BU.L (\burl@url) def}% \hyper@linkurl{\expandafter\Hurl\expandafter{\burl@toks@def}}{\burl@url}% \global\burl@toks{}% - \let\UrlLeft=\empty + \let\UrlLeft\empty }% % \end{macrocode} @@ -759,9 +791,9 @@ % \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.) +% handle links that are split across pages. (|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 { diff --git a/Master/texmf-dist/tex/latex/breakurl/breakurl.sty b/Master/texmf-dist/tex/latex/breakurl/breakurl.sty index 994b069c0e7..0bf5b06e8fe 100644 --- a/Master/texmf-dist/tex/latex/breakurl/breakurl.sty +++ b/Master/texmf-dist/tex/latex/breakurl/breakurl.sty @@ -29,7 +29,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{breakurl} - [2008/07/15 v1.23 Breakable hyperref URLs] + [2009/01/24 v1.30 Breakable hyperref URLs] \RequirePackage{xkeyval} @@ -66,37 +66,35 @@ \newtoks\burl@toks -\def\burl@charlist{} -\def\burl@addtocharlist#1{% - \expandafter\gdef\expandafter\burl@charlist\expandafter{% - \burl@charlist #1}% -} +\let\burl@charlistbefore\empty +\let\burl@charlistafter\empty + +\def\burl@addtocharlistbefore{\g@addto@macro\burl@charlistbefore} +\def\burl@addtocharlistafter{\g@addto@macro\burl@charlistafter} \bgroup -\catcode`\&=12\relax -\hyper@normalise\burl@addtocharlist{:/.?#&_,;!} + \catcode`\&=12\relax + \hyper@normalise\burl@addtocharlistbefore{%} + \hyper@normalise\burl@addtocharlistafter{:/.?#&_,;!} \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@growmif#1#2{% + \g@addto@macro\burl@mif{\def\burl@ttt{#1}\ifx\burl@ttt\@nextchar#2\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}% + \g@addto@macro\burl@mfi{\fi}% } \def\burl@defifstructure{% - \def\burl@mif{}% - \def\burl@mfi{}% + \let\burl@mif\empty + \let\burl@mfi\empty \expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=% - \burl@charlist\do{% - \expandafter\burl@growmif\@nextchar + \burl@charlistbefore\do{% + \expandafter\burl@growmif\@nextchar\@burl@breakbeforetrue + \burl@growmfi + }% + \expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=% + \burl@charlistafter\do{% + \expandafter\burl@growmif\@nextchar\@burl@breakaftertrue \burl@growmfi }% } @@ -120,9 +118,12 @@ } \DeclareOptionX{preserveurlmacro}{\@preserveurlmacrotrue} -\DeclareOptionX{hyphenbreaks}{\bgroup - \catcode`\&=12\relax\hyper@normalise\burl@addtocharlist{-}% - \egroup} +\DeclareOptionX{hyphenbreaks}{% + \bgroup + \catcode`\&=12\relax + \hyper@normalise\burl@addtocharlistafter{-}% + \egroup +} \DeclareOptionX{vertfit}[local]{\burl@setvertfit{#1}} \ProcessOptionsX\relax @@ -177,7 +178,9 @@ \hyper@normalise\burl@alt } -\newif\if@burl@breakable +\newif\if@burl@breakbefore +\newif\if@burl@breakafter +\newif\if@burl@prevbreakafter \bgroup \catcode`\&=12\relax @@ -198,20 +201,36 @@ \gdef\burl@doit{% \burl@toks{}% - \let\burl@UrlRight=\UrlRight - \let\UrlRight=\empty + \let\burl@UrlRight\UrlRight + \let\UrlRight\empty + \@burl@prevbreakafterfalse \@ifundefined{@urlcolor}{\Hy@colorlink\@linkcolor}{\Hy@colorlink\@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}% + \if@burl@breakafter\@burl@prevbreakaftertrue + \else\@burl@prevbreakafterfalse\fi + \@burl@breakbeforefalse + \@burl@breakafterfalse + \expandafter\burl@mif\burl@mfi + \if@burl@breakbefore + % Breakable if the current char is in the `can break before' list + \burl@flush\linebreak[0]% + \else + \if@burl@prevbreakafter + \if@burl@breakafter\else + % Breakable if the current char is not in any of the `can break' + % lists, but the previous is in the `can break after' list. + % This mechanism accounts for sequences of `break after' characters, + % where a break is allowed only after the last one + \burl@flush\linebreak[0]% + \fi + \fi \fi + \expandafter\expandafter\expandafter\burl@toks + \expandafter\expandafter\expandafter{% + \expandafter\the\expandafter\burl@toks\@nextchar}% }% - \let\UrlRight=\burl@UrlRight + \let\UrlRight\burl@UrlRight \burl@flush \literalps@out{BU.E}% \Hy@endcolorlink @@ -226,7 +245,7 @@ \literalps@out{/BU.L (\burl@url) def}% \hyper@linkurl{\expandafter\Hurl\expandafter{\burl@toks@def}}{\burl@url}% \global\burl@toks{}% - \let\UrlLeft=\empty + \let\UrlLeft\empty }% \if@preserveurlmacro\else\let\url\burl\let\urlalt\burlalt\fi -- cgit v1.2.3