表格嵌套对齐错误,缺少 \endgroup 插入

表格嵌套对齐错误,缺少 \endgroup 插入

我正在尝试创建一个包含两列的表格,每列中有两个通过等号对齐的矩阵。但每次我尝试编译时都会出现相同的错误。

以下是我的想法:

\documentclass[10pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{array}
\usepackage{enumitem}
\usepackage[mathscr]{euscript}
\let\euscr\mathscr \let\mathscr\relax% just so we can load this and rsfs
\usepackage[scr]{rsfso}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}

% <========Start defined commands===========>
\newcommand{\Tdot}{\ensuremath{\dot{T}}}
\newcommand{\tdot}{\ensuremath{\dot{t}}}
\newcommand{\lambdadot}{\ensuremath{\dot{\lambda}}}
\newcommand{\varnothingdot}{\ensuremath{\dot{\varnothing}}}
\newcommand{\stardot}{\ensuremath{\dot{\star}}}
\newcommand{\plusdot}{\ensuremath{\dot{+}}}
\newcommand{\dotdot}{\ensuremath{\dot{\bullet}}}
\newcommand{\st}{\ensuremath{\ | \ }}
\newcommand{\re}{\ensuremath{RegExp }}
\newcommand{\pre}{\ensuremath{PrimRegExp }}
% <========End defined commands===========>

\section{Test 1 Review}

\section{Test 2 Review}
\subsection{Definitions}
% <========Start the definitions===========>
\begin{itemize}[label={-}]
    \item \textbf{Rules for Operations}
        \begin{enumerate}
            \item Every \pre \ is declared as \re. 
            \item $If \alpha, \beta \in \re \ then$\\ \\
                \begin{tabular}{cc}
                        \begin{align*}
                            \alpha \plusdot \beta = \alpha \cdot \langle \plusdot \rangle \cdot \beta \\
                            \alpha \dotdot \beta = \alpha \cdot \langle \plusdot \rangle \cdot \beta \\
                            \alpha^{\stardot} = \alpha \cdot \langle \stardot \rangle \\
                        \end{align*}
                        & 
                        \begin{align*}
                            lh(\alpha \cdot \langle \plusdot \rangle \cdot \beta) = lh(\alpha) + 1 + lh(\beta) \\ 
                            lh(\alpha \cdot \langle \dotdot \rangle \cdot \beta) = lh(\alpha) + 1 + lh(\beta) \\ 
                            lh(\alpha \cdot \langle \stardot \rangle) = lh(\alpha) + 
                        \end{align*} \\
                \end{tabular}
        \end{enumerate}

\end{itemize} 
% <========End the definitions===========>
\end{document}

答案1

align*尝试创建一个显示的方程,但该方程在表格中并不正确。请$\begin{aligned}...\end{aligned}$改用:

            \begin{tabular}{cc}
                    $\begin{aligned}
                        \alpha \plusdot \beta = \alpha \cdot \langle \plusdot \rangle \cdot \beta \\
                        \alpha \dotdot \beta = \alpha \cdot \langle \plusdot \rangle \cdot \beta \\
                        \alpha^{\stardot} = \alpha \cdot \langle \stardot \rangle \\
                    \end{aligned}$
                    & 
                    $\begin{aligned}
                        lh(\alpha \cdot \langle \plusdot \rangle \cdot \beta) = lh(\alpha) + 1 + lh(\beta) \\ 
                        lh(\alpha \cdot \langle \dotdot \rangle \cdot \beta) = lh(\alpha) + 1 + lh(\beta) \\ 
                        lh(\alpha \cdot \langle \stardot \rangle) = lh(\alpha) + 
                    \end{aligned}$
            \end{tabular}

答案2

align在 内不需要tabular。在 内,只需在另一个 中列出内容array

在此处输入图片描述

\documentclass{article}

\usepackage{amsmath,enumitem}

\newcommand{\stardot}{\mathbin{\dot{\star}}}
\newcommand{\plusdot}{\mathbin{\dot{+}}}
\newcommand{\dotdot}{\mathbin{\dot{\bullet}}}
\newcommand{\re}{\text{RegExp}}
\newcommand{\pre}{\text{PrimRegExp}}

\begin{document}

\section{Test 1 Review}

\section{Test 2 Review}
\subsection{Definitions}

\begin{itemize}[label={-}]
  \item \textbf{Rules for Operations}
    \begin{enumerate}
      \item Every \pre \ is declared as \re. 
      \item If $\alpha, \beta \in \re$ then \\ \\
        \begin{tabular}{cc}
          $\begin{array}{c}
            \alpha \plusdot \beta = \alpha \cdot \langle \plusdot \rangle \cdot \beta \\
            \alpha \dotdot \beta = \alpha \cdot \langle \plusdot \rangle \cdot \beta \\
            \alpha^{\stardot} = \alpha \cdot \langle \stardot \rangle
          \end{array}$
          & 
          $\begin{array}{c}
            lh(\alpha \cdot \langle \plusdot \rangle \cdot \beta) = lh(\alpha) + 1 + lh(\beta) \\ 
            lh(\alpha \cdot \langle \dotdot \rangle \cdot \beta) = lh(\alpha) + 1 + lh(\beta) \\ 
            lh(\alpha \cdot \langle \stardot \rangle) = lh(\alpha) + 1 + lh(\beta)
          \end{array}$
        \end{tabular}
    \end{enumerate}

\end{itemize}

\end{document}

我对你的定义提出了一些建议。

答案3

也许你喜欢这样:

在此处输入图片描述

displaymath由于表仅包含方程式,因此在环境中将其写为数组是合理的:

\documentclass[10pt,letterpaper]{article}
\usepackage{mathtools}
\usepackage{enumitem}

\usepackage{lipsum} % for dummy text

\newcommand{\stardot}{\mathbin{\dot{\star}}}
\newcommand{\plusdot}{\mathbin{\dot{+}}}
\newcommand{\dotdot}{\mathbin{\dot{\bullet}}}
\newcommand{\re}{\text{RegExp}}
\newcommand{\pre}{\text{PrimRegExp}}

\begin{document}
\lipsum*[11]
    \begin{itemize}[label={-}]
\item \textbf{Rules for Operations}
    \begin{enumerate}
\item   Every \pre \ is declared as \re.
\item   If $\alpha, \beta \in \re$ then 
    \[\setlength\arraycolsep{1pt}
    \begin{array}{rl c rl}
    \alpha \plusdot \beta   & = \alpha \cdot \langle \plusdot \rangle \cdot \beta 
        & \quad & 
    lh(\alpha \cdot \langle \plusdot \rangle \cdot \beta) 
                    & = lh(\alpha) + 1 + lh(\beta)              \\
    \alpha \dotdot \beta    & = \alpha \cdot \langle \plusdot \rangle \cdot \beta 
        & \quad &
    lh(\alpha \cdot \langle \dotdot \rangle \cdot \beta) 
                            & = lh(\alpha) + 1 + lh(\beta)      \\
    \alpha^{\stardot}       & = \alpha \cdot \langle \stardot \rangle
        & \quad &
    lh(\alpha \cdot \langle \stardot \rangle) 
                            & = lh(\alpha) + 1 + lh(\beta)
          \end{array}
    \]
    \end{enumerate}
\end{itemize}
\end{document}

相关内容