0

How can I convert the table into vertically oriented subtables and leave a space between them?

\documentclass{article}
\usepackage[margin=20mm]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage{tabularray}
\definecolor{lightblue}{HTML}{DDEBF7}
\definecolor{white}{HTML}{FFFFFF}
\definecolor{darkblue}{HTML}{2D87D1}



\begin{document}

\end{singlespace}
\arrayrulecolor{colour11}  
\strutlongstacks{T}
\begin{singlespace}
\scriptsize
\begin{tabular}{c|>{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm} | >{\centering\arraybackslash}m{0.7cm}}
\caption{Z4 Ttest.}\\
\endfirsthead
\caption{ \textit{(continued)}Z4 Ttest.}\\
\rowcolor{darkblue} 
\color{white}{\textbf{Sample}} & \color{white}{\textbf{Ag}} & \color{white}{\textbf{Al}} & \color{white}{\textbf{As}} & \color{white}{\textbf{Ba}} & \color{white}{\textbf{Be}} & \color{white}{\textbf{Bi}} & \color{white}{\textbf{Ca}} & \color{white}{\textbf{Cd}} & \color{white}{\textbf{Ce}}\\
\endhead 
\rowcolor{darkblue} 
\color{white}{\textbf{Sample}} & \color{white}{\textbf{Ag}} & \color{white}{\textbf{Al}} & \color{white}{\textbf{As}} & \color{white}{\textbf{Ba}} & \color{white}{\textbf{Be}} & \color{white}{\textbf{Bi}} & \color{white}{\textbf{Ca}} & \color{white}{\textbf{Cd}} & \color{white}{\textbf{Ce}}\\
\rowcolor{white} 
- & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 \\
\hline
\rowcolor{lightblue} 
- & ppm & \% & ppm & ppm & ppm & ppm & \% & ppm & ppm \\
\hline
\rowcolor{white} 
{\textbf{FR-1B-003}} & 0.56 & 15.45 & 426 & 280 & 3.55 & 0.28 & 1.72 & 0.22 & 50.4 \\
\hline
\rowcolor{lightblue} 
{\textbf{FR-1B-004}} & 0.69 & 13.2 & 158 & 40 & 2.72 & 0.32 & 1.21 & 0.13 & 46.3 \\
\hline
\rowcolor{white} 
{\textbf{FR-1B-007}} & 0.05 & 9.61 & 165 & 150 & 3.06 & 0.29 & 0.66 & 0.02 & 76 \\
\hline
\rowcolor{lightblue} 
{\textbf{FR-1B-010}} & 0.04 & 8.1 & 63.3 & 930 & 2.27 & 0.29 & 0.92 & 0.07 & 72.7 \\
\hline
\rowcolor{white} 
{\textbf{FR-1B-011}} & 0.11 & 15.3 & 209 & 250 & 3.12 & 0.34 & 1.64 & 0.17 & 74.6 \\
\hline
\rowcolor{darkblue} 
\color{white}{\textbf{Sample}} & \color{white}{\textbf{Co}} & \color{white}{\textbf{Cr}} & \color{white}{\textbf{Cs}} & \color{white}{\textbf{Cu}} & \color{white}{\textbf{Fe}} & \color{white}{\textbf{Ga}} & \color{white}{\textbf{Ge}} & \color{white}{\textbf{Hf}} & \color{white}{\textbf{In}} \\
\rowcolor{white} 
- & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 \\
\hline
\rowcolor{lightblue} 
- & ppm & ppm & ppm & ppm & \% & ppm & ppm & ppm & ppm \\
\hline
\rowcolor{white} 
{\textbf{FR-1B-003}} & 9.3 & 12 & 67 & 29.9 & 4.13 & 39.9 & 0.11 & 6.6 & 0.09 \\
\hline
\rowcolor{lightblue} 
{\textbf{FR-1B-004}} & 12.7 & 24 & 61.5 & 21.7 & 4.21 & 43.4 & 0.12 & 4.2 & 0.064 \\
\hline
\rowcolor{white} 
{\textbf{FR-1B-007}} & 17.4 & 26 & 127 & 17 & 5.14 & 26.4 & 0.22 & 3.4 & 0.061 \\
\hline
\rowcolor{lightblue} 
{\textbf{FR-1B-010}} & 1.6 & 66 & 78.2 & 5.9 & 1.77 & 21.5 & 0.11 & 5 & 0.073 \\
\hline
\rowcolor{white} 
{\textbf{FR-1B-011}} & 2.1 & 54 & 40.5 & 4.5 & 2.82 & 29.8 & 0.13 & 6.2 & 0.082 \\
\hline
\end{tabular}

\end{document}

1 Answer 1

1

One way is to use \rotatebox{}{} from graphicx. Just put each table in a separate command. In order to keep each caption with a corresponding table, I enclosed the pairs in each minipage. Because now captions are not inside floats, we need \captionof{}{} instead, which is defined in the caption package. If you wish to put the whole construct in a table environment, change \begingroup...\endgroup to \begin{table}...\end{table}.

Note. Your code doesn't compile in the time of writing this. I've got to remove a few bits. You would probably need to add the missing parts again.

