The index.rst file below demonstrates that \newcommand does not work with latexpdf.
------------ Below is my conf.py file ------------------------ # For conf.py documentation see # http://www.sphinx-doc.org/en/master/config # project = 'newcommand' extensions = [ 'sphinx.ext.mathjax', ] ------------- Below is my index.rst file ------------------------- Problem With \newcommand in latexpdf #################################### This file builds just file, and displays as intended, with ``make html``, but with ``make latexpdf`` it generates and ``Undefined control sequence.`` error for the macro ``\B``. Define Latex Macro ****************** ``:math: \newcommand{\B}[1]{{\bf #1}}`` :math:`\newcommand{\B}[1]{{\bf #1}}` Use Latex Macro \B ****************** ``:math: f : \B{R} \rightarrow \B{R}`` :math:`f : \B{R} \rightarrow \B{R}` This File ********* .. literalinclude:: index.rst -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/92312617-c0dc-4c14-9d41-068e79f7bd76n%40googlegroups.com.