4

My code is

\documentclass{article}
\usepackage{amssymb,bm}
\begin{equation}
\nabla_{\theta} \bm{J}(\theta) = 
\mathbb{E}_{s \sim T^{\bm{\pi}}, a \sim \bm{\pi}_{\theta}} 
[\nabla_{\theta} \log \bm{\pi}(a | s ) \cdot  Q(s, a) ],
\end{equation}

\end{document}

And I want to break {s \sim T^{\bm{\pi}}, a \sim \bm{\pi}_{\theta}} into two lines, not put it under \mathbb{E}. In the picture below, how to move the second part after the comma and stack under the first part?

enter image description here

How can I do that? Thank you in advance.

  • Off-topic: To "snug up" the \nabla and \theta symbols, consider writing \nabla_{\!\theta}. The \! (negative thinspace) directive moves the subscript term to the left, i.e., closer to the \nabla symbol. – Mico Feb 23 at 6:34
  • Possible duplicate of Putting equations under a symbol – Zarko Feb 23 at 12:12
6

I suggest you do two things:

  • Using \DeclareMathOperator, make \E a "math operator"

  • Use the \substack macro to break the long line into two parts.

Both of these directives require loading of the amsmath package -- which you may be doing already.

enter image description here

\documentclass{article}
\usepackage{amsmath}  % for '\DeclareMathOperator' and '\substack' macros
\usepackage{amssymb}  % for '\mathbb' macro
\usepackage{bm}       % for '\bm' macro
\DeclareMathOperator{\E}{\mathbb{E}} % define expectations operator
\begin{document}

\begin{equation}
\nabla_{\!\theta} \bm{J}(\theta) = 
\E_{\substack{s \sim T^{\bm{\pi}}\\ a \sim \bm{\pi}_{\theta}}}
[\nabla_{\!\theta} \log\bm{\pi}(a\mid s ) \cdot Q(s,a) ]
\end{equation}
\end{document}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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