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 E[X|\mathcal{A}_1](\omega)=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}
1
  • 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
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 @[email protected]][l]{#1}%
  ${}\Longrightarrow{}$%
  \eqmakebox[@@\themathenum @[email protected]][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\}$}
             {$E[X|\mathcal{A}_1](\omega)=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 @[email protected]][l]{#1}%
  \eqmakebox[@@\themathenum @[email protected]][c]{${}#2{}$}%
  \eqmakebox[@@\themathenum @[email protected]][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}
             {$E[X|\mathcal{A}_1](\omega)=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

5
  • 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
    – Á. Iborra
    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?
    – Á. Iborra
    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
    – Á. Iborra
    Nov 30 '21 at 15:46
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 E[X|\mathcal{A}_1](\omega)=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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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