1

I have a big square table 26*26, and I'm trying to display it in one single page. I'm wondering if there is a way to combine \sidewaystable and \resizebox. I'm trying but without being able to solve my issue. Do you have any suggestions?

 \documentclass[a4paper,11pt,  twoside, openright]{book}
\usepackage[english]{babel}
\usepackage[a4paper,top=3.5cm,bottom=3cm,left=3cm,right=3cm]{geometry}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{caption}
\captionsetup{font=small}
\usepackage{topfront}
\usepackage{emptypage}
\usepackage{chngcntr}
\usepackage{rotating}


\begin{sidewaystable}
\resizebox{1\textwidth}{!}{
\begin{table}[h]
\tiny
\centering
\begin{table}[htbp]
\begin{tabular}{p{5em}rrrrrrrrrrrrrrrrrrrrrrrp{5em}r}
\multicolumn{1}{r}{} & \multicolumn{1}{p{5em}}{ddddddddd ddddddd} &    \multicolumn{1}{p{5em}}{\% ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} & ddddddddddddddddddddddd & \multicolumn{1}{p{5em}}{ddddddddddddddddddddddd} \\
\multicolumn{1}{r}{} &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddd ddddddd & 1     &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
\% ddddddddddddddddddddddd & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & \multicolumn{1}{p{5em}}{-0.5888} & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & \multicolumn{1}{p{5em}}{0.5819} & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & \multicolumn{1}{p{5em}}{0.1969} & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & \multicolumn{1}{p{5em}}{0.0722} & 1     &       &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & \multicolumn{1}{p{5em}}{0.1455} & 1     &       &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1     &       & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & \multicolumn{1}{p{5em}}{-0.0579} & -0.0034 & -0.0034 & -0.0034 & 1     & \multicolumn{1}{r}{} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & \multicolumn{1}{r}{1} &  \\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.1519 & 1 \\
\end{tabular}%
 \label{tab:addlabel}%
\end{table}%
}
 \end{sidewaystable}
\end{document}
1
  • For sure, don't nest a table environment inside a sidewaystable environment. Do get rid of both begin{table} statemetns as well as the lone \end{table} statement.
    – Mico
    Commented Sep 20, 2018 at 13:54

1 Answer 1

3

I strongly doubt that your readers will appreciate being shown a 25x25 correlation matrix on a single page, displayed at a teeny-weeny font size. Odds are that they'll avert their gaze and hurriedly skip ahead to the next page...

But, if you have reason to believe that they might at least appreciate the typesetting effort, I suggest you rotate all 25 header labels in the first row by 90 degrees, counterclockwise. (Otherwise, the labels will get hopelessly entangled.) And, do load the siunitx package and employ that package's S column type for the 25 (not 26) data columns. That way, the numbers will be aligned on their respective decimal markers. enter image description here

\documentclass[a4paper,11pt,twoside,openright]{book}
\usepackage[english]{babel}
\usepackage[top=3.5cm,bottom=3cm,hmargin=3cm]{geometry}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{caption}
\captionsetup{font=small}
\usepackage{topfront}
\usepackage{emptypage}
\usepackage{chngcntr}
\usepackage{rotating} % for "sidewaystable" environment
\usepackage{siunitx}  % for "S" column type
\begin{document}

\begin{sidewaystable}
\caption{25$\times$25 correlation matrix}
\label{tab:addlabel}
\resizebox{1\textwidth}{!}{%
\tiny
\setlength\tabcolsep{2pt} % default: 6pt
\begin{tabular}{@{} l *{24}{S[table-format=-1.4]}
                            S[table-format=-1.0] @{}}
& {\rotatebox{90}{ddddddddd ddddddd}} &
{\rotatebox{90}{\% ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} &
{\rotatebox{90}{ddddddddddddddddddddddd}} \\[1ex]
ddddddddd ddddddd & 1 \\
\% ddddddddddddddddddddddd & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.5888 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 0.5819 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 0.1969 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 0.0722 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 0.1455 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0579 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & 1\\
ddddddddddddddddddddddd & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.0034 & -0.1519 & 1\\
\end{tabular}%
}
\end{sidewaystable}
\end{document} 
3
  • do you have in mind a different solution? something like splitting it into two pages? how would you suggest to do it?
    – ggg
    Commented Sep 20, 2018 at 17:12
  • @ggg - I would start by (i) showing only 3 decimals rather than 4 and (ii) using much shorter labels/variable names. In addition, I would urge you to think hard about what you expect your readers to “get” out of being shown 24*23/2 correlation coefficients. Would they be better off being told about just 3 or 4 correlation coefficients?
    – Mico
    Commented Sep 20, 2018 at 20:20
  • 1
    it is placed in the Appendix of a long reserach report. Basically in the text i referred only to the most relevant correlation and I refer to this table for more detail. but you are right, i will follow your suggestion about label and decimals.
    – ggg
    Commented Sep 21, 2018 at 6:10

You must log in to answer this question.

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