I'd like to give another view of your question and why it got closed.
In my humble opinion, the question, as it is, doesn't provide enough information about what is being asked. I have the feeling that the error you reported is happening at the conversion time, rst -> <format>
, and not the in the LaTeX -> PDF
generation.
The error message clearly points at an error in the .rst
file:
System Message: ERROR/3 (<fullpath>/AccrualsImplementor.rst, line 83)
You are right to think that either TeX or MathJaX (which implements a subset of TeX math stuff) will render your :math:
element later on, but the parsing itself is failing, so it's not TeX fault. In this error level, it's a .rst
syntax issue.
You are right in using \_
to display a literal underscore. That's the correct way of using it, including in Sphinx. I wrote the following .rst
sample file:
Hello! :math:`a^2 + b^2 a\_b = c^2`.
.. math::
(a + b)^2 = a^2 + 2ab + b^2
(a - b)^2 = a^2 - 2ab a\_b + b^2
Then I tried to generate an HTML version:
$ make html
Running Sphinx v1.1.3
loading pickled environment... done
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
writing additional files... genindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded.
Build finished. The HTML pages are in _build/html.
which gave me:

And then I generated the LaTeX output:
$ make latex
Running Sphinx v1.1.3
loading pickled environment... done
building [latex]: all documents
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
processing Test.tex... index
resolving references...
writing... done
copying TeX support files... done
build succeeded.
Build finished; the LaTeX files are in _build/latex.
The relevant part of the generated .tex
file:
\begin{document}
\maketitle
\tableofcontents
\phantomsection\label{index::doc}
Hello! $a^2 + b^2 a\_b = c^2$.
\begin{gather}
\begin{split}(a + b)^2 = a^2 + 2ab + b^2\end{split}\notag\\\begin{split}(a - b)^2 = a^2 - 2ab a\_b + b^2\end{split}\notag
\end{gather}
\renewcommand{\indexname}{Index}
\printindex
\end{document}
After running pdflatex
, I have:

So you see, the problem has to rely in your .rst
file.
The second part would involve posting relevant part of your code for us to reproduce your error - a minimal example. This is highly recommended, so we can track down the offending code and help you solve it. Sadly, the question only had an error message, without either the .rst
or .tex
code, so little we could do. :(
And since the error was not TeX-related, the question was closed as off-topic.
Don't take the closing issue too seriously, this is a great community, and I'm sure we would solve the error if it was really TeX-based. Sadly, as it is, .rst
is not our cup of tea. :(
Anyway, my advice is to take a look at your .rst
, I'm sure it's a markup problem, or even an error that happened some lines before and got propagated to the math part. :)