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

url.sty question: how to allow breaks only *after* punctuation?

2,346 views
Skip to first unread message

Lee Rudolph

unread,
May 22, 2012, 6:03:22 PM5/22/12
to
My documentclass is memoir. I am using bibtex, natbib,
and apacite (the latter is unnatural to me, but this book
is supposed to be APA-friendly). My publisher informs me
that in their house style URLs may only contain breaks
*after* punctuation (my understanding of APA rules is
that a break could appear on either side of punctuation,
but apparently that's not satisfactory to my publisher).

If achieving this is a solved problem, I'd be grateful
for a pointer to the solution; if it's a solvable problem,
but the solution is going to involve my having to achieve
a good understanding of the interior workings of url.sty,
I'd be *very* grateful if someone would reduce the problem
to the previous case. (My quick reading of Donald Arseneau's
documentation in url.sty didn't suggest an answer that would
be easy for me...but again, if I missed it, I'd love to have
that pointed out.)

If it's unsolvable, I guess I'll just make changes by hand
in all the bbl files (one for each chapter) but I'd really,
really rather not do that.

Changing the publisher's house style is probably not an option.

Lee Rudolph

Scott Pakin

unread,
Jun 6, 2012, 10:16:47 PM6/6/12
to
On 05/22/2012 04:03 PM, Lee Rudolph wrote:
> My documentclass is memoir. I am using bibtex, natbib,
> and apacite (the latter is unnatural to me, but this book
> is supposed to be APA-friendly). My publisher informs me
> that in their house style URLs may only contain breaks
> *after* punctuation (my understanding of APA rules is
> that a break could appear on either side of punctuation,
> but apparently that's not satisfactory to my publisher).

Are you sure your URLs are actually appearing within the url package's
\url{...} macro? Take a look at your document's .bbl file to confirm.
My understanding is that the url package's default behavior is not to
break URLs except after punctuation. Here are the relevant
definitions from url.sty:

\def\UrlBreaks{\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]%
\do\)\do\,\do\?\do\'\do+\do\=\do\#}%
\def\UrlBigBreaks{\do\:\do@url@hyp}%
\def\UrlNoBreaks{\do\(\do\[\do\{\do\<}%

Documentation is towards the bottom of url.sty under the heading
"Changing linebreaks," but basically, URLs can break after the
punctuation listed in \UrlBreaks (".", "@", "\", "!", "_", "|", etc.)
and \UrlBigBreaks (":" and "-"), but not \UrlNoBreaks ("(", "[", "{",
and "<"). I don't believe that the url package will break elsewhere,
but feel free to prove me wrong with a (self-contained) example.

In my documents, I tend to disallow breaks except after slashes by
putting the following in my document's preamble:

\def\UrlBreaks{}
\def\UrlBigBreaks{\do\/\do-}

-- Scott
0 new messages