3

Is it possible to align \items content inside enumerateenvironment?

My expected output is:

enter image description here

Which I got manually, (adjusting with \hspace)

These answers:

Aligning formulas inside enumerate

Equations inside enumerate aligned on item's number

don't respond my question because they try to use align inside the \items

Neither Enumerate inside align

MWE

\documentclass{article}
\usepackage{enumitem}

\begin{document} \begin{enumerate} \item $X$ integrable $\Longrightarrow E[X|\mathcal{A}_1]$ integrable y $E[E[X|\mathcal{A}_1]]=E[X]$ \item $\mathcal{A}_1={\emptyset,\Omega} \Longrightarrow EX|\mathcal{A}_1=E[X],\ \forall \omega\in\Omega$ \item $\mathcal{A}_1=\mathcal{A}\Longrightarrow E[X|\mathcal{A}_1]=X \ c.s.[P_1]$ \end{enumerate} \end{document}

Blooment
  • 666
  • Probably the only thing you can do here is to make boxes of the same size to wrap the part before \Longrightarrow. Do be honest, I don't see the point in aligning here. – daleif Nov 29 '21 at 12:19

2 Answers2

4

I wouldn't persist with use of enumerate. Numbers can be writen for example in alignat* examle encapsulated in fleqn environment defined in the nccmath package:

\documentclass{article}
\usepackage{nccmath}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document} \begin{fleqn} \begin{alignat}{3} &1.\ X \text{ integrable}\hspace{-11em} &\quad& \Longrightarrow E[X|\mathcal{A}_1] \text{ integrable y } E[E[X|\mathcal{A}_1]]=E[X] \ &2.\ \mathcal{A}_1 ={\emptyset,\Omega} && \Longrightarrow EX|\mathcal{A}_1=E[X],\ \forall \omega\in\Omega
\ &3.\ \mathcal{A}_1 =\mathcal{A} && \Longrightarrow E[X|\mathcal{A}_1]=X \ c.s.[P_1] \tag{$c.s.[P_1]$}
\end{alignat
} \end{fleqn} \end{document}

enter image description here

(red lines indicate text borders)

Zarko
  • 296,517
4

Assuming this is not the only such display in your document, you might use eqparbox facilities.

\documentclass{article}
\usepackage{enumitem}
\usepackage{eqparbox}

\newcounter{mathenum}

\newenvironment{mathenum} {\begin{enumerate}\stepcounter{mathenum}} {\end{enumerate}} \newcommand{\mathenumitem}[3]{% \item \eqmakebox[@@\themathenum @A@][l]{#1}% ${}\Longrightarrow{}$% \eqmakebox[@@\themathenum @B@][l]{#2}% \quad#3% }

\begin{document}

\begin{mathenum} \mathenumitem{$X$ integrable} {$E[X|\mathcal{A}_1]$ integrable y $E[E[X|\mathcal{A}_1]]=E[X]$} {} \mathenumitem{$\mathcal{A}_1={\emptyset,\Omega}$} {$EX|\mathcal{A}_1=E[X],\ \forall \omega\in\Omega$} {} \mathenumitem{$\mathcal{A}_1=\mathcal{A}$} {$E[X|\mathcal{A}_1]=X$} {c.s.$[P_1]$} \end{mathenum}

\end{document}

enter image description here

A slightly different version where the central symbol (which is supposed to be an arrow) can vary:

\documentclass{article}
\usepackage{enumitem}
\usepackage{eqparbox}

\newcounter{mathenum}

\newenvironment{mathenum} {\begin{enumerate}\stepcounter{mathenum}} {\end{enumerate}} \newcommand{\mathenumitem}[4]{% \item \eqmakebox[@@\themathenum @A@][l]{#1}% \eqmakebox[@@\themathenum @B@][c]{${}#2{}$}% \eqmakebox[@@\themathenum @C@][l]{#3}% \quad#4% }

\begin{document}

\begin{mathenum} \mathenumitem{$X$ integrable} {\Longrightarrow} {$E[X|\mathcal{A}_1]$ integrable y $E[E[X|\mathcal{A}_1]]=E[X]$} {} \mathenumitem{$\mathcal{A}_1={\emptyset,\Omega}$} {\Longleftrightarrow} {$EX|\mathcal{A}_1=E[X],\ \forall \omega\in\Omega$} {} \mathenumitem{$\mathcal{A}_1=\mathcal{A}$} {\Longleftarrow} {$E[X|\mathcal{A}_1]=X$} {c.s.$[P_1]$} \end{mathenum}

\end{document}

enter image description here

egreg
  • 1,121,712
  • The newenvironment you defined is so useful. Is it possible to have different symbols in each line? For example, Longright arrow in the first one, and iff in the second one – Blooment Nov 30 '21 at 11:27
  • @Á.Iborra Add other arguments along the same lines. You will probably need another label for \eqmakebox. I added a sketch. – egreg Nov 30 '21 at 11:44
  • First time using \eqmakebox, do you know why can't I nest mathenum into tcolorbox theorem? – Blooment Nov 30 '21 at 15:29
  • @Á.Iborra This warrants a new question with the details. My crystal ball is under maintainance. ;-) – egreg Nov 30 '21 at 15:34
  • It worked well, typo mistake. Your answer was so clear that I asked again before looking for fails. Thank you for the details – Blooment Nov 30 '21 at 15:46