# How can I modify spacing between words in bibliography?

I've been trying to modify the spacing between words in my bibliography for a while now but I can't get it to work properly. I've been applying the answer from this thread Gaps between words in bibliography with regards to adding the \usepackage[hyphens]{url} in the preamble but I still get an awkward looking bibliography (see picture below).

Both the third and the last bibliography entry looks weird. Especially the third one. It seems related to the fact that I'm using Urls. Here's some of the bibtex "code" (don't know the proper terminology):

@Article{barnombud2018,
author = {Barnombudsmannen},
title  = {\textit{utanförskap, våld och kärlek till orten}},
year   = {2018},
note   = {{ \url{https://www.barnombudsmannen.se/barnombudsmannen/publikationer/arsrapporter/utanforskap-vald-och-karlek-till-orten-2018/}}},
}

• If you have to put formatting instructions like \textit around the entire field contents that indicates either that you should be using a different bibliography style which formats your entries correctly or a different entry type (indeed, @article looks a bit far fetched for barnombud2018, it's probably more of a @report/@techreport or @online/@misc - exact names of types may vary in your style). Modern styles also support a dedicated url field making the workaround of putting \url into howpublished or note superfluous. – moewe Apr 8 at 18:55
• Yes, I used the \textit command because I read some quick reference guides for harvard where they said that the title for these kinds of publications should be in italic. Its difficult for me to know exactly which type of bibliography style I should use. – Victor Galeano Apr 8 at 19:20
• The two questions (which style should you use and which entry type you should pick for an entry) are indeed not always simple. Usually the first step is to find a style that does more or less what you need. Then the second step is to find out which entry types that style supports and how to use them. – moewe Apr 8 at 19:23
• Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Mensch Aug 25 at 2:36

The problem is that the urls normally can only be broken at few places. To allow more possible break points and thus improve the layout of the bibliography, add

\usepackage{xurl}


One example (I had do guess a bib style, replace it with the ones you are actually using)

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Article{barnombud2018,
author = {Barnombudsmannen},
title  = {\textit{utanförskap, våld och kärlek till orten}},
year   = {2018},
note   = {{\url{https://www.barnombudsmannen.se/barnombudsmannen/publikationer/arsrapporter/utanforskap-vald-och-karlek-till-orten-2018/}}},
}
\end{filecontents*}

\usepackage{natbib}
\usepackage[hyphens]{url}
\usepackage{xurl}

\begin{document}

\cite{barnombud2018}

\bibliographystyle{plainnat}
\bibliography{\jobname}

\end{document}