I am trying to include long URLs in a bibliography, but those often overflow into the margin of the document.
I have seen a number of questions about breaking URLs in bibliography, but after trying every solution, I have not found anything that completely solves my problem. There are apparently a number of ways to allow LaTeX to break line at different places in URLs. But in my case, even though LaTeX breaks line at some places, I still get overflow for some URLs.
Here is the code I am using:
\usepackage[hyphens]{url}
\usepackage{hyperref}
\hypersetup{breaklinks=true}
\urlstyle{same}
\usepackage{cite}
and with these bibliography entries:
@misc(webrtc,
organization={W3C WebRTC Working Group},
title={WebRTC 1.0: Real-time Communication Between Browsers},
howpublished={\url{http://www.w3.org/TR/2012/WD-webrtc-20120821/}}
)
@misc(android_javascriptinterface,
organization={Android Open Source project},
title={Android WebView addJavascriptInterface reference},
howpublished={\url{http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String)}}
)
I'm getting this, for example:
The entry about Android overflows in the border: my column should end where you can read "browsers." on the first line or "http:" on the third line.
Edit: when trying to create a minimal example for my problem, I noticed that this only occurs when using the IEICE template file. You can find it here: http://www.ieice.org/ftp/tex/ieice/LaTeX2e/, but if you do not want to have to extract the archive and locate the correct file, I have put it there also: http://pastebin.com/BKi2cyMQ
Here is my minimal example:
.tex file:
\documentclass[paper]{ieice}
\usepackage[hyphens]{url}
\usepackage[hidelinks]{hyperref}
\hypersetup{breaklinks=true}
\urlstyle{same}
\usepackage{cite}
\title{Test document}
\begin{document}
this\cite{upnp_spec} is a test\cite{android_javascriptinterface}
\bibliographystyle{plain}
\bibliography{refs_min}
\end{document}
and refs_min.bib file:
@misc(android_javascriptinterface,
organization={Android Open Source project},
title={Android WebView addJavascriptInterface reference},
howpublished={\url{http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String)}}
)
@misc(upnp_spec,
organization = {UPnP Forum},
title = {UPnP Device Architecture 1.1},
howpublished = {\url{http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf}}
)
Is there any way I can fix this ?