3

So I'm trying to do a bibliography for my report on overleaf using LaTeX, and most of my sources are website that have URLs. I keep getting " Missing $ inserted. " I have used any "$" signs, so I'm not sure why I keep getting this error. Any help would be much appreciated thank you This is how I coded my sources

misc{website:Stanford,
  author = {Stanford Center for Professional Development},
  title = {CS221 - Artificial Intelligence Principles and Techniques},
  month = {October},
  year = {2016},
  URL ={http://scpd.stanford.edu/search/publicCourseSearchDetails.do?method=load&courseId=11747},
}

@misc{website:CIPS2,
  author = {CIPS},
  title = {Computer Science Accredited Programs},
  month = {October},
  year = {2016},
  URL ={http://www.cips.ca/ComputerScience},
}
  • 3
    Welcome to TeX.SX! I imagine you need to escape the & in the URL of website:Stanford this can be done by replacing & with \& (How to escape the & (ampersand) character in BibTeX?). You're also missing an @, it should be @misc. If this isn't helpful we may need you to provide a minimal working example (MWE) – Dai Bowen Oct 10 '16 at 20:47
  • 2
    the & would give an error but not about $ the most likely cause of that error is _ – David Carlisle Oct 10 '16 at 20:50
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. A suggestion: Do us a favour and change your username to something more telling than "user1234". – Martin Schröder Oct 10 '16 at 21:00
  • 1
    The .bibentries you have shown look innocent enough (if processed with the right bibliography styles). Please consider constructing a full MWE that reproduces the problem for us. Ideally that would just be one block of code we can copy, paste and hit compile on that shows exactly the error you get. Do check if the errors are really the same, please. – moewe Oct 10 '16 at 22:06
1

Don't "escape" the special characters ($, _, $, etc) if they occur in URL strings, as escaping them will almost certainly render the URL strings unusable.

Instead, encase the URL strings in \url{...} macros (and load the url package). Better still, use a bibliography style that knows how to handle fields named URL -- plainnat, unsrtnat, and abbrvnat are three such styles -- and load the natbib package.

enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{mybib.bib}
@misc{website:Stanford,
  author = {Stanford Center for Professional Development},
  title = {CS221---{Artificial} Intelligence Principles and Techniques},
  month = {October},
  year = {2016},
  URL ={http://scpd.stanford.edu/search/publicCourseSearchDetails.do?method=load&courseId=11747},
}

@misc{website:CIPS2,
  author = {CIPS},
  title = {Computer Science Accredited Programs},
  month = {October},
  year = {2016},
  URL ={http://www.cips.ca/ComputerScience},
}
\end{filecontents}
\documentclass{article}
\usepackage[hyphens]{url} % for "\url" macro (used by natbib for "url" fields)
\usepackage[numbers]{natbib}
\bibliographystyle{plainnat}

\begin{document}
\nocite{*}
\raggedright
\bibliography{mybib}
\end{document}
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.