# Bibliography in LaTeX: Spaces between words

I'm writing the bibliography. LaTeX don't write it well. I don't know why. I have tried the two methods: \begin{the bibliography} and using BiBTeX. The result is the same.

The result is longer spaces between some words.

Using the first method(without BibTeX). The first entry at the image is:

\bibitem{Stack1}


\tit{} is like \textit{}

I have written a small example:

\documentclass[12pt,a4paper]{book}

\usepackage[utf8]{inputenc}

\usepackage[left=1.8in,right=1.8in,top=0.6in,bottom=0.6in]{geometry}

\begin{document}

\begin{thebibliography}{99}

\bibitem{Dani}
Daniel García. \textit{Activando y desactivando el bluetooth en Android}. \url{http://danielggarcia.wordpress.com/2013/10/19/bluetooth-i-activando-y-desactivando-el-bluetooth-en-android/}.
\end{thebibliography}

\end{document}


And the result is

• Your hyperlinks/urls aren't broken down. If you are using package hyperref and the option breaklinks, or use package url. – Johannes_B Sep 9 '14 at 15:09
• In the screenshot you are citing stackoverflow a few times, but not a single time tex.stackexchange.com I hope this is just hidden on the next page ;-) – Johannes_B Sep 9 '14 at 15:12
• Johannes_B I don't understand your solution. I'm usign \url – Charles_Alb Sep 9 '14 at 16:10
• Ok, Kurt. I have added a small example and the result. – Charles_Alb Sep 9 '14 at 17:19
• \usepackage{etoolbox} \apptocmd{\UrlBreaks}{\do\-}{}{} You can read more about it in the documentation of package url – Johannes_B Sep 9 '14 at 20:09

Your URL string contains quite a few - (hyphen) characters, and it's quite long. By default, URL strings are not broken at hyphenation characters. To enable line breaking at the hyphens, load the url package with the option hyphens before loading hyperref.

\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[hmargin=1.8in,vmargin=0.6in]{geometry}

\usepackage[hyphens]{url}  %% be sure to specify the option 'hyphens'

\begin{document}
\begin{thebibliography}{99}
\bibitem{Dani}
Daniel García. \textit{Activando y desactivando el bluetooth en Android}.
\url{http://danielggarcia.wordpress.com/2013/10/19/bluetooth-i-activando-y-desactivando-el-bluetooth-en-android/}.
\end{thebibliography}
\end{document}


After loading hyperref with the breaklinks option, add the hyphen to the list of allowed break points by doing

\g@addto@macro\UrlBreaks{\do\-}


You can also relax the spacing of the bibliography by adding \raggedright before it. This aligns the following text in the current group flush left.

\documentclass{article}
\usepackage[utf8]{inputenc}
\makeatletter
\makeatother
\begin{document}
\begin{thebibliography}{99}
\bibitem{Dani}
Daniel García. \textit{Activando y desactivando el bluetooth en Android}. \url{http://danielggarcia.wordpress.com/2013/10/19/bluetooth-i-activando-y-desactivando-el-bluetooth-en-android/}.
\end{thebibliography}

\begingroup
\raggedright
\begin{thebibliography}{99}
\bibitem{Dani}
Daniel García. \textit{Activando y desactivando el bluetooth en Android}. \url{http://danielggarcia.wordpress.com/2013/10/19/bluetooth-i-activando-y-desactivando-el-bluetooth-en-android/}.
\end{thebibliography}
\endgroup
\end{document}