# Making an array in the Table

So we have an Table and there is an array which we wish to have it in the Table:

Here is the code

\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}


We have the array outside the Table I: Question: What we wish is that to put this array form:

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


into the table, which a single array exactly joins the two command lines $S_1=\int x_1{}^2$, $S_2=\int x_2{}^2$ together inside the table. How to do that?

While we keep $Y3$ and $G_4$ separated not joined by another array.

• argggg all those \; came back:-) and the [!h] – David Carlisle May 24 '14 at 0:24

Here is a more compact code, with the cases and matrix* environments. In addition, as I don't like too small integrals, I used the medint switch from the nccmath package:

\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} There's nothing fancy about putting an array inside 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}


If you must "keep Y3 and G4 ... not joined by another array", the following produces the exact same output (with proper alignment of Y3 and G4:

\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}

• OP asked "While we keep $Y3$ and $G_4$ separated not joined by another array." (which is why the alignment is worse in my image:-) – David Carlisle May 24 '14 at 0:41
• @DavidCarlisle: Done... sorry, it didn't seem reasonable. – Werner May 24 '14 at 0:54
• It's not:-) (actually OP may have just meant that Y_3/G_4 were not to be braced, so perhaps you should put it back – David Carlisle May 24 '14 at 1:05 \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}


Here is a different approach.

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

\newcommand{\head}{%       %% 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} And another:

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

\newcommand{\head}{%       %% 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}
{"ft_lang_label":"__label__en","ft_lang_prob":0.5064255,"math_prob":0.9997967,"size":1256,"snap":"2019-51-2020-05","text_gpt3_token_len":558,"char_repetition_ratio":0.20367412,"word_repetition_ratio":0.21296297,"special_character_ratio":0.4936306,"punctuation_ratio":0.26436782,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9996489,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12],"im_url_duplicate_count":[null,1,null,1,null,1,null,1,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-01-22T04:22:44Z\",\"WARC-Record-ID\":\"<urn:uuid:9a10140d-6afb-4ad3-8f3a-bc41e265986c>\",\"Content-Length\":\"163945\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:68880065-59b3-4825-9fb0-fb694f8c4d72>\",\"WARC-Concurrent-To\":\"<urn:uuid:aa364aff-eec7-46e9-babf-85d11bb3fa69>\",\"WARC-IP-Address\":\"151.101.1.69\",\"WARC-Target-URI\":\"https://tex.stackexchange.com/questions/180071/making-an-array-in-the-table\",\"WARC-Payload-Digest\":\"sha1:VGCNGLYCK2VZIRVDPJ36MUZDICGONCUY\",\"WARC-Block-Digest\":\"sha1:2SNASY37FQNOJKJ3RMUMK7S4XOYPLG3J\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-05/CC-MAIN-2020-05_segments_1579250606696.26_warc_CC-MAIN-20200122042145-20200122071145-00336.warc.gz\"}"}