1

My table does not fit in the page. I am trying to fit it in my page width. I am a beginner here, so any help would be appreciated. I tried using rotating head cells and tabularx, but the first row and columns were overlapping. How can I avoid that? Is there a way to fit my table to the whole column width, rather than just being on the right side?

table wdith exceeded

My code:

\documentclass[a4paper, 10pt, conference]{ieeeconf} 
\usepackage{booktabs}
\usepackage{dcolumn}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{graphicx}
\begin{document}

[![\begin{table}
\caption{Small font size, rotated table head cells.}
\small
\advance\tabcolsep-3.5pt
\begin{tabularx}{\hsize}{@{}X l D{.}{.}{-1} D{.}{.}{-1} D{.}{.}{-1} D{.}{.}{-1} D{.}{.}{-1} D{.}{.}{-1} D{.}{.}{-1} D{.}{.}{-1} D{.}{.}{-1} D{.}{.}{-1} D{.}{.}{-1}}\toprule
\rotatebox{90}{Syndrome}         & \rotatebox{90}{22q11} & \rotatebox{90}{Angelman} & \rotatebox{90}{Apert} & \rotatebox{90}{CDL} & \rotatebox{90}{Down} & \rotatebox{90}{FragileX} & \rotatebox{90}{Marfan} & \rotatebox{90}{Progeria} & \rotatebox{90}{Sotos} & \rotatebox{90}{Treacher Collins} & \rotatebox{90}{Turner} & \rotatebox{90}{Williams} \\ \midrule
22q11            & 0     & 0        & 0     & 0   & 0.5  & 0        & 0      & 0        & 0     & 0                & 0      & 0.5      \\ 
Angelman         & 0     & 85.7     & 0     & 4.7 & 0    & 0        & 4.7    & 0        & 0     & 0                & 0      & 4.7      \\ 
Apert            & 0     & 0        & 100   & 0   & 0    & 0        & 0      & 0        & 0     & 0                & 0      & 0        \\ 
CDL              & 0     & 0        & 0     & 96  & 0    & 0        & 0      & 0        & 0     & 0                & 0      & 4.7      \\ 
Down             & 0     & 0        & 0     & 0   & 94.7 & 0        & 5.2    & 0        & 0     & 0                & 0      & 0        \\ 
FragileX         & 0     & 17.6     & 0     & 0   & 76.4 & 0        & 0      & 0        & 0     & 0                & 0      & 5.8      \\ 
Marfan           & 0     & 0        & 0     & 0   & 0    & 0        & 100    & 0        & 0     & 0                & 0      & 0        \\ 
Progeria         & 0     & 0        & 0     & 0   & 0    & 0.5      & 0      & 0.25     & 0.25  & 0                & 0      & 0        \\ 
Sotos            & 0     & 0        & 0     & 0   & 0    & 0        & 0      & 0        & 100   & 0                & 0      & 0        \\ 
Treacher Collins & 0     & 0        & 0     & 0   & 0    & 0.5      & 0      & 0        & 0     & 0                & 0.5    & 0        \\ 
Turner           & 0     & 8.6      & 0     & 4.3 & 0    & 4.3      & 0      & 0        & 0     & 0                & 0      & 82.6     \\ 
Williams         &       &          &       &     &      &          &        &          &       &                  &        &          \\ \bottomrule
\end{tabularx}
\end{table}][1]][1]
\end{document}
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Skillmon Jun 23 '18 at 6:55
  • I have made changes. – ZER-0-NE Jun 23 '18 at 7:09
  • By breaking the table into two seperate parts, would it fit the whole page width? I am sorry, but I am still a beginner here. I don't know how to use table* environment. Could you please help me out there? @Mico – ZER-0-NE Jun 23 '18 at 7:30
  • @ZER-0-NE - Please see the answer I just posted. – Mico Jun 23 '18 at 7:38
2

You need to reduce the font size, further reduce the amount of intercolumn whitespace, and give up on the idea of aligning the numbers in columns 2 thru 13 on their decimal markers -- the text column simply isn't wide enough for such a luxury.

enter image description here

\documentclass[a4paper, 10pt, conference]{IEEEconf} 
\usepackage{booktabs,tabularx,graphicx}
\begin{document}

\begin{table}
\caption{Small font size, rotated table head cells.}
\footnotesize  % not "\small"
\setlength\tabcolsep{2pt} % default value: 6pt
\begin{tabularx}{\hsize}{@{} X *{12}{c} @{}}
\toprule
 \rotatebox{90}{Syndrome}  & \rotatebox{90}{22q11} 
& \rotatebox{90}{Angelman} & \rotatebox{90}{Apert} 
& \rotatebox{90}{CDL}      & \rotatebox{90}{Down} 
& \rotatebox{90}{FragileX} & \rotatebox{90}{Marfan} 
& \rotatebox{90}{Progeria} & \rotatebox{90}{Sotos} 
& \rotatebox{90}{Treacher Collins} 
& \rotatebox{90}{Turner}   & \rotatebox{90}{Williams} \\ 
\midrule
22q11            & 0     & 0        & 0     & 0   & 0.5  & 0        & 0      & 0        & 0     & 0                & 0      & 0.5      \\ 
Angelman         & 0     & 85.7     & 0     & 4.7 & 0    & 0        & 4.7    & 0        & 0     & 0                & 0      & 4.7      \\ 
Apert            & 0     & 0        & 100   & 0   & 0    & 0        & 0      & 0        & 0     & 0                & 0      & 0        \\ 
CDL              & 0     & 0        & 0     & 96  & 0    & 0        & 0      & 0        & 0     & 0                & 0      & 4.7      \\ 
Down             & 0     & 0        & 0     & 0   & 94.7 & 0        & 5.2    & 0        & 0     & 0                & 0      & 0        \\ 
FragileX         & 0     & 17.6     & 0     & 0   & 76.4 & 0        & 0      & 0        & 0     & 0                & 0      & 5.8      \\ 
Marfan           & 0     & 0        & 0     & 0   & 0    & 0        & 100    & 0        & 0     & 0                & 0      & 0        \\ 
Progeria         & 0     & 0        & 0     & 0   & 0    & 0.5      & 0      & 0.25     & 0.25  & 0                & 0      & 0        \\ 
Sotos            & 0     & 0        & 0     & 0   & 0    & 0        & 0      & 0        & 100   & 0                & 0      & 0        \\ 
Treacher Collins & 0     & 0        & 0     & 0   & 0    & 0.5      & 0      & 0        & 0     & 0                & 0.5    & 0        \\ 
Turner           & 0     & 8.6      & 0     & 4.3 & 0    & 4.3      & 0      & 0        & 0     & 0                & 0      & 82.6     \\ 
Williams     & x & x & x & x & x & x & x & x & x & x & x & x \\ 
\bottomrule
\end{tabularx}
\end{table}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.