# Problem with the spacing of the biblography references

I don't this this is correct:

]1

The word spacing for the first entries seems wrong, the first in particular.

Here's the MWE:

\documentclass[a4paper,11pt]{article}
\usepackage{natbib}
\bibpunct[, ]{(}{)}{;}{a}{,}{,}
\usepackage[british]{babel}
\usepackage{url}
\usepackage{hyperref}
\begin{document}
\cite{stoptheclot:2008} \cite{wiki:xxx} \cite{stoptheclot2:2008}
\pagebreak
\bibliographystyle{apalike}
\bibliography{bibfile}
\end{document}


The .bib file is:

% Encoding: UTF-8
@misc{wiki:xxx,
author = "{Wikipedia contributors}",
title = "LaTeX --- {Wikipedia}{,} The Free Encyclopedia",
year = "2011",
howpublished = "\url{https://en.wikipedia.org/w/index.php?title=LaTeX&oldid=413720397}",
note = "Viewed 12th November 2018."
}

@misc{stoptheclot:2008,
author = "{stoptheclot contributors}",
title = "Vitamin K and Coumadin - What you need to Know. [online]",
year = "2008",
note = "Viewed 12th November 2018.",
}

@misc{stoptheclot2:2008,
author = "{Stoptheclot contributors}",
title = "Vitamin K and Coumadin - What you need to",
year = "2008",
note = "Viewed 12th November 2018.",
}


Is there any way I can control the spacing of the references (preferably left justified)?

• Try the xurl package – user36296 Nov 20 '18 at 15:13
• If you want your text left aligned, you could use \raggedright before your bibliography, but this will still give strange line breaks within the url, so I suggest the xurl package – user36296 Nov 20 '18 at 15:16
• xurl works a treat. – Paul Nov 20 '18 at 15:18

The xurl package can be used to add more possible breaking points to the urls:

\documentclass[a4paper,11pt]{article}
\usepackage{natbib}
\bibpunct[, ]{(}{)}{;}{a}{,}{,}
\usepackage[british]{babel}
\usepackage{url}
\usepackage{hyperref}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
% Encoding: UTF-8
@misc{wiki:xxx,
author = "{Wikipedia contributors}",
title = "LaTeX --- {Wikipedia}{,} The Free Encyclopedia",
year = "2011",
howpublished = "\url{https://en.wikipedia.org/w/index.php?title=LaTeX&oldid=413720397}",
note = "Viewed 12th November 2018."
}

@misc{stoptheclot:2008,
author = "{stoptheclot contributors}",
title = "Vitamin K and Coumadin - What you need to Know. [online]",
year = "2008",
note = "Viewed 12th November 2018.",
}

@misc{stoptheclot2:2008,
author = "{Stoptheclot contributors}",
title = "Vitamin K and Coumadin - What you need to",
year = "2008",
note = "Viewed 12th November 2018.",
}
\end{filecontents*}

\usepackage{xurl}

\begin{document}
\cite{stoptheclot:2008} \cite{wiki:xxx} \cite{stoptheclot2:2008}
\pagebreak
\bibliographystyle{apalike}
\bibliography{\jobname}
\end{document}


• Replacing \usepackage{url} with \usepackage{xurl} works too. – Paul Nov 20 '18 at 15:33
• @Paul Even in the example in your question, you don't need the url package, because you load hyperref – user36296 Nov 20 '18 at 15:34