# URL citation: Control breaks and add 'Accessed' as prefix text

Please consider the following BibTex reference output (source can be found below):

I am using \bibliographystyle{plain} as the output fits the requirements of a paper I'm writing. I tried natbib, but didn't come along with it as all bibliography styles have changed, even when using the plainnat style. What doesn't work good is the citation of referenced URLs that need to contain a date when they were accessed. All other citations (I do cite books, papers, etc. as well) work just like they should.

1) Is there any way to add the prefix 'Accessed:' before the dates (and only if they are present?), the first entry would look like

[1] Wikipedia, https://en.wikipedia.org, Accessed: March 2014


2) Is there any way to control the breaking of URLs in a way that it is prefered to not break them (in the examples [3] and [4] the URL could stay together if a linebreak was inserted before it, while the URL of example [5] is juts too long to stay within a single line)?

3) Is there an easier way to define a URL entry than I did (see below)?

Here is the LaTex source:

\documentclass[a4paper]{scrartcl}
\bibliographystyle{plain}
\usepackage{url}
\usepackage{cite}
\begin{document}
\nocite{wiki-web1,wiki-web2,wiki-web3,wiki-web4,wiki-web5}
\bibliography{bibtex}
\end{document}


and the BibTex source:

@Other{wiki-web1,
Title                    = {Wikipedia},
HowPublished             = {\url{https://en.wikipedia.org}},
Month                    = mar,
Timestamp                = {2014.03.16},
Year                     = {2014}
},

@Other{wiki-web2,
Title                    = {Wikipedia},
Author = {Wikipedia Foundation},
HowPublished             = {\url{https://en.wikipedia.org/wiki/Main_Page}},
Month                    = mar,
Year                     = {2014}
},

@Other{wiki-web3,
Title                    = {Wikipedia},
Author = {Wikipedia Foundation (SF)},
HowPublished             = {\url{https://en.wikipedia.org/wiki/Main_Page}},
Month                    = mar,
Year                     = {2014}
},

@Other{wiki-web4,
Title                    = {Wikipedia},
Author = {Wikipedia Foundation (SF)},
HowPublished             = {\url{https://en.wikipedia.org/wiki/Main_Page}},
Month                    = mar,
Year                     = {2014}
},

@Other{wiki-web5,
Title                    = {Wikipedia},
Author = {Wikipedia Foundation (SF)},
HowPublished             = {\url{https://en.wikipedia.org/wiki/File:Camborne_Redruth_Community_Hospital_-_geograph.org.uk_-_716833.jpg#filehistory}},
Month                    = mar,
Year                     = {2014}
}

• You could use biblatex and its numeric style, where you have date and urldate, the former is for the actual (last changed) date of the website and the latter for the access date. I feel you abuse the year/month fields here. – moewe Mar 16 '14 at 11:24

There are two possible roles of dates associated with a web document. The year and month fields generally indicate when the document was created or published. To provide information about when you (last) accessed the document, you could set up a note field for each entry, such as

note = "Last accessed 16 March 2014",


A full MWE that adds note fields would generate the following output:

\RequirePackage{filecontents}
\documentclass[a4paper]{scrartcl}
\bibliographystyle{plainnat}
\usepackage[hyphens]{url}
\usepackage[numbers]{natbib}
\begin{filecontents*}{\jobname.bib}
@misc{wiki-web1,
Title                    = {Wikipedia},
howpublished         = "\url{https://en.wikipedia.org}",
Month                    = mar,
Timestamp                = {2014.03.16},
Year                     = {2014},
note = "Last accessed 16 March 2014",
}

@misc{wiki-web2,
Title                    = {Wikipedia},
Author = {Wikipedia Foundation},
howpublished         = "\url{https://en.wikipedia.org/wiki/Main_Page}",
Month                    = mar,
Year                     = {2014},
note = "Last accessed 16 March 2014",
}

@misc{wiki-web3,
Title                    = {Wikipedia},
Author = {Wikipedia Foundation (SF)},
howpublished         = "\url{https://en.wikipedia.org/wiki/Main_Page}",
Month                    = mar,
Year                     = {2014},
note = "Last accessed 16 March 2014",
}

@misc{wiki-web4,
Title                    = {Wikipedia},
Author = {Wikipedia Foundation (SF)},
howpublished         = "\url{https://en.wikipedia.org/wiki/Main_Page}",
Month                    = mar,
Year                     = {2014},
note = "Last accessed 16 March 2014",
}

@misc{wiki-web5,
Title                    = {Wikipedia},
Author = {Wikipedia Foundation (SF)},
howpublished         = "\url{https://en.wikipedia.org/wiki/File:Camborne_Redruth_Community_Hospital_-_geograph.org.uk_-_716833.jpg#filehistory}",
Month                    = mar,
Year                     = {2014},
note = "Last accessed 16 March 2014",
}
\end{filecontents*}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\nocite{wiki-web1,wiki-web2,wiki-web3,wiki-web4,wiki-web5}
\bibliography{\jobname}
\end{document}


To address some of your other queries. Yes, there are certain bibliography styles that automatically insert a line break before a url field. Your entries don't provided fields called url though, just howpublished.

• Thank you for your answer. I used howpublished because the url field was ignored by the plain style. – muffel Mar 17 '14 at 7:31
• @muffel - The plain bibliography style is more than 20 years old. As such, it's not exactly surprising that it wouldn't be programmed to do anything with fields such as url, doi, and eid. The style plainnat, provided by the natbib package, is to some degree an update/refresh of the plain style. – Mico Mar 17 '14 at 8:34
• @Mico, could you update your answer to list any of the styles that automatically insert a new line before the URL field? – Michael Aug 8 '14 at 17:42
• @Michael - Thanks for your interest. To be sure, answers to your query are likely to be of broad interest. Unfortunately, whatever list I may be able to come up with and post as an addendum to answer above may not be seen by many people. May I therefore suggest that you post a new query to this site, in which you ask for lists of bibliography styles that either do or do not insert a line break ahead of the URL? Thanks in advance! – Mico Aug 8 '14 at 18:06