# removing a space in bibitem with url

I need help with this spacing problem in 'thebibliography' environment. I have got a long url, which I need to put on a single line, but if I put some words before that, it creates a huge spaces between the words and the url. The problem seems to disappear after I remove '//' or '\newline' to create a new line.

How should I solve this problem within this environment? Thanks a lot!!

\documentclass{article}
\usepackage{hyperref}

\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{vietnam}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
%these packages are not important

\begin{document}

\begin{thebibliography}{12}{}

\bibitem{1}Hà Duy Nghĩa \\
Dostupné z :\url{http://www.mathvn.com/2012/08/ung-dung-ly-thuyet-ong-du-trong-cac-bai.html}

\end{thebibliography}
\end{document}


You should load the hyperref package last rather than first, and you should also load the url package with the option hyphens, to allow line-breaks at any - characters inside the URL string.

A separate issue: use \par rather than \\ to generate a line break inside the \bibitem block.

\documentclass{article}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{vietnam}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}

\usepackage[hyphens]{url}
\usepackage{hyperref} % load this package *last*, not first

\begin{document}

\begin{thebibliography}{12}

\bibitem{1}Hà Duy Nghĩa
Dostupné z :\par\url{http://www.mathvn.com/2012/08/ung-dung-ly-thuyet-ong-du-trong-cac-bai.html}

\end{thebibliography}
\end{document}

• Thanks a lot! It worked perfectly for this example, but why when I put this link (promys.org/sites/promys.org/files/assets/Problems\%202015.pdf) the same problem will arise again? – The Minh Tran Mar 23 '17 at 21:00
• @TheMinhTran - The link appears to be broken. Please re-post. Or, just edit your original posting to show the code you're really trying to get typeset properly. – Mico Mar 23 '17 at 21:15
• I am sorry: [link] (promys.org/sites/promys.org/files/assets/Problems%202015.pdf) – The Minh Tran Mar 23 '17 at 21:19
• @TheMinhTran - The link you provided now points to a 3-page text file with no bibliography, and no bad line breaks. What am I supposed to be looking for? – Mico Mar 23 '17 at 21:30
• yeah, what I meant was that if I replace this link with the link I used before, the same problem as the one in the picture will arise again.. – The Minh Tran Mar 23 '17 at 21:33