# URL not showing correctly in latex IEEEtrans (both URL and Hyperref packages not working)

I am working on a article using IEEEtrans template in overleaf, but I just noticed that a technical report reference with a URL doesn't compile correctly:

%Smith2040
@electronic{Smith2040,

author   = "Smith, Matthew Nitch",

title     = "The number of cars worldwide is set to double by 2040",

url       = "\url{https://www.weforum.org/agenda/2016/04/the-number-of-cars-worldwide-is-set-to-double-by-2040}"
}


I get the aforementioned problem when using \usepackage{url}. But, when using \usepackage{hyperref} I get fatal error.

is there a solution?

• Welcome to TeX.SE. – Mico Feb 9 at 16:40
• Could you please add a minimal example which reproduces your problem? – CarLaTeX Feb 9 at 16:55

When using the IEEEtran bibliography style and the hyperref package, it's a mistake to encase the contents of the url field in a \url{...} wrapper. You should just write

url = "https://www.weforum.org/agenda/2016/04/the-number-of-cars-worldwide-is-set-to-double-by-2040",


Incidentally, I think it would be a really good idea for you to backfill the year and organization fields of this entry.

The following example loads the xurl package, rather than the url package. The only difference is that the former allows linebreaks inside a formatted URL string at any letter.

\RequirePackage{filecontents}
\begin{filecontents}{testbib.bib}
@electronic{Smith2040,
author= "Smith, Matthew Nitch",
title = "The number of cars worldwide is set to double by 2040",
year  = 2016,
organization = "World Economic Forum",
url   = "https://www.weforum.org/agenda/2016/04/the-number-of-cars-worldwide-is-set-to-double-by-2040"
}
\end{filecontents}

\documentclass{IEEEtran}
\bibliographystyle{IEEEtran}
\usepackage[spaces,hyphens]{xurl} % allow arbitrary line breaks in a formatted URL string