如何並排放置兩個帶下支撐的「表格」表格?

如何並排放置兩個帶下支撐的「表格」表格?

這段程式碼:

    Relations $r, s:$
    \[\underbrace{\begin{tabular}{||c c||}
                \hline
                A        & B \\ [0.5ex]
                \hline \hline
                $\alpha$ & 1 \\
                \hline
                $\alpha$ & 2 \\
                \hline
                $\beta$  & 1 \\
                \hline
            \end{tabular}}_{r}\] & \[\underbrace{\begin{tabular}{||c c||}
        \hline
        A        & B \\ [0.5ex]
        \hline \hline
        $\alpha$ & 2 \\
        \hline
        $\beta$  & 3 \\
        \hline
        \hline
    \end{tabular}_{aaa}\]

導致我Misplaced alignment tab character &.LaTeX出錯。

如果我刪除&,表格不會對齊,所以,呃。我怎樣才能做到這一點?

在此輸入影像描述

請不要讓解決方案變得太複雜,我只是在閱讀講義時使用 LaTeX 作為分散注意力的工具。只求視覺享受。

答案1

您正在使用顯示的數學(\[...\]),它們形成自己的一行,因此沒有按照您的意圖進行。將它們替換為內聯數學($...$\(...\)您喜歡的任何形式)。

錯位的對齊製表符是&您放置在兩個tabular環境之間的字元。由於它超出了任何錯誤的對齊方式,因此將其刪除。

第一行的:內部給出了錯誤的間距,請改用。$...$$r, s$:

可能還有其他事情可以在視覺上改進,但“請不要使解決方案過於複雜”,所以這裡是:

\documentclass{article}

\begin{document}
Relations $r, s$:

$\underbrace{\begin{tabular}{||c c||}
    \hline
    A        & B \\ [0.5ex]
    \hline \hline
    $\alpha$ & 1 \\
    \hline
    $\alpha$ & 2 \\
    \hline
    $\beta$  & 1 \\
    \hline
\end{tabular}}_{r}$ 
$\underbrace{\begin{tabular}{||c c||}
    \hline
    A        & B \\ [0.5ex]
    \hline \hline
    $\alpha$ & 2 \\
    \hline
    $\beta$  & 3 \\
    \hline
    \hline
\end{tabular}}_{aaa}$
\end{document}

在此輸入影像描述


您也可以考慮使用array而不是tabular.最大的區別是array每個單元格都處於數學模式,因此您不需要around$...$\alphaAB\mathrm{A}\mathrm{B}

\documentclass{article}

\begin{document}
Relations $r, s$:

$\underbrace{\begin{array}{||c c||}
    \hline
    A      & B \\ [0.5ex]
    \hline \hline
    \alpha & 1 \\
    \hline
    \alpha & 2 \\
    \hline
    \beta  & 1 \\
    \hline
\end{array}}_{r}$
$\underbrace{\begin{array}{||c c||}
    \hline
    A      & B \\ [0.5ex]
    \hline \hline
    \alpha & 2 \\
    \hline
    \beta  & 3 \\
    \hline
    \hline
\end{array}}_{aaa}$
\end{document}

在此輸入影像描述

相關內容