9

I'd like to rotate a table (90 degrees) and stretch it to fill whole page.

That's what I've got so far:

\documentclass{book}

\usepackage{tabularx}
\usepackage{adjustbox}

\begin{document}

\pagestyle{empty}

\begin{adjustbox}{angle=90}
  \begin{tabularx}{\textheight}{|X|X|X|X|X|X|X|X|X|X|X|X|}
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
        \hline
        1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 
  \end{tabularx}
\end{adjustbox}

\end{document}

I don't know how to stretch the height of the table therewith it fills the page (horizontally).

Is there any possibility to reduce the size of the font automatically if one text is wider than its cell?

edit: I probably didn't express myself very well. The table should look like this:

0

3 Answers 3

6

Is it like this?

\documentclass{book}

\usepackage{tabularx}
\usepackage{adjustbox}
\usepackage{showframe}

\begin{document}

\pagestyle{empty}
\hfill
\begin{adjustbox}{angle=90}    
  \begin{tabularx}{\textheight}{|X|X|X|X|X|X|X|X|X|X|X|X|}
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
        \hline
        1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12
  \end{tabularx}%
\end{adjustbox}
\hfill
\null

\end{document}

enter image description here

2

Use sidewaystable. Set the column adjustment from X to l,c or r for wider text.

\documentclass{book}
\usepackage[margin=1cm]{geometry}
\usepackage{tabularx}
\usepackage[figuresright]{rotating}

\begin{document}

\begin{sidewaystable}
\centering
\begin{tabularx}{\textheight}{|l|l|X|X|c|X|X|X|X|X|X|X|}
      1000000000000000000000 & 2000000000000 & 3 & 4 & 50000000000000 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
        \hline
        1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 
  \end{tabularx}
\caption{A table}
\end{sidewaystable}

\end{document}

enter image description here

1
  • I meant the height of the rotated table (the width in the document). The table should fill the page vertically and horizontally.
    – Moldevort
    Commented Apr 7, 2014 at 22:10
1

I found the solution myself. For everyone having the same problem: (Probably you need to render twice)

\documentclass{book}

\usepackage{tabularx} 
\usepackage[vlines]{tabularht}
\usepackage{adjustbox}

\begin{document}

\begin{adjustbox}{angle=90}
    \begin{tabularhtx}{\textwidth}{\textheight}{|X|X|X|X|X|X|X|X|X|X|X|X|}
    \hline
    \interrowfill
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
    \interrowfill
    \hline
    \interrowfill
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
    \interrowfill
    \hline
    \end{tabularhtx}
\end{adjustbox}

\end{document}

You must log in to answer this question.

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