我希望能够选择像 (a) 或罗马字母 I 这样的编号。但我不想自己自动编号。我知道我可以用它做到这一点,enumitem
但真正的问题是在每个中插入数学\item
并保留一个全球的跨项目、=
文本进行对齐for all P..
[Identity]
。我尝试过\intertext{\item~\phantom}
内部对齐align*
,但alignat*
没有成功。我留下了文本以方便您使用。
\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}
上面的代码当然会产生错误LaTeX Error: Command \item invalid in math mode.
。非常感谢您的帮助。
答案1
我不会对齐等号,因为它们彼此无关。您可以将其用于eqparbox
任务。
\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}
只需稍加改动,\itemalign
您便可以将最终的标签推到右边距,但左对齐。
\newcommand{\itemalign}[3]{%
\item
\eqmakebox[\theitemalign-A][c]{#1}\quad
\eqmakebox[\theitemalign-B][l]{#2}\hfill
\eqmakebox[\theitemalign-C][l]{#3}\ignorespaces
}
如果你坚持要对齐,
\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}
答案2
我几乎确信还有其他更优雅的解决方案。但是,这是一个可能的解决方案:
\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}