# How to use \url in sloppypar to make url into multi-lines?

I met a problem about how to make the long link into a multi-lines one.

The following is LaTeX code:

\documentclass[11pt]{article}

\PassOptionsToPackage{hyphens}{url}

\begin{document}
\section{example}

test \footnote{photo from：Ferroelectrics-Physical-Effects,M.Lallart,2011,InTech, \\ \url{http://www.intechopen.com/books/ferroelectrics-physical-effects/photo-induced-effect-in-quantum-paraelectric-materials-studied-by-transient-birefringence-measuremen} }：

\end{document}


I referred to the suggestions of this Forcing linebreaks in \url But I still could not make \url work in sloppypar. That means when I delete \url{content} only put "content" in sloppypar it will work but I need \url to highlight or distinguish the url link.

How can I realize this?

I use XeLaTeX.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The problem have been solved. Thank you @Herbert You really give me a lot of help.

I should change the \PassOptionsToPackage{hyphens}{url} to \usepackage[hyphens]{url} and that will works :

I guess I have used the wrong code to Pass Option.

-

As Werner already mentioned use the hyphens option and for the footnote do not use the sloppypar environment:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[hyphens]{url}

\begin{document}

foo\footnote{%
Toshiro Kohmoto and Yuka Koyama (2011). Photo-induced Effect in Quantum    Paraelectric Materials Studied by Transient Birefringence Measurement,
Ferroelectrics~--~Physical Effects, Dr. Mickal Lallart (Ed.), ISBN: 978-953-307-453-5, InTech, DOI: 10.5772/17132. Available from:
\url{http://www.intechopen.com/books/ferroelectrics-physical-effects/photo-induced-effect-in-quantum-paraelectric-materials-studied-by-transient-birefringence-measuremen}}

\end{document}


-
thank you for your answer. I follow your suggestion but it still does not work. the effect is like this :weibolink in my weibo(sorry I could not upload image in tex.stackexchage.com). I use '\RequirePackage[colorlinks,citecolor=black,linkcolor=black]{hyperref} ' and '\PassOptionsToPackage{hyphens}{url}' to include my url. –  sikisis May 23 '13 at 6:32
please provide a complete example code in your question. –  Herbert May 23 '13 at 6:36
give all the code? I am using someone's template to finish my bachelor thesis. Put all these up? –  sikisis May 23 '13 at 6:43
no, only the code with hyperref, url and one word and the footnote –  Herbert May 23 '13 at 6:45
Thank you for your kind advice! @texenthusiast I will take care of it. –  sikisis May 23 '13 at 7:10

As stated in the url package documentation:

Package Option: hyphens
Ordinarily, breaks are not allowed after “-” characters because this leads to confusion. (Is the “-” part of the address or just a hyphen?) The package option “[hyphens]” allows breaks after explicit hyphen characters. The \url command will never ever hyphenate words.

This is exactly the problem with your URL. Using the hyphens package options allows it to break at -:

\documentclass{article}
\usepackage[hyphens]{url}% http://ctan.org/pkg/url
...

-