I have created the following table, but will need to rotate it in landscape mode. This is because the "Comments" column will contain a lot of text, and won't fit in a normal table. I have tried to use \usepackage{rotating} and \begin{sidewaystable}, but being a recent Latex user, I have no idea where I am going wrong.
The initial table I have made is:
Thank you so much in advance
PS: For future reference, how can I
(a) ensure that all of my tables fit my document margin? (b) change individual column widths in tabularray?
Again, any help is highly appreciated.
My MWE is shown below:
\usepackage[margin=3cm]{geometry}
\usepackage[font=scriptsize,
labelfont=bf]{caption}
\usepackage[xcdraw]{xcolor}
\usepackage{tabularray}
\usepackage{rotating}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{table}[ht]
\fontsize{9}{10}\selectfont
\centering
\caption{Comparison between AA and BB mean values (wt\%)}
\begin{tblr}{hlines, vlines,
colspec = {r l *{2}{S[table-format=-1.2]} *{6}{S[table-format=1.2]}},
column{1} = {font=\bfseries},
column{2-Z}={font=\fontsize{7}{9}\selectfont},
row{1} = {ht = 6ex},
row{1} = {font =\bfseries},
row{1} = {bg = green7},
row{1} = {font =\fontsize{9}{6}\selectfont},
hspan=minimal}
\textbf{\begin{tabular}[c]{@{}c@{}}Column\\ Header\end{tabular}} & {{{\textbf{\begin{tabular}[c]{@{}c@{}}Column\\ Header\end{tabular}}}}} & {{{\textbf{\begin{tabular}[c]{@{}c@{}}Variable\\ \%\end{tabular}}}}} & {{{\textbf{\begin{tabular}[c]{@{}c@{}}Variable\\ \%\end{tabular}}}}} & {{{\textbf{\begin{tabular}[c]{@{}c@{}}Column\\ Header\end{tabular}}}}} & {{{\textbf{\begin{tabular}[c]{@{}c@{}}Variable\\ \% \end{tabular}}}}} & {{{\textbf{R\ $^{2}$}}}} & {{{\textbf{Comments}}}} \\
\multicolumn{1}{l}{ \textbf{AA\ $-$ BB}} &3675 & 7.18 & 8.22 & 3.29 & 3.16 & 0.03 & \multirow{4}{*}{} \\ \cline{1-7}
\multicolumn{1}{l}{ \textbf{AA\ $-$ BB}} &2195 & 4.51 & 7.33 & 2.96 & 2.55 & 0.08 & \\ \cline{1-7}
\multicolumn{1}{l}{ \textbf{AA \ $-$ BB}} &3075 & 5.63 & 7.25 & 3.28 & 3.77 & 0.03 & \\ \cline{1-7}
\multicolumn{1}{l}{ \textbf{AA \ $-$ BB}} &3400 & 4.29 & 10.24 & 1.94 & 2.44 & 0.004 &
\end{tblr}
\end{table}
\end{document}