How to deal with hyphens in .bib files?
The dash character in the line
title = {{A Quantitative Survey of Local Adaptation and Fitness Trade‐Offs}},
is indeed not a "simple" dash (ASCII code 45), but a unicode-encoded character (code U+2010).
Observe that this is a LaTeX issue, not a BibTeX issue.
You can do several things. E.g.,
Do a global search of
‐
(U+2010) and replace all instances with-
(U+0045).Switch to a TeX engine and a font family that can handle the character
U+2010
directly. In the following example, LuaLaTeX and the EB Garamond font are used.
% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{mybib.bib}
@article{Hereford2009,
author = {Hereford, Joe},
doi = {10.1086/597611},
file = {:Users/remi/Documents/Biologie/Literature/BackgroundSelection/597611.pdf:pdf},
issn = {0003-0147},
journal = {The American Naturalist},
keywords= {adaptation,genetic drift,genotype-by-environment interaction,local,natural selection,population divergence,reciprocal},
number = {5},
pages = {579--588},
title = {{A Quantitative Survey of Local Adaptation and Fitness Trade‐Offs}},
url = {http://www.jstor.org/stable/10.1086/597611},
volume = {173},
year = {2009}
}
\end{filecontents}
\usepackage{natbib}
\bibliographystyle{apalike} % choose your bibliography style
\usepackage{fontspec}
\setmainfont{EB Garamond}
\begin{document}
\nocite{*}
\bibliography{mybib}
\end{document}
I can reproduce the faulty output if I have \usepackage[applemac]{inputenc}
in my document.
\begin{filecontents*}{\jobname.bib}
@article{Hereford2009,
author = {Hereford, Joe},
doi = {10.1086/597611},
file = {:Users/remi/Documents/Biologie/Literature/BackgroundSelection/597611.pdf:pdf},
issn = {0003-0147},
journal = {The American Naturalist},
keywords = {adaptation,genetic drift,genotype-by-environment interaction,local,natural selection,population divergence,reciprocal},
number = {5},
pages = {579--588},
title = {{A Quantitative Survey of Local Adaptation and Fitness Trade‐Offs}},
url = {http://www.jstor.org/stable/10.1086/597611},
volume = {173},
year = {2009}
}
\end{filecontents*}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[applemac]{inputenc}
\begin{document}
\cite{Hereford2009}
\bibliographystyle{plain}
\bibliography{\jobname}
\end{document}
If I change this to
\begin{filecontents*}{\jobname.bib}
@article{Hereford2009,
author = {Hereford, Joe},
doi = {10.1086/597611},
file = {:Users/remi/Documents/Biologie/Literature/BackgroundSelection/597611.pdf:pdf},
issn = {0003-0147},
journal = {The American Naturalist},
keywords = {adaptation,genetic drift,genotype-by-environment interaction,local,natural selection,population divergence,reciprocal},
number = {5},
pages = {579--588},
title = {{A Quantitative Survey of Local Adaptation and Fitness Trade‐Offs}},
url = {http://www.jstor.org/stable/10.1086/597611},
volume = {173},
year = {2009}
}
\end{filecontents*}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8,applemac]{inputenc}
\DeclareUnicodeCharacter{2010}{-}
\begin{document}
\cite{Hereford2009}
\bibliographystyle{plain}
\inputencoding{utf8}
\bibliography{\jobname}
\inputencoding{applemac} % just in case something follows
\end{document}
I get correct output.
It's best if you start using UTF-8 for all of your documents.