5

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.

enter image description here

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

\bibitem{Stack1}
Stack Overflow. \tit{Simple Bluetooth data receiver Android}. \url{http://stackoverflow.com/questions/9164138/simple-bluetooth-data-receiver-android}.

\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}


\usepackage[pdftex,bookmarksnumbered,hidelinks,breaklinks]{hyperref}


\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

enter image description here

  • 3
    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
  • 1
    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
7

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.

enter image description here

\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'
\usepackage[pdftex,bookmarksnumbered,hidelinks,breaklinks]{hyperref}

\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}
5

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}
\usepackage[breaklinks]{hyperref}
\makeatletter
\g@addto@macro\UrlBreaks{\do\-}
\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.