Table placement using sidewaystable or landscape

1,649

Solution 1

There is an automatic \clearpage at the beginning and end of landscape, so using a float (table) is fine. If you want to position the contents, you can use a minipage INSIDE the float to fit the entire text area.

For some reason, showframe is acting up for me.

\documentclass{article}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
  \begin{table}[p]
    \begin{minipage}[t][\textheight][t]{\linewidth}% use entire text area
      \caption{Insert table caption here}
      \resizebox{\textwidth}{!}{%
        \begin{tabular}{lllll lllll llll}
          \multicolumn{14}{c}{**removed table data for posting**}
        \end{tabular}%
      }%
    \end{minipage}
  \end{table}
\end{landscape}
\end{document}

full page

Solution 2

  • your code snippet is not complete :-(
  • see if the following solution givers what you looking for

edit: for test purposes i add package showframe that you can see, that the table is at top left side of page in landscape orientation.

    \documentclass{article}
    \usepackage{lscape}
    \usepackage{tabularx}
    \usepackage{caption}

    %---------------- show page layout. don't use in a real document!
    \usepackage{showframe}
    \renewcommand\ShowFrameLinethickness{0.15pt}
    \renewcommand*\ShowFrameColor{\color{red}}
    %---------------------------------------------------------------%
    \begin{document}
    \begin{landscape}        
    \vspace*{-1.5\baselineskip}
    \captionsetup{singlelinecheck=false}
    \captionof{table}{Insert table caption here.}
    \label{my-label}
    \begin{tabularx}{\linewidth}{|*{12}{X|}}
    \hline
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12    \\
    \hline
    \end{tabularx}
    \end{landscape}
    \end{document}

enter image description here

Share:
1,649

Related videos on Youtube

mef022
Author by

mef022

Updated on February 24, 2020

Comments

  • mef022
    mef022 over 3 years

    I can use either {sidewaystable} or {landscape} to produce a table and its caption that are landscape on a page. However, it is centered on the page. How do you move it so that it aligns with the left margin of the page?

    \begin{landscape}
    \begin{table}[]
    \caption{Insert table caption here}
    \resizebox{\textwidth}{!}{%
    \begin{tabular}{llllllllllllll} 
    **removed table data for posting**
    \end{tabular}%
     }
    \end{table}
    \end{landscape}       
    

    Gives

    enter image description here

    Which is centered on the page. I would like the caption and the table to be aligned to the left margin of my document.

    If I use {sidewaystable} instead and add the first line of code:

    \setlength\rotFPtop{152pt}
    \begin{sidewaystable}
    \begin{table}[]
    \caption{Insert table caption here}
    \resizebox{\textwidth}{!}{%
    \begin{tabular}{llllllllllllll} 
    **removed table data for posting**
    \end{tabular}%
     }
    \end{sidewaystable}
    

    Then it will shift everything to the left as desired. But I guessed 152pt. Is there a way to determine the exact pts of the page margin?

    • John Kormylo
      John Kormylo over 4 years
      Since there is no text on the page, it defaults to [p].
  • Zarko
    Zarko over 4 years
    please, show us what you try so far. it is still not clear what you like too have. edit your question and add this there. page i show is shown rotated, that you can easily see its content.
  • mef022
    mef022 over 4 years
    If I use {sidewaystable} instead of {landscape} and keep the rest of the code the same, I can shift it towards the left margin by adding this as the first line of code %\setlength\rotFPtop{152pt} . Is there a way to determine how many pts my margin is? 152 pt was just a guess...
  • mef022
    mef022 over 4 years
    Sorry - that does not work. It is not at the left margin of the page.
  • Zarko
    Zarko over 4 years
    i edit my answer. added is package for drawing text borders. now should be clearly seen, that the table is in the place as you ask in your question.