Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wrap url problem

134 views
Skip to first unread message

Alan G Isaac

unread,
Sep 30, 2009, 1:37:22 PM9/30/09
to
From the FAQ http://www.tex.ac.uk/cgi-bin/texfaq2html?label=setURL
I thought

\usepackage[dvips,breaklinks=true]{hyperref}

should give me nice wrapping of urls,
if I use \url,
but it does not if I go

.tex (latex)-> .dvi (dvips)-> .ps (ps2pdf)-> pdf

Is there a way to get proper wrapping?

Thanks,
Alan Isaac

PS pdflatex does give proper wrapping; that is not
my question.

Herbert Voss

unread,
Sep 30, 2009, 2:09:40 PM9/30/09
to
Alan G Isaac schrieb:

> From the FAQ http://www.tex.ac.uk/cgi-bin/texfaq2html?label=setURL
> I thought
>
> \usepackage[dvips,breaklinks=true]{hyperref}
\usepackage{breakurl}

Herbert

Robin Fairbairns

unread,
Sep 30, 2009, 2:16:10 PM9/30/09
to
Alan G Isaac <alan....@gmail.com> writes:
> From the FAQ http://www.tex.ac.uk/cgi-bin/texfaq2html?label=setURL
>I thought
>
>\usepackage[dvips,breaklinks=true]{hyperref}
>
>should give me nice wrapping of urls,
>if I use \url,
>but it does not if I go
>
>.tex (latex)-> .dvi (dvips)-> .ps (ps2pdf)-> pdf
>
>Is there a way to get proper wrapping?
>
>PS pdflatex does give proper wrapping; that is not
>my question.

yup; pdflatex has engine support for wrapping (that breaklinks option
only really applies to pdflatex, afaik).

the breakurl package is for _your_ problem. i've never used it
myself, so can't really vouch for it, but the faq answer i wrote, at
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=breaklinks
came from information from someone who _does_ know ;-)

note, that answer is in the faq section "why does it _do_ that?" --
you're not alone in being confused by this...
--
Robin Fairbairns, Cambridge

Alan G Isaac

unread,
Sep 30, 2009, 3:00:33 PM9/30/09
to
On 9/30/2009 2:09 PM, Herbert Voss wrote:
> \usepackage{breakurl}

OK, that works well for \url,
but not for \nolinkurl. Odd?
(I thought \url was an \href
and a \nolinkurl.)

Alan Isaac

Donald Arseneau

unread,
Sep 30, 2009, 6:17:36 PM9/30/09
to
On Sep 30, 12:00 pm, Alan G Isaac <alan.is...@gmail.com> wrote:
> On 9/30/2009 2:09 PM, Herbert Voss wrote:
>
> > \usepackage{breakurl}
>
> OK, that works well for \url,
> but not for \nolinkurl. Odd?

It is very odd. Not that the package doesn't affect \nolinkurl
(it wouldn't) but that \nolinkurl has no linebreaks in either case,
with or without the breakurl package. What is the url in
question?

Donald Arseneau

Alan G Isaac

unread,
Sep 30, 2009, 10:14:04 PM9/30/09
to
>> On 9/30/2009 2:09 PM, Herbert Voss wrote:
>>> \usepackage{breakurl}


> On Sep 30, 12:00 pm, Alan G Isaac<alan.is...@gmail.com> wrote:
>> OK, that works well for \url,
>> but not for \nolinkurl. Odd?


On 9/30/2009 6:17 PM, Donald Arseneau wrote:
> It is very odd. Not that the package doesn't affect \nolinkurl
> (it wouldn't) but that \nolinkurl has no linebreaks in either case,
> with or without the breakurl package. What is the url in
> question?


See below.
Thanks,
Alan

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{hyperref,breakurl}
\begin{document}

Fails horribly: (fill words to force wrapping) \href{http://somewhere/out/there/way/off/the/normal/length}{http://somewhere/out/there/way/off/the/normal/length}

Next, use url: (fill words to force wrapping)
\url{http://somewhere/out/there/way/off/the/normal/length}
Works beautifully.

Next use href and nolinkurl: (fill words to force wrapping)
\href{http://somewhere/out/there/way/off/the/normal/length}{\nolinkurl{http://somewhere/out/there/way/off/the/normal/length}}
This works beautifully in pdflatex, but not via dvi.

\end{document}

Donald Arseneau

unread,
Oct 1, 2009, 3:21:59 PM10/1/09
to
On Sep 30, 7:14 pm, Alan G Isaac <alan.is...@gmail.com> wrote:
> >> On 9/30/2009 2:09 PM, Herbert Voss wrote:
> >> but not for \nolinkurl. Odd?
>
> On 9/30/2009 6:17 PM, Donald Arseneau wrote:
>
> > It is very odd. Not that the package doesn't affect \nolinkurl
> > (it wouldn't) but that \nolinkurl has no linebreaks in either case,
> > with or without the breakurl package. What is the url in
> > question?

> Next use href and nolinkurl: (fill words to force wrapping)
> \href{http://somewhere/out/there/way/off/the/normal/length}%


> {\nolinkurl{http://somewhere/out/there/way/off/the/normal/length}}
> This works beautifully in pdflatex, but not via dvi.

It is \href that doesn't break. \nolinkurl should allow breaks when
used by itself. The \href{foo}{\nolinkurl{foo}} is just long-hand for
\url{foo} (which explains why \url{foo} does bot break -- it is the
internal \href).

Donald Arseneau as...@triumf.ca


Alan G Isaac

unread,
Oct 2, 2009, 6:20:25 PM10/2/09
to
On 10/1/2009 3:21 PM, Donald Arseneau wrote:
> The \href{foo}{\nolinkurl{foo}} is just long-hand for
> \url{foo}

That's what I used to think ...


> (which explains why \url{foo} does bot break -- it is the
> internal \href).

But \url wraps nicely even with latex (-> .dvi),
while the combination does NOT. Try it.
(See below.)

Alan Isaac

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{hyperref,breakurl}
\begin{document}

Illustration of a difference between \verb|\url| and the \verb|\href| \verb|\nolinkurl| c
ombination ...

These are the same with pdflatex but give \emph{different} results if we
use latex

Next, use url: (fill words to force wrapping)
\url{http://somewhere/out/there/way/off/the/normal/length}
Works beautifully.

Next use href and nolinkurl: (fill words to force wrapping)
\href{http://somewhere/out/there/way/off/the/normal/length}{\nolinkurl{http://somewhere/out/there/way/off/the/normal/length}}
This works beautifully in pdflatex, but NOT via dvi.
The results are different!

\end{document}


Donald Arseneau

unread,
Oct 2, 2009, 7:17:25 PM10/2/09
to
On Oct 2, 3:20 pm, Alan G Isaac <alan.is...@gmail.com> wrote:
> On 10/1/2009 3:21 PM, Donald Arseneau wrote:
>
> > The \href{foo}{\nolinkurl{foo}} is just long-hand for
> > \url{foo}
>
> That's what I used to think ...
>
> > (which explains why \url{foo} does bot break -- it is the
> > internal \href).
>
> But \url wraps nicely even with latex (-> .dvi),

The breakurl package redefines \url again to make multiple \href
commands, allowing line-breaks between them.

> while the combination does NOT. Try it.
> (See below.)

Your example does not contain the simple test:

\href{http://somewhere/out/there/way/off/the/normal/length}%
{simple text that should be easy to break between words}

Donald Arseneau

0 new messages