How to break a long URL in bibliography, keeping the URL in plain text font?
URL strings can contain lots of characters that are "special" to TeX. Among them are _
(underscore), #
(hash), %
(percent), $
(dollar), &
(ampersand), etc. The point of encasing URL strings in \url
directives is to "neuter" the special meanings that these characters would otherwise possess.
I am preparing a paper for a journal which insists that URLs in bibliography need to be in plain text.
I assume that the ordinary text font (rather than some monospaced font) is meant by "plain text". This requirement does not mean that you mustn't use the url
package and \url
directives. All you need to do to adhere to the publisher's requirement is issue the instruction \urlstyle{same}
. The advantage of not "escaping" the special characters (by prefixing them with \
symbols) is that the URL strings remain untouched and hence can be used to form valid hyperlinks to the underlying documents.
\RequirePackage{filecontents}
\begin{filecontents}{mybib.bib}
@misc{epl,
title={Premier league clubs in international competition},
author="{Wikipedia}",
year={2016},
note="{Available at: \url{https://en.wikipedia.org/wiki/Premier_League#Premier_League_clubs_in_international_competition}, Accessed on December 26, 2016}",
}
\end{filecontents}
\documentclass{risa}
%\usepackage{natbib} %not really needed, is it?
\bibliographystyle{vancouver}
\usepackage{url}
\urlstyle{same} % <-- be sure to provide this instruction
\usepackage[colorlinks,citecolor=blue,urlcolor=black]{hyperref}
\begin{document}
\cite{epl}
\bibliography{mybib}
\end{document}
urlstyle{rm}
should be enough in most cases. See the example.
\documentclass{article}
\usepackage{url}
\begin{document}
\section{Introduction}
\begin{thebibliography}{1}
\bibitem{1}
\url{VeryVeryVeryVery.VeryVeryVeryVeryVery.VeryVeryVeryVery.VeryVeryVeryVeryVeryVeryVeryLongUrl}
\urlstyle{rm}
\bibitem{2}
\url{VeryVeryVeryVery.VeryVeryVeryVeryVery.VeryVeryVeryVery.VeryVeryVeryVeryVeryVeryVeryLongUrl}
\end{thebibliography}
\end{document}
Edit: According to Mico's suggestion, one additional explanation. The manual states:
The pre-defined styles are “tt”, “rm”, “sf” and “same” which all allow the same linebreaks but use di.erent fonts — the first three select a specific font and the “same” style uses the current text font.