1

I want to get online accessed 19-July-2020 before the URL. Currently it's coming after the URL. The MWE is -

\RequirePackage{filecontents}
\begin{filecontents}{mybib.bib}
@misc{citekey,
    title = {Road accidents in bangladesh - Wikipedia},
    note = {Online accessed 19-July-2020},
    howpublished =
    {retrieved from: \url {https://en.wikipedia.org/wiki/Road{\_}accidents{\_}in{\_}bangladesh}}
}
\end{filecontents}

\documentclass{report}

\usepackage{url}
\usepackage{cite}

\begin{document}
Example citation \cite{citekey}

\bibliography{mybib}
\bibliographystyle{IEEEtran}

\end{document}

Is there any way to define the term retrieved from: which I am adding before every url to show it in the reference. I don't want to write it everytime before every url in every howpublished.

1 Answer 1

1

Since you're using the IEEEtran bibliography style, you could make use of the fact that it recognizes a field called url. A happy side-effect of changing the howpublished field name to url (as well as deleting the "retrieved from:" prefix and removing the \url{...} "wrapper") is that the contents of the note field will no longer be placed last.

enter image description here

\documentclass{report}
\begin{filecontents}[overwrite]{mybib.bib}
@misc{citekey,
    title = {How to add a {URL} to a {LaTeX} bibtex file},
    note  = {Accessed online 19-July-2020},
    url   = {https://tex.stackexchange.com/questions/35977/how-to-add-a-url-to-a-latex-bibtex-file}
}
\end{filecontents}

\usepackage{xurl}
\usepackage{cite}
\bibliographystyle{IEEEtran}

\begin{document}
Example citation \cite{citekey}
\bibliography{mybib}
\end{document}
4
  • Thanks for Your reply but I have some problem using url instead of howpublished. for example this entry @misc{wiki, title = {{Road accidents in bangladesh - Wikipedia}}, note = {Online accessed 19-July-200}, howpublished = {https://en.wikipedia.org/wiki/Road{\_}accidents{\_}in{\_}bangladesh}} is not working perfectly without howpublished - Sep 25, 2020 at 4:59
  • @MAzharulIslam - I'm not sure I understand your comment. In my answer, I recommend replacing the howpublished field name with url.
    – Mico
    Sep 25, 2020 at 5:28
  • If I use url fieldname for the above mentioned citation entry it breaks the url. Sep 25, 2020 at 6:25
  • @MAzharulIslam - My answer was based on handling the URL https://tex.stackexchange.com/questions/35977/how-to-add-a-url-to-a-latex-bibtex-file, but you're now referring a very different URL. Please edit your original query to provide all relevant information needed to construct the new entry. Please be sure to clarify what the expressions "is not working perfectly" and "it breaks the url" mean. Aside: the URL https://en.wikipedia.org/wiki/Road_accidents_in_bangladesh doesn't seem to point to a real Wikipedia page.
    – Mico
    Sep 25, 2020 at 6:48

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.