0
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[natbibapa]{apacite}

\title{For testing}

\begin{document}

Information about natbib in \citeauthor{sharelatex}.

\bibliographystyle{apacite}
\bibliography{bibli.bib}

\end{document}

This gives the error "Missing $ inserted". What has mathmode to do with apacite or citeauthor?

5
  • 7
    Check if there aren't any $ in your bibli.bib file. Feb 22, 2018 at 16:01
  • Welcome to TeX.Stackexchange! Can you share your .bib file? Feb 22, 2018 at 16:13
  • 2
    Further to @PhelypeOleinik 's comment, anything that could cause TeX to enter mathmode in a .bib entry (e.g., underscores) could cause this. But without looking at the specify .bib entry, it's hard to tell.
    – Alan Munn
    Feb 22, 2018 at 16:19
  • @samcarter This is the only content in my bib file: @misc{sharelatex, title={ShareLaTeX, the Online LaTeX Editor}, url={nl.sharelatex.com/learn/Natbib_citation_styles}, journal={ShareLaTeX, Online LaTeX-verwerker}}
    – Simsa
    Feb 23, 2018 at 7:56
  • @AlanMunn See my answer above. BTW, Is it possible to reply to multiple anwers :) ?
    – Simsa
    Feb 23, 2018 at 8:09

1 Answer 1

3

The problem is the _ in the url, which can normally only be used in math mode. In order to use them in a url, either use the url or the hyperref package.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[natbibapa]{apacite}

\usepackage{url}


\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@misc{sharelatex, 
    title={ShareLaTeX, the Online LaTeX Editor},
    url={nl.sharelatex.com/learn/Natbib_citation_styles},
    journal={ShareLaTeX, Online LaTeX-verwerker}
} 
\end{filecontents*}


\title{For testing}

\begin{document}

Information about natbib in \citeauthor{sharelatex}.

\bibliographystyle{apacite}
\bibliography{\jobname}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .