2

I'd like to produce the following layout. Layout wanted

I want to be able to choose the numbering like (a) or roman I. but automatically, i don't want to number it myself. I know i can do this with enumitem but the real problem is insert math in each \item and keep a global alignment across the items, the =, the texts for all P.. [Identity]. I've tried with \intertext{\item~\phantom} inside align* and alignat* without success. I leave the text for ease of you.

\begin{enumerate}[label=(\alph*)]
\begin{alignat*}{3}
    \item 
        P+\mathcal{O}
        &=\mathcal{O}+P=P \quad
        &&\text{para todo $P\in E$.} \quad
        &&\text{[Identidad]}
    \item 
        P+(-P)
        &=\mathcal{O} \quad
        &&\text{para todo $P\in E$.} \quad
        &&\text{[Inverso]}
    \item
        \item 
        (P+Q)+R
        &=P+(Q+R) \quad
        &&\text{para todo $P,Q,R\in E$.} \quad
        &&\text{[Asociatividad]}
    \item 
        P+Q
        &=Q+P \quad
        &&\text{para todo $P,Q\in E$.} \quad
        &&\text{[Conmutatividad]}
\end{alignat*}
\end{enumerate}

The code above of course produces the error LaTeX Error: Command \item invalid in math mode.. I'd really appreciate your help.

1
  • I could agree to align the conditions, but aligning the equals signs makes no real sense, as those symbols are unrelated to one another,
    – egreg
    Commented Jan 9, 2020 at 14:39

2 Answers 2

2

I'd not align the equals signs, because they are unrelated to each other. You can use eqparbox for the task.

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

\usepackage{enumitem,eqparbox}

\newcounter{itemalign}
\newcommand{\itemalign}[3]{%
  \item
  \eqmakebox[\theitemalign-A][c]{#1}\quad
  \eqmakebox[\theitemalign-B][l]{#2}\quad
  \eqmakebox[\theitemalign-C][l]{#3}
}
\newenvironment{enumalign}
 {\stepcounter{itemalign}\begin{enumerate}[font=\upshape,label=(\alph*),leftmargin=*]}
 {\end{enumerate}}

\newtheorem{theorem}{Theorem}[section]

\newcommand{\EO}{\mathcal{O}}

\begin{document}

\section{Title}

\begin{theorem}
Let $E$ be an elliptic curve. Then the addition law on $E$ has
the following properties:
\begin{enumalign}
\itemalign{$P+\EO=\EO+P=P$}{for all $P\in E$}{\upshape[Identity]}

\itemalign{$P+(-P)=\EO$}{for all $P\in E$}{\upshape[Inverse]}

\itemalign{$(P+Q)+R=P+(Q+R)$}{for all $P,Q,R\in E$}{\upshape[Associativity]}

\itemalign{$P+Q=Q+P$}{for all $P,Q\in E$}{\upshape[Commutativity]}
\end{enumalign}
\end{theorem}

\end{document}

enter image description here

With a small change to \itemalign you can get the final labels pushed to the right margin, yet left aligned.

\newcommand{\itemalign}[3]{%
  \item
  \eqmakebox[\theitemalign-A][c]{#1}\quad
  \eqmakebox[\theitemalign-B][l]{#2}\hfill
  \eqmakebox[\theitemalign-C][l]{#3}\ignorespaces
}

enter image description here

If you insist on the alignment,

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

\usepackage{enumitem,eqparbox}

\newcounter{itemalign}
\newcommand{\itemalign}[4]{%
  \item
  \eqmakebox[\theitemalign-A][r]{#1}
  \eqmakebox[\theitemalign-B][l]{#2}\quad
  \eqmakebox[\theitemalign-C][l]{#3}\quad
  \eqmakebox[\theitemalign-D][l]{#4}
}
\newenvironment{enumalign}
 {\stepcounter{itemalign}\begin{enumerate}[font=\upshape,label=(\alph*),leftmargin=*]}
 {\end{enumerate}}

\newtheorem{theorem}{Theorem}[section]

\newcommand{\EO}{\mathcal{O}}

\begin{document}

\section{Title}

\begin{theorem}
Let $E$ be an elliptic curve. Then the addition law on $E$ has
the following properties:
\begin{enumalign}
\itemalign{$P+\EO$}{${}=\EO+P=P$}{for all $P\in E$}{\upshape[Identity]}

\itemalign{$P+(-P)$}{${}=\EO$}{for all $P\in E$}{\upshape[Inverse]}

\itemalign{$(P+Q)+R$}{${}=P+(Q+R)$}{for all $P,Q,R\in E$}{\upshape[Associativity]}

\itemalign{$P+Q$}{${}=Q+P$}{for all $P,Q\in E$}{\upshape[Commutativity]}
\end{enumalign}
\end{theorem}

\end{document}

enter image description here

2
  • Interesting. The format of 3rd argument could defined in the command, right? Since they are supposed to be formatted like that, in upright and inside brackets.
    – Sigur
    Commented Jan 9, 2020 at 15:25
  • @Sigur Yes; I opted to not go with that optimization.
    – egreg
    Commented Jan 9, 2020 at 15:26
1

I'm almost sure that there are other solution more elegant. But, this is a possible one:

enter image description here

\documentclass[11pt,a4paper]{report}
\usepackage{amsthm,amsmath,amssymb,amsfonts}
\usepackage{lipsum}

\newcounter{fooeq}
\renewcommand{\thefooeq}{\alph{fooeq}}
\newcommand{\myfooeq}{\refstepcounter{fooeq}\textup{(\thefooeq)}}

\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
\lipsum[2]
\par\noindent
$
\begin{aligned}
\myfooeq && P+\mathcal{O} &= \mathcal{O}+P=P && \text{para todo $P\in E$.} && \textup{[Identidad]}\\
\myfooeq && P+(-P)        &= \mathcal{O}     && \text{para todo $P\in E$.} && \textup{[Inverso]}
\end{aligned}
$
\end{theorem}

\lipsum[2]
\end{document}
2
  • Make the counter referable with \refstepcounter{<newcounter>}.
    – azetina
    Commented Jan 9, 2020 at 14:50
  • @azetina, well observed. Thanks.
    – Sigur
    Commented Jan 9, 2020 at 14:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .