在表中创建数组

在表中创建数组

因此,我们有一个表,并且有一个数组,我们希望将其包含在表中:

以下是代码

\documentclass[onecolumn,amsmath,amssymb,nofootinbib,superscriptaddress,floatfix]{revtex4}
\begin{document}



\begin{table}[!h]
\begin{tabular}{|c ||c| c| c| c|}  
 \hline
$d$ \; & \;  $Z$  & \; $UZ1$ & \; $UZ2$ & \; $U$\\  
               \; & \;   & \;       \;   & \;       \;   & \;   \\ \hline        
$d=1$    \; & \; $S_1=\int x_1{}^2$,    & \;  $Y_3=\int y_3{}^2$,       \;   & \;       \;   & \;  \\
              \; & \;  $S_2=\int x_2{}^2$  & \;   $G_4=\int g_4{}^2$    \;   & \;    \;   & \;   \\   \cline{2-5}           
              \; & \multicolumn{4}{l|}{$S1, S2, S3, \dots$ }  \\   \hline    
$d=2$       \; & \;   & \;       \;   & \;     \;   & \;   \\
                  \; & \;   & \;       \;   & \;    \;   & \;   \\   \hline    
 \end{tabular}
\caption{}
\end{table}


 $$
 \left\{ 
 \begin{array}{ll} 
 S_1=\int x_1{}^2,\\
 S_2=\int x_2{}^2 
  \end{array}  \right.
 $$



\end{document}

我们有表 I 之外的数组:

在此处输入图片描述

问题:我们希望将这个数组形式设置为:

$$\left\{ 
     \begin{array}{ll} 
     S_1=\int x_1{}^2,\\
     S_2=\int x_2{}^2 
      \end{array}  \right.
     $$

放入表中,单个数组精确连接两个命令行$S_1=\int x_1{}^2$, $S_2=\int x_2{}^2$ 一起放在表格中。如何做到?

同时我们将 $Y3$ 和 $G_4$ 分开,而不是通过另一个数组连接。

答案1

这是一个更紧凑的代码,带有casesmatrix*环境。此外,由于我不喜欢太小的积分,我使用了包medint中的开关 nccmath

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier}

\usepackage{booktabs,mathtools, nccmath}
\def\mint{\medint\int}

\begin{document}

\renewcommand{\arraystretch}{1.2}% Stretch out the tabular
\[ \begin{array}{*{5}{c}}
  \toprule
   d & Z & UZ1 & UZ2 & U \\
  \midrule
  d = 1 & \begin{cases}
    S_1 = \mint x_1{}^2, \\[3pt]
    S_2 = \mint x_2{}^2
  \end{cases} & \begin{matrix*}[l]Y_3 = \mint y_3{}^2, \\ G_4 = \mint g_4{}^2\end{matrix*} \\
\addlinespace
      & \multicolumn{4}{l}{ S1, S2, S3, \dots } \\[0.5\normalbaselineskip]
 d = 2 \\
  \bottomrule
\end{array} \]

\end{document} 

在此处输入图片描述

答案2

array将一个放在a 里面并没有什么特别之处tabular

在此处输入图片描述

\documentclass{article}
\usepackage{booktabs,amsmath}
\begin{document}

\renewcommand{\arraystretch}{1.2}% Stretch out the tabular
\begin{tabular}{*{5}{c}}  
  \toprule
  $d$ & $Z$ & $UZ1$ & $UZ2$ & $U$ \\
  \midrule
  $1$ & \raisebox{-.5\normalbaselineskip}{$\biggl\{$}$\begin{array}[t]{@{}r@{}l@{}}
    S_1 & {}= \int x_1{}^2, \\
    S_2 & {}= \int x_2{}^2
  \end{array}$ & $\begin{array}[t]{@{}r@{}l@{}}
    Y_3 & {}= \int y_3{}^2, \\
    G_4 & {}= \int g_4{}^2
  \end{array}$ \\
      & \multicolumn{4}{l}{$S1, S2, S3, \dots$} \\[.5\normalbaselineskip]
  $2$ \\
  \bottomrule
\end{tabular}

\end{document}

如果你必须“保持34...没有被另一个连接array”,以下产生完全相同的输出(正确对齐34

\documentclass{article}
\usepackage{booktabs,mathtools}
\begin{document}

\renewcommand{\arraystretch}{1.2}% Stretch out the tabular
\begin{tabular}{*{5}{c}}  
  \toprule
  $d$ & $Z$ & $UZ1$ & $UZ2$ & $U$ \\
  \midrule
  $1$ & \smash{\raisebox{-.5\normalbaselineskip}{$\biggl\{$}$\begin{array}[t]{@{}r@{}l@{}}
    S_1 & {}= \int x_1{}^2, \\
    S_2 & {}= \int x_2{}^2
  \end{array}$} & $\phantom{G_4}\mathllap{Y_3} = \int y_3{}^2,$ \\
    & & $G_4 = \int g_4{}^2\phantom{,}$ \\
      & \multicolumn{4}{l}{$S1, S2, S3, \dots$} \\[.5\normalbaselineskip]
  $2$ \\
  \bottomrule
\end{tabular}

\end{document}

答案3

在此处输入图片描述

\documentclass[onecolumn,amsmath,amssymb,nofootinbib,superscriptaddress,floatfix]{revtex4}
\usepackage{array}

\begin{document}

\begin{table}[htp]
\setlength\tabcolsep{8pt}
\setlength\extrarowheight{2pt}
\begin{tabular}{|c ||c| c| c| c|}  
 \hline
$d$  &   $Z$  &  $UZ1$ &  $UZ2$ &  $U$\\  
                &    &           &           &    \\ \hline        
$d=1$     &  
\smash{\raisebox{-10pt}{$
 \left\{ 
 \begin{array}{ll} 
 S_1=\int x_1{}^2,\\
 S_2=\int x_2{}^2 
  \end{array}  \right.
$}}
   &   $Y_3=\int y_3{}^2$,          &           &   \\[7pt]
               &   &    $G_4=\int g_4{}^2$       &        &    \\   \cline{2-5}           
               & \multicolumn{4}{l|}{$S1, S2, S3, \dots$ }  \\   \hline    
$d=2$        &    &           &         &    \\
                   &    &           &        &    \\   \hline    
 \end{tabular}
\caption{}
\end{table}



\end{document}

答案4

这是一个不同的方法。

\documentclass[onecolumn,amsmath,amssymb,nofootinbib,superscriptaddress,floatfix]{revtex4}
\usepackage{array}

\newcommand{\head}[1]{%       %% code stolen from egreg
  \bfseries
  \begin{tabular}{@{}c@{}}
  \strut#1\strut
  \end{tabular}%
}

\begin{document}

\begin{table}[htp]
\setlength\tabcolsep{8pt}
\setlength\extrarowheight{2pt}
\begin{tabular}{|c ||c| c| c| c|}
 \hline
$d$  &   $Z$  &  $UZ1$ &  $UZ2$ &  $U$\\ \hline
\head{$d=1$}     &
\head{$
 \left\{
 \begin{array}{ll}
 S_1=\int x_1{}^2,\\
 S_2=\int x_2{}^2
  \end{array}  \right.
$}
   &   \head{$Y_3=\int y_3{}^2$,\\[7pt] $G_4=\int g_4{}^2$ }          &           &   \\\cline{2-5}
               & \multicolumn{4}{l|}{$S1, S2, S3, \dots$ }  \\   \hline
$d=2$        &    &           &         &    \\
                   &    &           &        &    \\   \hline
 \end{tabular}
\caption{}
\end{table}

\end{document}

在此处输入图片描述

另一个:

\documentclass[onecolumn,amsmath,amssymb,nofootinbib,superscriptaddress,floatfix]{revtex4}
\usepackage{array}

\newcommand{\head}[1]{%       %% code stolen from egreg
  \begin{tabular}{@{}c@{}}
  \strut#1\strut
  \end{tabular}%
}

\begin{document}

\begin{table}[htp]
\setlength\tabcolsep{8pt}
\setlength\extrarowheight{2pt}
\begin{tabular}{|c ||c| c| c| c|}
 \hline
$d$  &   $Z$  &  $UZ1$ &  $UZ2$ &  $U$\\ \hline
\raisebox{-1.5\height}{\head{$d=1$}}     &
\raisebox{-0.5\height}{\head{$
 \left\{
 \begin{array}{ll}
 S_1=\int x_1{}^2,\\
 S_2=\int x_2{}^2
  \end{array}  \right.
$}}
    &   $Y_3=\int y_3{}^2$,         &           &   \\[-1.25em]
&   &    $G_4=\int g_4{}^2$         &           &    \\   \cline{2-5} 
               & \multicolumn{4}{l|}{$S1, S2, S3, \dots$ }  \\   \hline
$d=2$        &    &           &         &    \\
                   &    &           &        &    \\   \hline
 \end{tabular}
\caption{}
\end{table}

\end{document}

在此处输入图片描述

相关内容