# Bibliography: cleanest way (no bib encoding!) to add URLs and their related info?

I use LaTeX for writing my thesis and I'm trying to come up with a clean and elegant bibliography format for web page references. I've been searching and trying different things for hours, but none work the way I want, and if they do it seems too hackish. I can't believe there is no easy and elegant way to do this (it seems to be a pretty standard requirement in the Web 2.0 world??).

Basically, I'm using the memoir class together with the plainnat bib style (I can switch to something else if that can do what I want):
MWE:

\documentclass[twoside,a4paper,10pt]{memoir}
\usepackage{natbib}
\bibliographystyle{plainnat}

\begin{document}
Ref 1: \citep{wiki:test}
\bibliography{library}
\end{document}


Bib:

@misc{ wiki:test,
author = "Wikipedia",
title = "Plagiarism --- {W}ikipedia{,} The Free Encyclopedia",
year = "2004",
url = "\url{http://en.wikipedia.org/w/index.php?title=Plagiarism&oldid=5139350}",
urldate = {2004-05-27}"
}


The output is this:

This does not look good. Instead I want the URL field to appear on its own line. There should also be a field like "Accessed on: .." or "Visited at: .." with the date given in the urldate bib field on its own line. How do I do this in a nice way?

It seems the standard way to add this field is to add note = "[Online; accessed 22-July-2004]" to the bib fields, but this is an ugly solution. The bib file should not be concerned with how to format itself! Isn't there a better solution? E.g. something that just reads another field from the bib file (for example urldate as above) and adds that together with the url on two separate lines? Something like this (not quite, but similar), WITHOUT encoding it in the bib file:

• Welcome to TeX.SE! Do all entries referring to web pages have the same type (say, @misc) in your bib file(s)? Will the field referring to the last-accessed-date always have the same field name? – Mico Nov 21 '13 at 4:52
• Yes and yes :-) – johnrl Nov 21 '13 at 9:35

Well, there are several errors in your shown code, some in the bib file, some in the TeX code.

Please see the following MWE (package filecontents is only used to have tex code and bib file in one compilable MWE):

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@misc{wiki:test,
author  = {Wikipedia},
title   = {Plagiarism --- {W}ikipedia{,} The Free Encyclopedia},
year    = {2004},
url     = {http://en.wikipedia.org/w/index.php?title=Plagiarism&oldid=5139350},
urldate = {2004-05-27},
}
\end{filecontents*}

\documentclass[twoside,a4paper,10pt]{memoir}

\usepackage{url} % <=====================================================
\usepackage{natbib}
\bibliographystyle{plainnat}

\begin{document}
Ref 1: \citep{wiki:test}
\bibliography{\jobname} % \jobname to use the bib file created by filecontents!
\end{document}


You see that I added package url (to get no error message for the & in the given url.

Now please have a look to the bib file (here I visualised the main changes with %<============= too---that makes this code not compilable, please use the code in the MWE!):

@misc{wiki:test,
author  = {Wikipedia},
title   = {Plagiarism --- {W}ikipedia{,} The Free Encyclopedia},
year    = {2004},
url     = {http://en.wikipedia.org/w/index.php?title=Plagiarism&oldid=5139350}, %<================================================
urldate = {2004-05-27}, %<==============================================
}


I changed all "..." to {...}, but your urldate field was faulty (no starting ") and with package url you can omit command \url in field url.

With this changes and an current TeX distribution (I use MiKTeX 2.9) the MWE compiles without errors. See my result: