I am getting awkward gaps in the bibliography while citing online news articles.

   author =       { Kastrenakes, Jacob},
   title =        {{UPS} has a delivery truck that can launch a drone},
   editor =       {theverge.com},
   month =        {February},
   year =         {2017},
   url = {https://www.theverge.com/2017/2/21/14691062/ups-drone-delivery-truck-test-completed-video},
   note = {\emph{https://www.theverge.com/2017/2/21/14691062/ups-drone-delivery-truck-test-completed-video} {[Online; posted 21-February-2017]}},

It looks like this enter image description here

I see huge gaps before UPS and before and after "J" in author's name.

A normal bibliography looks like this: enter image description here

  • your biblioraphy style should generate \url{http....} so the url will linebreak but you have provided no usable example to allow anyone to reproduce the problem – David Carlisle Jun 20 '18 at 21:57
  • But it's a fair bet 'tex-core' is not the right tag. @DavidCarlisle Biblatex handles URLs badly by default for me, though usually it lets them spill off the page rather than leaving gaps. Does it do better by default for you? – cfr Jun 20 '18 at 22:31
  • 1
    You appear to be putting the URL into note as well as url, and it appears to be the note field which is typesetting it. But you don't use \url there, so obviously, it isn't handled properly. However, Biblatex handles url fields` OK(ish), so it is not obvious why you've blocked that and pushed note. Are you actually using Biblatex at all? – cfr Jun 20 '18 at 22:34
  • I am using sharelatex, I believe the bibliography would be same in that as well. – bhawesh sah Jun 21 '18 at 1:14
  • I am using natbib, sorry for the confusion. – bhawesh sah Jun 21 '18 at 1:24

You should (a) replace the \emph in the note by \url and (b) load the url package. In your particular case passing the hyphens option to the url package, so allowing breaks in the url at hyhens, gives best results.

Sample output




with test.bib

  author =   {Kastrenakes, Jacob},
  title =    {{UPS} has a delivery truck that can launch a drone},
  editor =   {theverge.com},
  month =    {February},
  year =     2017,
  note =
                  {[Online; posted 21-February-2017]}}

The large spaces your saw in your original example are the result of LaTeX trying to stretch as much as possible to fill up the first line as it fails to find good break points later in the paragraph. The \url command that natbib styles provide is usually just \texttt which does not allow such breaks. The \url command from the url package (or from hyperef) allows breaking of non-word objects such as url's across lines, and thus gives more options for how LaTeX can break up the paragraph. Seeing the documentation of the url package for further options, including ways to change the font used for the url.

Note that you could alternatively use the url field as follows in test.bib:

  author =   {Kastrenakes, Jacob},
  title =    {{UPS} has a delivery truck that can launch a drone},
  editor =   {theverge.com},
  month =    {February},
  year =     2017,
  url =
  note =     {[Online; posted 21-February-2017]}

but now the url will be proceeded by URL and you will still need to load the url package to get good spacing.

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