# \textit makes link incorrect

I want to make a reference in my thesis work and I want to make a link to a source using \textit

\begin{thebibliography}{9}
\bibitem{hinton}
Jeffrey Hinton(2012)
\textit{Neural Networks for Machine Learning}
[\textit{Lecture 3.4 — The backpropagation algorithm}]
\\\textit{https://github.com/mebusy/notes/blob/master/dev_notes/NeuralNetworks.md}
\end{thebibliography}


But it transformes https://github.com/mebusy/notes/blob/master/dev_notes/NeuralNetworks.md link(which is correct) to this one https://github.com/mebusy/notes/blob/master/devnotes=NeuralNetworks:md (which is incorrect. How can I fix it?

EDIT: I added \url, but then he link doesn't work:

\bibitem{hinton}
Jeffrey Hinton(2012)
\textit{Neural Networks for Machine Learning}
[\textit{Lecture 3.4 — The backpropagation algorithm}]
\\\textit{\url https://github.com/mebusy/notes/blob/master/dev_notes/NeuralNetworks.md}

• Links should be typeset with url's/hyperref's \url command. If you insist on writing URLs in italic, set \urlstyle{same} and put an \textit around it (see tex.stackexchange.com/q/53962/35864) – moewe Jun 13 '18 at 20:24
• @moewe I updated the post. Please have a look – Daniel Yefimov Jun 13 '18 at 20:27
• \url is not a switch. It takes the URL as an argument (between curly braces): \textit{\url{https://github.com/mebusy/notes/blob/master/dev_notes/NeuralNetworks.md}} – moewe Jun 13 '18 at 20:28

Here's how I would rework your setup. It's basically identical to what @moewe suggests in earlier comments. Note that it's important to load both the url and the hyperref package.

\documentclass{article}
\usepackage{geometry}
\usepackage[hyphens,spaces]{url}
\urlstyle{same}
\usepackage[colorlinks,urlcolor=blue]{hyperref} % choose a suitable color for URLs
\begin{document}

\begin{thebibliography}{9}

\bibitem{hinton}
Jeffrey Hinton (2012)
\textit{Neural Networks for Machine Learning.
Lecture 3.4---The backpropagation algorithm} \\
\textit{\url{https://github.com/mebusy/notes/blob/master/dev_notes/NeuralNetworks.md}}

\end{thebibliography}
\end{document}


Incidentally, the reason

\textit{\url https:... }


doesn't work is that \url expects to get a braces-delimited argument. Because you fail to provide these braces, the argument of \url ends up being the single letter h, not the entire URL string.

• That space in Jeffrey Hinton (2012) was much needed. And the Unicode em-dash in Lecture 3.4 — The also made me cringe... (although that might just be old habits) – moewe Jun 13 '18 at 20:47