I also suggested (in the code) a few of improvements: \newcolumntype, multiple column definition, and a custom macro \cbf. The former lets you define a custom column type and avoid repetition. The latter only saves space and is not so significant; I personally use macros in this kine of situations. The construct *{N}{D} is to define N-number of columns of the same type D. It also safe space and eliminate repetitions.

The example

\documentclass{article}
\usepackage[margin=20mm]{geometry}
\usepackage[avgnames,table]{xcolor}
% \usepackage{tabularray}   % Not used - removed
\usepackage{graphicx}       % Added for rotatebox
\usepackage{array}          % Added for newcolumntype
\usepackage{caption}        % Added for captionof
% \usepackage{setspace}     % Required for \begin{singlespacing}..\end{singlespacing}

\definecolor{lightblue}{HTML}{DDEBF7}
\definecolor{white}{HTML}{FFFFFF}
\definecolor{darkblue}{HTML}{2D87D1}

\arrayrulecolor{darkblue}   % color11 is undefined !!!
\newcolumntype{M}{>{\centering\arraybackslash}m{1cm}}
\newcommand\cbf[2][white]{\textcolor{#1}{\bfseries #2}}


\begin{document}
% \strutlongstacks{T}       % Example doesn't compile with this

\begingroup
    \centering
    \begin{minipage}[t]{0.28\textwidth}
        \centering
        \parbox[t][1.2cm]{\linewidth}{\captionof{table}{Z4 Ttest.}}\par
        \rotatebox{90}{%
            \begin{tabular}{c *{9}{| M}}
                \rowcolor{darkblue}  \cbf{Sample} & \cbf{Ag} & \cbf{Al} & \cbf{As} & \cbf{Ba} & \cbf{Be} & \cbf{Bi} & \cbf{Ca} & \cbf{Cd} & \cbf{Ce} \\
                \rowcolor{white}     - & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 \\
                \hline
                \rowcolor{lightblue} - & ppm & \% & ppm & ppm & ppm & ppm & \% & ppm & ppm \\
                \hline
                \rowcolor{white}     \textbf{FR-1B-003} & 0.56 & 15.45 & 426 & 280 & 3.55 & 0.28 & 1.72 & 0.22 & 50.4 \\
                \hline
                \rowcolor{lightblue} \textbf{FR-1B-004} & 0.69 & 13.2 & 158 & 40 & 2.72 & 0.32 & 1.21 & 0.13 & 46.3 \\
                \hline
                \rowcolor{white}     \textbf{FR-1B-007} & 0.05 & 9.61 & 165 & 150 & 3.06 & 0.29 & 0.66 & 0.02 & 76 \\
                \hline
                \rowcolor{lightblue} 
                {\textbf{FR-1B-010}} & 0.04 & 8.1 & 63.3 & 930 & 2.27 & 0.29 & 0.92 & 0.07 & 72.7 \\
                \hline
                \rowcolor{white}     \textbf{FR-1B-011} & 0.11 & 15.3 & 209 & 250 & 3.12 & 0.34 & 1.64 & 0.17 & 74.6 \\
                \hline
            \end{tabular}}
    \end{minipage}
    \begin{minipage}[t]{0.28\textwidth}
        \centering
        \parbox[t][1.2cm]{\linewidth}{\captionof{table}{Z4 Ttest.\\\textit{(continued)}}}\par
        \rotatebox{90}{%
            \begin{tabular}{c *{9}{| M}}
                \rowcolor{darkblue}  \cbf{Sample} & \cbf{Co} & \cbf{Cr} & \cbf{Cs} & \cbf{Cu} & \cbf{Fe} & \cbf{Ga} & \cbf{Ge} & \cbf{Hf} & \cbf{In} \\
                \rowcolor{white}     - & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 & ME-MS61 \\
                \hline
                \rowcolor{lightblue} - & ppm & ppm & ppm & ppm & \% & ppm & ppm & ppm & ppm \\
                \hline
                \rowcolor{white}     \textbf{FR-1B-003} & 9.3 & 12 & 67 & 29.9 & 4.13 & 39.9 & 0.11 & 6.6 & 0.09 \\
                \hline
                \rowcolor{lightblue} \textbf{FR-1B-004} & 12.7 & 24 & 61.5 & 21.7 & 4.21 & 43.4 & 0.12 & 4.2 & 0.064 \\
                \hline
                \rowcolor{white}     \textbf{FR-1B-007} & 17.4 & 26 & 127 & 17 & 5.14 & 26.4 & 0.22 & 3.4 & 0.061 \\
                \hline
                \rowcolor{lightblue} \textbf{FR-1B-010} & 1.6 & 66 & 78.2 & 5.9 & 1.77 & 21.5 & 0.11 & 5 & 0.073 \\
                \hline
                \rowcolor{white}     \textbf{FR-1B-011} & 2.1 & 54 & 40.5 & 4.5 & 2.82 & 29.8 & 0.13 & 6.2 & 0.082 \\
                \hline
            \end{tabular}}
    \end{minipage}
    \par
\endgroup

\end{document}

EDIT. There's also an option to parameterised a new column type

\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}

and use it with an argument

% ...
    \begin{tabular}{c *{9}{| M{1cm}}}
    % ...

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .