Don't make BibTeX see the hyphen:
\begin{filecontents*}{\jobname.bib}
@inbook{x,
author={A. Uthor},
title={A chapter},
booktitle={A book},
publisher={Publisher},
year={2012},
pages={3\pagehyphen5},
}
\end{filecontents*}
\documentclass{article}
\usepackage{natbib}
\newcommand{\pagehyphen}{-}
\begin{document}
\cite{x}
\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}
You can also have the definition of the command in the .bib
file, with a @preamble
entry.
\begin{filecontents*}{\jobname.bib}
@preamble{"\providecommand\pagehyphen{-}"}
@inbook{x,
author={A. Uthor},
title={A chapter},
booktitle={A book},
publisher={Publisher},
year={2012},
pages={3\pagehyphen5},
}
\end{filecontents*}
\documentclass{article}
\usepackage{natbib}
\begin{document}
\cite{x}
\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}
Without any extra macro, you can use {\char45}
for the hyphen in the .bib file; however this is not the best solution, in my opinion.
\begin{filecontents*}{\jobname.bib}
@inbook{x,
author={A. Uthor},
title={A chapter},
booktitle={A book},
publisher={Publisher},
year={2012},
pages={3{\char45}5},
}
\end{filecontents*}
\documentclass{article}
\usepackage{natbib}
\begin{document}
\cite{x}
\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}
I have no problems with this slightly changed file:
\documentclass{article}
\usepackage{filecontents}% <-- useful for embedding external files in the main file
\begin{filecontents*}{\jobname.bib}
@MISC{maldives,
author = {Connoly, Darlene},
title = {Controversy in the Maldives},
editor = {Surfline.com},
month = {August},
year = {2012},
url = {http://www.surfline.com/surf-news/maldives-surf-access-controversy-update_75296/},
note = {[Online; posted 27-August-2012]},
}
@MISC{maldives-alt,
author = {Connoly, Darlene},
title = {Controversy in the Maldives},
editor = {Surfline.com},
month = {August},
year = {2012},
note = {\href{http://www.surfline.com/surf-news/maldives-surf-access-controversy-update_75296/}{Surfline.com} {[Online; posted 27-August-2012]}},
}
@MISC{mull,
author = {Mull, Jeff},
title = {Maldives Controversy},
editor = {Surfing Magazine},
month = {September},
year = {2010},
url = {http://www.surfermag.com/features/maldives-controversy/},
note = {[Online; posted 13-September-2012]},
}
\end{filecontents*}
\usepackage{natbib}
\usepackage{url}
\usepackage[colorlinks]{hyperref}
\begin{document}
Please refer to \cite{maldives} and \cite{mull}.
And this citation `hides' the link `in the url portion of the citation': \cite{maldives-alt}.
\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}
Best Answer
A simple way of doing it in BibTeX is with a
@misc
entry:You should also perhaps include an author if you know it. And remember to load a package such as
hyperref
orurl
.If you are using BibLaTeX there is an
@online
entry type: