.. raw:: latex

    \marginpar{% Avoid creating empty vertical space for the math definitions

.. rst-class:: hidden
.. math::

    \gdef\dirac#1{\operatorname{\delta}\left(#1\right)}
    \gdef\e#1{\operatorname{e}^{#1}}
    \gdef\Hankel#1#2#3{\mathop{{}H_{#2}^{(#1)}}\!\left(#3\right)}
    \gdef\hankel#1#2#3{\mathop{{}h_{#2}^{(#1)}}\!\left(#3\right)}
    \gdef\i{\mathrm{i}}
    \gdef\scalarprod#1#2{\left\langle#1,#2\right\rangle}
    \gdef\vec#1{\mathbf{#1}}
    \gdef\wc{\frac{\omega}{c}}
    \gdef\w{\omega}
    \gdef\x{\vec{x}}
    \gdef\n{\vec{n}}

.. raw:: latex

    }

.. raw:: latex

    \marginpar{% Avoid creating empty vertical space for the math definitions

.. rst-class:: hidden
.. math::

    \gdef\dirac#1{\mathop{{}\delta}\left(#1\right)}
    \gdef\e#1{\operatorname{e}^{#1}}
    \gdef\Hankel#1#2#3{\mathop{{}H_{#2}^{(#1)}}\!\left(#3\right)}
    \gdef\hankel#1#2#3{\mathop{{}h_{#2}^{(#1)}}\!\left(#3\right)}
    \gdef\i{\mathrm{i}}
    \gdef\scalarprod#1#2{\left\langle#1,#2\right\rangle}
    \gdef\vec#1{\mathbf{#1}}
    \gdef\wc{\frac{\omega}{c}}
    \gdef\w{\omega}
    \gdef\x{\vec{x}}
    \gdef\n{\vec{n}}

.. raw:: latex

    }

Use \mathop instead of \operatorname
Use \mathop instead of \operatorname
