2

Whenever there is a URL containing dash/hyphen characters in my bibliography file, I get the following type of error:

LaTeX Warning: Citation `wright2006' on page 1 undefined on input line 29.

(./Untitled.bbl ./Untitled.bbl:29: Missing $ inserted.

            $ l.29 ...l{https://doi.org/10.1007/0-387-27925-3_2}

I figured that if I erase the URL field, there is no problem. The thing is that I have a large bib file containing more than 300 entries that will be cited. Most of them contain URL fields with dash/hyphen characters. I tested citations with URL fields that do not contain dash/hyphen characters and they work fine. How can I make this work without having to go through the whole file and erase more than 300 URL fields?

Here is a MWE:

\documentclass[conference]{IEEEtran}
\usepackage{filecontents,lipsum}
\usepackage[noadjust]{cite}
\begin{filecontents*}{references.bib}
@inbook{wright2006,
    Address = {New York, NY},
    Author = {Wright, Kenneth W.},
    Booktitle = {Handbook of Pediatric Strabismus and Amblyopia},
    Date-Added = {2017-09-11 00:07:41 +0000},
    Date-Modified = {2017-09-11 00:08:45 +0000},
    Doi = {10.1007/0-387-27925-3_2},
    Editor = {Wright, Kenneth W. and Spiegel, Peter H. and Thompson, Lisa S.},
    Isbn = {978-0-387-27925-1},
    Keywords = {Anatomy;Biology;anatomical data;physiology;Eyes;eye movements;biological data},
    Pages = {24--69},
    Publisher = {Springer New York},
    Title = {Anatomy and Physiology of Eye Movements},
    Url = {https://doi.org/10.1007/0-387-27925-3_2},
    Year = {2006},
    }
\end{filecontents*}
\title{This document}
\author{This author}

\begin{document}

\maketitle

I have cited this document \cite{wright2006}

\bibliographystyle{IEEEtran}
\bibliography{references}
\end{document}
0

1 Answer 1

4

Contrary to what you wrote in the title of your posting, it's not the hyphens in the url and doi fields that are giving you grief. Instead, it's the underscore characters: _. You need to load the url package, preferably with the option hyphens, in the preamble. That way, TeX and BibTeX won't try to interpret _ as the initiator of subscript material in a url or doi string.

A separate issue: it's not correct to use the entry type @inbook for the entry at hand. Use @incollection instead.

Finally, the name of the bibliography style is IEEEtran, not ieeetran.

A full MWE (minimum working example):

enter image description here

\RequirePackage{filecontents}
\begin{filecontents*}{references.bib}
@incollection{wright2006,
    Author = {Wright, Kenneth W.},
    Title  = {Anatomy and Physiology of Eye Movements},
    Editor = {Wright, Kenneth W. and Spiegel, Peter H. and Thompson, Lisa S.},
    Booktitle= {Handbook of Pediatric Strabismus and Amblyopia},
    Pages    = {24-69},
    Address  = {New York, NY},
    Publisher= {Springer},
    url      = {https://doi.org/10.1007/0-387-27925-3_2},
    Year     = {2006},
    Date-Added    = {2017-09-11 00:07:41 +0000},
    Date-Modified = {2017-09-11 00:08:45 +0000},
    Doi      = {10.1007/0-387-27925-3_2},
    Isbn     = {978-0-387-27925-1},
    Keywords = {Anatomy;Biology;anatomical data;physiology;Eyes;eye movements;biological data},
}
\end{filecontents*}

\documentclass[conference]{IEEEtran}
\usepackage[noadjust]{cite}
\usepackage[hyphens]{url} % <--- new

\begin{document}
\noindent
\cite{wright2006}
\bibliographystyle{IEEEtran}
\bibliography{references}
\end{document}

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.