GeneralPrevent Line Break at certain Place in URL

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Fibonacci
Posts: 37
Joined: Tue Jan 25, 2011 1:16 am

Prevent Line Break at certain Place in URL

Post by Fibonacci »

Is it possible to prevent a linebreak at a certain point in a URL?

Say, for example, I have a document like this:

Code: Select all

\documentclass{article}
\usepackage{url}

\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan turpis ac est scelerisque dignissim. Sed vel lorem orci, et laoreet leo. \url{http://www.example.com/}
\end{document}
The break in the URL appears right after "http:", which I consider unacceptable.

To clarify, I'm just looking to prevent a line break at that particular point, not in the whole URL, so this for example would not be an acceptable solution:

Code: Select all

\documentclass{article}
\usepackage{url}

\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan turpis ac est scelerisque dignissim. Sed vel lorem orci, et laoreet leo. \mbox{\url{http://www.example.com/}}
\end{document}
Is there any way to just prevent the aforementioned line break, but allow others on the same URL?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply