Graphics, Figures & TablesTwo sideways tables on the same page?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
silje
Posts: 2
Joined: Wed Dec 17, 2008 3:41 pm

Two sideways tables on the same page?

Post by silje »

I am quite new in this game.. Is it possible to get two sidewaystables into the same page? I am writing my master thesis and have two quite "long and narrow" tables which I would like to place below each other to make the lay-out look better.

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

PGScooter
Posts: 31
Joined: Mon Jul 14, 2008 2:47 pm

Re: Two sideways tables on the same page?

Post by PGScooter »

Hi silje,

There is an excellent article located here (go to "PDF version of paper")
http://www.tug.org/pracjourn/2007-1/mori/

Go to 3.2 Rotating Tables

I am sure that what you want to do can be done. There are probably several solutions, a few of which are in that article.

good luck!
silje
Posts: 2
Joined: Wed Dec 17, 2008 3:41 pm

Re: Two sideways tables on the same page?

Post by silje »

Thank you very much! It says in the article that sidewaystable fills a whole page, but I will try to use another command.


Silje
jazzgossen
Posts: 26
Joined: Mon Mar 09, 2009 3:19 pm

Re: Two sideways tables on the same page?

Post by jazzgossen »

Did you find a way to do this?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Two sideways tables on the same page?

Post by localghost »

jazzgossen wrote:Did you find a way to do this?
Follow the advice of PGScooter. Start a first approach on your own. In case of upcoming questions, feel free to ask.


Best regards
Thorsten
jazzgossen
Posts: 26
Joined: Mon Mar 09, 2009 3:19 pm

Re: Two sideways tables on the same page?

Post by jazzgossen »

I've tried a couple of different approaches.

Using sidewaystable, as stated above, requires a full page for each table.

I tried putting two sidewaystables in a minipage each, but then I get the error message "not in outer par mode".

If I just have a sideways environment inside the table environment (as opposed to sidewaystable), I get "Missing \endgroup inserted" after the caption.

I tried the lscape package and the landscape environment. If I put the tables inside a landscape environment, I do get two sideways tables on one page, but they are not floating. If I put the landscape environment inside the table environment, the tables aren't sideways anymore.

The only way of having floating sideways tables I could find in the article in PGScooter's post is the sidewaystable environment, but then I can only have one table on a page.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Two sideways tables on the same page?

Post by localghost »

jazzgossen wrote:[...] Using sidewaystable, as stated above, requires a full page for each table. [...]
Nobody claims that there is no room for two tables inside this environment.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs}
\usepackage{rotating}

\parindent0em

\begin{document}
  \begin{sidewaystable}
    \caption{Table One}\label{tab:one}
    \centering
    \begin{tabular}{*{4}{c}} \toprule
      Table Head & Table Head & Table Head & Table Head \\ \midrule
      Some Values & Some Values & Some Values & Some Values \\
      Some Values & Some Values & Some Values & Some Values \\
      Some Values & Some Values & Some Values & Some Values \\
      Some Values & Some Values & Some Values & Some Values \\ \bottomrule
    \end{tabular}

   \vspace{2\baselineskip}
   \caption{Table Two}\label{tab:two}
    \centering
    \begin{tabular}{*{4}{c}} \toprule
      Table Head & Table Head & Table Head & Table Head \\ \midrule
      Some Values & Some Values & Some Values & Some Values \\
      Some Values & Some Values & Some Values & Some Values \\
      Some Values & Some Values & Some Values & Some Values \\
      Some Values & Some Values & Some Values & Some Values \\ \bottomrule
    \end{tabular}
  \end{sidewaystable}
\end{document}
If you want the tables to be subtables with their own caption and sub-numbering and a major caption for the whole environment, try the subfig package or better the subcaption package that comes with caption.
jazzgossen
Posts: 26
Joined: Mon Mar 09, 2009 3:19 pm

Re: Two sideways tables on the same page?

Post by jazzgossen »

Aha! That's it, thanks a lot!
leandrocc
Posts: 4
Joined: Tue Apr 12, 2011 7:56 pm

Re: Two sideways tables on the same page?

Post by leandrocc »

Is it just me or sidewaystable does not respect right/left margins?
The tables are starting straight at the end of the paper, not where the margin should start.

Any ideas?
lena_of
Posts: 3
Joined: Thu Apr 09, 2015 6:25 pm

Two sideways tables on the same page?

Post by lena_of »

Thank you! why didn't i think of just putting several tables inside the sideways environment.

If width of table is a problem just use:\resizebox{\textwidth}{!}{% } command:

Code: Select all

\resizebox{\textwidth}{!}{%
\begin{tabular}

table...

\end{tabular}
}
Works well within the \sidewaystable environment also :)
Post Reply