I have an huge url consisting mostly of letters. I found Marco's answer to a url breaking question, and using
\g@addto@macro{\UrlBreaks}{\UrlOrds}
and
\g@addto@macro{\UrlBreaks}{%
\do\/\do\a\do\b\do\c\do\d\do\e\do\f%
\do\g\do\h\do\i\do\j\do\k\do\l\do\m%
\do\n\do\o\do\p\do\q\do\r\do\s\do\t%
\do\u\do\v\do\w\do\x\do\y\do\z%
\do\A\do\B\do\C\do\D\do\E\do\F\do\G%
\do\H\do\I\do\J\do\K\do\L\do\M\do\N%
\do\O\do\P\do\Q\do\R\do\S\do\T\do\U%
\do\V\do\W\do\X\do\Y\do\Z}
in the preamble allowed my url to break at a letter. However, now all the urls split on a letter. So, the question is, can I selectively enable it for certain urls?
I tried setting the default \def\UrlBreaks
after the url in question, but it had no effect.
MWE follows. How can I selectively split the first url, but not the second? The current version splits both.
\documentclass[12pt]{article}
\usepackage[hyphens]{url}
\usepackage[T1]{fontenc}
\usepackage{fouriernc}
\makeatletter
\g@addto@macro{\UrlBreaks}{\UrlOrds}
\g@addto@macro{\UrlBreaks}{%
\do\/\do\a\do\b\do\c\do\d\do\e\do\f%
\do\g\do\h\do\i\do\j\do\k\do\l\do\m%
\do\n\do\o\do\p\do\q\do\r\do\s\do\t%
\do\u\do\v\do\w\do\x\do\y\do\z%
\do\A\do\B\do\C\do\D\do\E\do\F\do\G%
\do\H\do\I\do\J\do\K\do\L\do\M\do\N%
\do\O\do\P\do\Q\do\R\do\S\do\T\do\U%
\do\V\do\W\do\X\do\Y\do\Z}
\makeatother
\begin{document}
This is a \url{http://reallyreallyreallyreallyreallyreallyreallyreallyreallyreallylongurl} which
\LaTeX\ will be unhappy about. So, how can we split this in the best way?
Here is another one which I don't want to split,
\url{http://notquitesolongastheotheroneurl}.
\end{document}
\g@addto@macro
which as theg
indicates is a global definition). You've been here long enough to know you don't need to ask the implied question in the last line:-) – David Carlisle Jun 16 '15 at 8:21{\def\UrlBreaks{...}\url{someUrl}}
– Johannes_B Jun 17 '15 at 9:38