New line in subscript in share latex

7.1k views Asked by At

I am trying to shift this extra long subscript to the line below, because it is too long. The code is

\mathop{\mathbb{E}}_{x \in p_{data}(x), z \in p_{z}(z)}

And the expression looks like :

The current expression.

I want the characters z onwards to be in a new line, while being the subscript to E.

Thanks!

3

There are 3 answers

0
MattAllegro On

There are three different specific ways to do this (one command substack and one environment subarray with at least two different alignment options l and c), provided by the package amsmath (see section 7.1 of the guide, at page 21). All of them work in inline math mode as well. To type your code, the package amssymb is necessary too (although \mathop{\mathbb{E}} is maybe redundant).

This code

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}
\[
\mathop{\mathbb{E}}_{\substack{x \in p_{data}(x),\\ z \in p_{z}(z)}}
\]

\[
\mathop{\mathbb{E}}_{\begin{subarray}{l}x \in p_{data}(x),\\ z \in p_{z}(z)\end{subarray}}
\]

\[
\mathop{\mathbb{E}}_{\begin{subarray}{c}x \in p_{data}(x),\\ z \in p_{z}(z)\end{subarray}}
\]
\end{document}

gives this output:

screenshot of output

0
Ramón Correa On

you are looking for substack

\mathbb{E}}_{\substack{x \in p_{data}(x)\\z \in p_{z}(z)}}
1
blackbird On

Instead of \mathop directive you can use the following:

$\mathbb{E}}_{x \in p_{data}(x),$

$z \in p_{z}(z)}$

Which will render this: final rendering in sharelatex

Another alternative

$\mathbb{E}}_{x \in p_{data}(x),$

$_{z \in p_{z}(z)}}$

which will render into: 2nd sample image