2

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

the url is printed as is, with \url{} also.

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

Fatal error when using Hyperref package 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
2

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",

enter image description here

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
\usepackage[colorlinks,allcolors=blue]{hyperref}

\begin{document}
\cite{Smith2040}
\bibliography{testbib}
\end{document}

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.