679

I'm looking to cite a number of web pages using bibtex and I was wondering if there was a specific template of the form @<template name here> for doing that. If you could use the following website as an example that would be great

http://web.archive.org/web/20080207010024/http://www.808multimedia.com/winnt/kernel.htm

4
  • 2
    As an extra thing here - I just found that if you are want to attribute the site name as author (for example if I wanted to say that the author of this page was 'Stack Overflow' it's best to put 'Stack Overflow' as the `key' field, rather than the 'author' field. Because then latex formats as 'Stack Overflow' and not 'S. Overflow'. (might only apply with Harvard style)
    – Joe
    Commented Oct 7, 2012 at 12:19
  • 2
    a nice resource covering, inter alia, natbib and biblatex (with screenshot-snippets of the PDF) is here: nschloe.blogspot.de/2009/06/bibtex-how-to-cite-website_21.html Commented May 1, 2013 at 8:17
  • 1
    Re @Joe's comment: You can force BibTeX to treat the author name as something that cannot be abbreviated, by enclosing it in an extra pair of curly braces: author = {{Jemison Laboratory}},. Works for natbib, at least.
    – Mars
    Commented May 18, 2016 at 16:50
  • The most convenient way is to use cite maker website, take for example, bibme. It will be most preferred one also for you I guess. Commented Apr 19, 2022 at 13:48

8 Answers 8

821

A simple way of doing it in BibTeX is with a @misc entry:

@misc{WinNT,
  title = {{MS Windows NT} Kernel Description},
  howpublished = {\url{http://web.archive.org/web/20080207010024/http://www.808multimedia.com/winnt/kernel.htm}},
  note = {Accessed: 2010-09-30}
}

You should also perhaps include an author if you know it. And remember to load a package such as hyperref or url.


If you are using BibLaTeX there is an @online entry type:

@online{WinNT,
  author = {MultiMedia LLC},
  title = {{MS Windows NT} Kernel Description},
  year = 1999,
  url = {http://web.archive.org/web/20080207010024/http://www.808multimedia.com/winnt/kernel.htm},
  urldate = {2010-09-30}
}
13
  • 31
    +1 for the way to include the access date (very important!). There's an alternative way that uses howpublished to include the \url{} and [Acccessed: 30 September 2009], but that might not be style-independent. It's a little frustrating that BibTeX didn't officially keep up with web pages as an entry. Commented Aug 27, 2012 at 15:35
  • 15
    There is a urldate field for biblatex, that acts as an accessed date field.
    – naught101
    Commented Oct 15, 2012 at 2:22
  • 2
    Not sure if it's related to my specific configuration, but Biber kept complaining about the urldate field until I changed it to {2010-09-30}.
    – Pieter
    Commented Mar 26, 2013 at 14:28
  • 5
    Thanks! For web sites that are dated, I prefer to use the month and year fields, but for sites that are undated, putting the date of access in the note field is a good way to go.
    – Nagel
    Commented Oct 30, 2014 at 13:15
  • 3
    Great answer, @misc entry and howpublished with \url{} field seems the way to go. Check out the website bibtex.online to convert BibTeX to other formats such as APA, MLA or Chicago
    – David
    Commented Oct 9, 2019 at 17:45
86

I always use the defaults suggested by Wikipedia (see "BibTeX entry" at the bottom), available if you click on "cite this page".

8
  • 7
    Neat trick. I had to change url to howpublished to make it work. How do I get that view for other wikipedia pages?
    – krupan
    Commented Jan 8, 2013 at 19:08
  • 1
    @krupan I have no idea what you mean by "other wikipedia pages". What pages do you want to cite?
    – Habi
    Commented Jan 10, 2013 at 12:07
  • 3
    @krupan in the left of every page you can found a link Cite this page, it complete the link that @habi provides with the current wikipedia page. Commented Jan 22, 2015 at 19:55
  • @krupan Did Arturo answer your question? It might be of use to our other "TeXers" Commented Nov 2, 2019 at 4:58
  • 1
    I see it now, thank you. It's not there on mobile (even when I request the desktop site).
    – krupan
    Commented Nov 5, 2019 at 20:37
25

The JabRef reference manager suggests to use the "electronic" type. So I do it like this:

@electronic{Rub1,
 author = {Rubino, Daniel},
 editor = {{Windows Phone Central}},
 title = {IE9 for Windows Phone 7: Adobe Flash, demos and development},
 url = {http://www.wpcentral.com/ie9-windows-phone-7-adobe-flash-demos-and-development-videos},
 urldate = {14.01.2013},
 originalyear = {18.02.2011}
}

In the BibTeX export of Citavi there is als the type "www". Depending on your editor you have to define the styles "electronic" and "www", so "misc" seems to be probably the safest.

But then you should use \bibliographystyle{alphadin} and do it like this:

@misc{Rub1,
 author = {Rubino, Daniel},
 editor = {{Windows Phone Central}},
 title = {IE9 for Windows Phone 7: Adobe Flash, demos and development},
 url = {http://www.wpcentral.com/ie9-windows-phone-7-adobe-flash-demos-and-development-videos},
 lastchecked = {14.01.2013},
 originalyear = {18.02.2011}
}
4
  • Nice! "@electronic" made the URL visible when using the CSL file at zotero.org/styles/ieee . Commented Jun 18, 2018 at 11:16
  • if I use alphadin then there is no bib key in references. strange Commented Jun 7, 2019 at 12:20
  • Should urldate be the current dat? or can I obtain its original created date from the url? @Benny Neugebauer
    – alper
    Commented Oct 29, 2019 at 13:08
  • I'm lazy. Does JabRef have a tool that will automatically generate a citation when pointed at a StackExchange post like this one? Citing SE posts can be burdensome because of the often large number of contributors.
    – Shawn Eary
    Commented Oct 22, 2021 at 15:56
11

I found a very good tutorial on http://www.polymtl.ca/biblio/utiliser/guide_bibtex.pdf (French; the link is now dead, available at the Wayback Machine)

With this, i have modified the ieeetr.bst file to integrate the ignored tags url and urldate to all the types of entries (style was imposed for the report at the end of study).

The file was renamed (mystyle) and placed in the same local folder as the ref.bib file. Called with

\bibliographystyle{mystyle}
\bibliography{ref}

(1) add the new entries :

ENTRY
  { address
...
    url
    urldate
  }
  {}
  { label }

(2) add this function

FUNCTION {format.url}
{ url empty$
    { "" }
    {   
        ". \emph{Disponible}~\url{" * url * "}" *
        urldate empty$
         { "there is url but no urldate in " cite$ * warning$ }
         { 
            "~(\emph{consult\'e le} " * urldate * ")" *
         }
         if$
    }
  if$
}

(3) for all types, call the function with format.url "" output ! Example for @incollection:

FUNCTION {incollection}
{ output.bibitem
  format.authors "author" output.check
  format.title "title" output.check
  blank.sep
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.bvolume output
      format.number.series output
      format.chapter.pages output
      format.addr.pub "publisher" output.check
      format.edition output
      format.date "year" output.check
    }
    { format.incoll.inproc.crossref output.nonnull
      format.chapter.pages output
    }      
  if$
  format.url "" output 
  new.block
  note output
  fin.entry
}

I hope it can help you

3
  • 1
    Hi madit, just added some code tags for ya :)
    – Scott H.
    Commented Nov 6, 2012 at 22:19
  • Yes, even in sentences, it is better indeed. Thank you.
    – madit
    Commented Nov 6, 2012 at 22:26
  • The link to the tutorial is dead
    – Hugal31
    Commented Nov 24, 2017 at 17:25
10

Hm, it would seem that it isn't possible to cite webpages directly, but there does seem to be a workaround using the general purpose @misc field.

https://texfaq.org/FAQ-citeURL

7

If you are creating your own bst file and you want it to incorporate web references, I use this function:

FUNCTION {internet}
{ output.bibitem
  format.titleclass output
  format.authors " " * "author" output.check
  title empty$
    {""}
    { title "t" change.case$ * ".\,\ " *}
  if$
  format.address output
  publisher empty$
    {
      institution empty$
        { }
        { institution "; " * output}
      if$
    }
    { publisher "; " * output}
  if$
  year empty$
    { " [date unknown; " }
    { year
      month empty$
        { " [\ignorespaces " * }
        { "~" * month * " [\ignorespaces " *}
      if$
    }
  if$
  revised empty$
    { "" * }
    { "revised~" * revised * "; " *}
    if$
  accessed empty$
    { "" * }
    { "accessed~"  * accessed * "]. " *}
    if$
  website *
  doi empty$
    {}
    { add.period$ " " * doi * }
  if$
  output
  add.period$
  format.referenceclass output
  fin.entry.noperiod
}

This with bib file entries like

@INTERNET{www11b,
    AUTHOR    = "Schultheis, J. D.",
    TITLE     = "Fun with Reference Citations",
    ADDRESS   = "Baltimore (MD)",
    PUBLISHER = "Random House",
    YEAR      = "2013", 
    MONTH     = sep # " 10",
    ACCESSED  = "2014 " # sep # " 26",
    WEBSITE   =
             "http://en.wikipedia.org/wiki/Trajectory\_of\_a\_projectile",
    DOI       = "\url{doi:10.10.1038/nphys1170}"     }

@INTERNET{www11a,
    TITLE    = "Flight Equations with Drag",
    WEBSITE  = "http://www.grc.nasa.gov/WWW/k-12/airplane/flteqs.html",
    ACCESSED = "2011 " # oct     }

@INTERNET{www11c,
    AUTHOR   = "Grissom, Gus",
    INSTITUTION = "Glenn Research Center, National Aeronautics
                   and Space Administration",
    TITLE    = "Flight Equations with Drag",
    ADDRESS  = "Cleveland (OH)",
    YEAR     = "1999",
    MONTH    = dec # "12",
    REVISED  = "2014 " # jun # " 12",
    ACCESSED = "2014 " # oct # " 7",
    WEBSITE  = "http://www.grc.nasa.gov/WWW/k-12/airplane/flteqs.html"}

@INTERNET{manktelow2010history,
    TITLE     = "History of taxonomy",
    AUTHOR    = "Manktelow, Mariette",
    WEBSITE   = "\url{http://www.atbi.eu/summerschool/files/%
                summerschool/Manktelow\_Syllabus.pdf}",
    ACCESSED  = "2014 Aug~26",
    ADDRESS   = "Uppsala (Sweden)",
    PUBLISHER = "Uppsala University Dept. of Systematic Biology",
    YEAR      = "2010"     }

@INTERNET{smith2014metcalf,
    TITLE    = "Assault on california power station raises alarm on
                potential for terrorism",
    AUTHOR   = "Rebecca Smith",
    WEBSITE  = "\url{http://online.wsj.com/news/articles/%
                SB10001424052702304851104579359141941621778}",
    ACCESSED = "2014 Aug 26",
    PUBLISHER= "The Wall Street Journal",
    MONTH    = feb,
    YEAR     = {2014}     }

I get this result:

enter image description here

2

Try this, please:

@misc{AdamsManual1,
  author = {MSC.\hspace{2pt}Software\hspace{2pt}Corporation},
  title = {{Adams Manual: Tire Models, using the Fiala handling force model}},
  howpublished = {\url{https://www.mscsoftware.com/product/adams; https://www.coursehero.com/file/13499609/tire-models/}},
  year = 2005,
  note = {Accessed: 2021-03-20}
}

The output:

Screenshot of the output of the above code.

0

Thanks from me, I could use this Question thread to solve my problems with URL citations. I think, my solution adds a bit flexibility.

This part extends the answer from @madit:

For online publications there is not only an URL, but also a DOI (See Wiki: https://en.wikipedia.org/wiki/Digital_object_identifier, example: https://doi.org/10.1002/andp.19163540702) for a specific source, for example in journals (i.e. Nature, Science, ...) and also academic eBooks.

So it is often desired to cite with a DOI instead of an URL with a date of access.

So in the same folder as main.tex are the style file bibstyle.bst and the bibliography source file myRefs.bib.

In main.tex, the bibliography is created by:

\bibliographystyle{bibstyle}
\bibliography{myRefs}

In bibstyle.bst multiple adjustments need to be made:

  1. At the beginning, new possible entries (doi, url, urldate) need to be created:
ENTRY
  { address
    ...
    doi
    ...
    url
    urldate
    ...
  }
  {}
  { label }

  1. Then, a new function needs to be created, that formats the new entries into a part of the final citation. Here, I worked from the code of @madit, but I included the preferred option for the DOI and I changed the return for no URL or DOI from { "" } to 'skip$. Unless the last adjustment is made, it may throw an error along the lines of ---the literal stack isn't empty for entry MyCitation. The reason is basically because LaTeX may not handle an emtpy string well instead of no return, when building the citation text. Additionally for the DOI output, I linked it via the official doi website (https://doi.org/) to guarantee that the link works and that it is displayed correctly via \detokenize even with characters like _ or \ in \texttt mode. So this results in:
FUNCTION {format.url}
{ doi empty$
    { url empty$
        'skip$
        {
            ". URL:~\url{" * url * "}" *
            urldate empty$
             { "there is url but no urldate in " cite$ * warning$ }
             { 
                "~(Accessed on: " * urldate * ")" *
             }
             if$
        }if$
    }
    {". DOI:~\href{https://doi.org/" * doi * "}{\texttt{\detokenize{" * doi * "}}}" *
    }if$
}
  1. The last step is to include
  format.url "" output 
  new.block

before

  note output
  fin.entry
}

in all different source type functions, for example:

FUNCTION {booklet}
{ output.bibitem
  format.authors output
  format.title "title" output.check
  howpublished "howpublished" bibinfo.check output
  address "address" bibinfo.check output
  format.date output
  format.url "" output 
  new.block
  format.note output
  fin.entry
}

The advantage using this solution is: The bibliography handles URLs and DOIs automatically without using url = {\url{...}}, or url = {\href{...}{...}},. I hope this helps.

Note: To adjust the link-colors, I used in main.tex:

\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}% sets the style for links
1
  • Welcome to TeX.SE!
    – Mensch
    Commented Feb 29 at 17:35

You must log in to answer this question.