Graphics, Figures & TablesSideways table won't fit on page

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Sideways table won't fit on page

Post by svend_tveskaeg »

Hi all.

Consider the following example:

Code: Select all

\documentclass[12pt]{article}

\usepackage[a4paper,hmargin=2.4cm,vmargin=3cm]{geometry}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage{dcolumn}

\begin{document}

\subsection*{Bilag 7: Resultater fra testen p{\aa} startpapiret}
Her f{\o}lger en tvedelt tabel over resultaterne fra testen f{\o}r undervisningsforl{\o}bet.

\begin{sidewaystable}
\caption{Testresultater f{\o}r undervisningsforl{\o}bet -- del~1.}
\centering
 \begin{tabular}{c c c c c c c c c c c c c c c c c c c c}
  \toprule
   & \multicolumn{3}{l}{St{\o}rrelsesforhold}
   & \multicolumn{3}{l}{Addition}
   & \multicolumn{3}{l}{Subtraktion}
   & \multicolumn{3}{l}{Forkorte}
   & \multicolumn{3}{l}{Forl{\ae}nge}
   & \multicolumn{3}{l}{F{\ae}llesn{\ae}vner}                   \\
   Elev \textbackslash{} Opgave & 1a & 1b & 1c & 2a & 2b & 2c &
    3a & 3b & 3c & 4a & 4b & 4c & 5a & 5b & 5c & 6a & 6b & 6c   \\
  \midrule
   \multicolumn{1}{l}{Amar}          & 1   & --- & --- & --- & ---   &
   --- & --- & --- & --- & --- & --- & --- & --- & --- & --- & ---   & ---   & ---   \\
   \multicolumn{1}{l}{Malak}         & 1   & 1   & 1   & 0   & 0     &
   0   & 0   & 0   & 0   & --- & --- & --- & --- & --- & --- & ---   & ---   & ---   \\
   \multicolumn{1}{l}{Gamze}         & 1   & 1   & 1   & 0   & 0     &
   0   & 0   & 0   & 0   & --- & --- & --- & --- & --- & --- & ---   & ---   & ---   \\
   \multicolumn{1}{l}{Cecilie}       & 1   & 1   & 1   & 0   & 0     &
   0   & 0   & 0   & 0   & 1   & --- & --- & --- & --- & --- & ---   & ---   & ---   \\
   \multicolumn{1}{l}{\"{U}lk\"{u}}  & 0   & 1   & 1   & 1   & 1     &
   1   & 1   & 1   & 1   & 1   & 0   & --- & 1   & 1   & 1   & ---   & ---   & ---   \\
   \multicolumn{1}{l}{Sarah}         & 1   & 1   & 1   & 1   & 1     &
   1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1     & 1     & ---   \\
   \multicolumn{1}{l}{Idil}          & 0   & 1   & 1   & 1   & 1     &
   1   & 1   & 1   & 1   & 1   & --- & --- & 0   & 1   & 0   & 1     & 1     & ---   \\
   \multicolumn{1}{l}{Kim}           & 1   & 1   & 1   & 1   & 1     &
   1   & 0   & 0   & 0   & 1   & 1   & 1   & 1   & 1   & 0   & 0     & ---   & ---   \\
   \multicolumn{1}{l}{Julie}         & 1   & 1   & 1   & 1   & 1     &
   1   & 0   & 0   & 0   & 1   & 1   & 1   & 1   & 1   & 0   & 0     & ---   & ---   \\
   \multicolumn{1}{l}{Art}           & --- & --- & --- & 1   & 1     &
   1   & 0   & 0   & 0   & 1   & 1   & 0   & 0   & 1   & 0   & 0{,}5 & 0{,}5 & 0{,}5 \\
   \multicolumn{1}{l}{Christian}     & --- & --- & --- & 1   & 1     &
   1   & 0   & 0   & 0   & 1   & 1   & 0   & 0   & 1   & 0   & 0{,}5 & 0{,}5 & 0{,}5 \\
   \multicolumn{1}{l}{Ali}           & 1   & 1   & 1   & 1   & 1     &
   1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1     & 1     & ---   \\
   \multicolumn{1}{l}{Emma}          & 1   & 1   & 1   & 1   & 1     &
   1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 0{,}5 & 0{,}5 & ---   \\
   \multicolumn{1}{l}{Sari}          & 1   & 1   & 1   & 1   & 1     &
   1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1     & 1     & ---   \\
   \multicolumn{1}{l}{Omar}          & 1   & 1   & 1   & 1   & 1     &
   1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1   & 1     & 1     & 0     \\
  \bottomrule
 \end{tabular}
\end{sidewaystable}

\end{document}
I would like the table to be on the same page as the \subsection and the line of text before the table.
How do I do that?

Furthermore, I would the the three columns under ``St{\o}rrelsesforhold'' to be of equal width and the sum of the widths equal to the width of the ``St{\o}rrelsesforhold'' box. (I.e., I would each column to have 1/3 the width of the ``St{\o}rrelsesforhold'' box.)
How do I do that?

Thank you in advance!
Last edited by svend_tveskaeg on Wed Mar 02, 2011 9:18 pm, edited 1 time in total.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Re: Sideways table won't fit on page

Post by svend_tveskaeg »

If you can help me with just one of the problems, I would still very much like to hear from you.

Best regards.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Sideways table won't fit on page

Post by localghost »

The used environment always starts a new page and occupies it completely. Try one of the other environments provided by the rotating package.


Thorsten
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Re: Sideways table won't fit on page

Post by svend_tveskaeg »

Maybe I should read the manual a bit more thoroughly next time. Thank you, Thorsten, for pointing me in the right direction.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Post Reply