How to cite a url in Latex

You may need to cite an url in Latex, but the special characters in the url will triger compilation errors. Here is how to correctly cite a url in Latex.

Suppose that we want to cite Wikipedia's article "German Empire". So the entry in the list of references should look like:

Wikipedia, German Empire. https://en.wikipedia.org/wiki/German_Empire (accessed on 20/02/2019)

Using Bibitem

Use package url by inserting the following line in the preambule section of your document

\usepackage{url}

The package url is already included is you are using package hyperref.

Then insert the reference in the bibliography section as follows:

\bibitem{wikige} 
Wikipedia, German Empire. \url{https://en.wikipedia.org/wiki/German_Empire} (accessed on 20/02/2019)


Using bibtex:
Format the bibtex entry as follows:

@misc{WinNT,
  author = {Wikipedia}, 
  title = {German Empire},
  howpublished = {\url{https://en.wikipedia.org/wiki/German_Empire}},
  note = {Accessed: 2019-02-20}
}

Or using BibLatex 'online' entry type:


@online{WinNT,
  author = {Wikipedia},
  title = {German Empire},
  year = 2019,
  url = {https://en.wikipedia.org/wiki/German_Empire},
  urldate = {2019-02-20}
}



Comments