There are several questions on this site (for example here and here) where people are struggling with overfill hboxes when making clickable URLs. I have read and tried the answers there and none of them seem to work for me, so I thought I would ask a new question.
Here's a minimal example of my problem:
\documentclass[english]{amsart}
\usepackage[bookmarksopen,bookmarksdepth=2,breaklinks=true]{hyperref}
\usepackage[anythingbreaks]{breakurl}
\begin{document}
Here's a longish sentence so I can just keep track of where the
end of the page is as far as normal line breaks are concerned.
However, Blah de blah de blah de blah
blah ~\href{https://blahblaaaaaaaaaaaaaaa.aaaaaaaaa.com/xxxx/xx/xx/blaaah-bl-blaaaah-bla/}{https://blahblaaaaaaaaaaaaaaa.aaaaaaaaa.com/xxxx/xx/xx/blaaah-bl-blaaaah-bla/} an argument which shows that\ldots
\end{document}
I have a sentence with pretty much this syntax/length in a paper I'm writing (including the URL which is the same length as the one I'm quoting and has slashes, hyphens, full stops in the same place). When I run the above through pdflatex I get an overfill hbox and this:
I don't care where that URL breaks, but I am reluctant to just break it myself because this paper has been accepted by a journal and they might well play with the margins etc and end up re-breaking something if I fix it in an ad hoc manner.
I had thought that breakurl, especially with its relatively new anythingbreaks option, would just break the URL to fit it on the page. As you can see, it hasn't done so.
Here are the things I've tried:
Adding
\usepackage[hyphens]{url}in various places.Discovering that
breakurlwill only break URLs after one of:/.?#&_,;!(but there's a . in the URL (the first one) after which it would be a perfect place to break the URL)Using
\sloppy(changed nothing)\def\UrlBreaks{\do\/\do-\do.}(changed nothing)
I guess what I want in this case is the break after blahblaaaaaaaaaaaaaaa. I do not understand why I cannot persuade the URL to break here. Can anyone help?
To make matters worse, when my coauthor uploaded the paper to ArXiv, ArXiv choked on the TeX, possibly because it didn't have the most recent breakurl so choked on [anythingbreaks], and possibly because it was complaining about an options clash with hyperref. However this problem might go away once I've broken this URL.



breaklinkstherefore I'm cluesless as when to use it. Usually theurlwith[hyphens]orhyperrefworks fine for me. – naphaneal Mar 14 '16 at 11:24hyperref-manual, breaklinks is automatically set by the driver. A manual override as you have tried result in the experienced behaviour. – naphaneal Mar 14 '16 at 11:40\href, your example has a long link but a short alternative text. I was looking for a way to line-break the alternative text, i.e., the second argument to\href. Is that possible? – dow Mar 21 '19 at 02:38\hrefis not supposed to be used with large masking labels. usually, you use short labels. having said that, my guess is it should be working with larger labels as well, assuming it doesn't exceed the character limit, so far one is applied. I don't know, what this limit is, though. – naphaneal Mar 21 '19 at 15:21