4

I have a table that is pretty long horizontally, hence I am displaying it sideways. The only problem is that when I generate the pdf, I would have to rotate my head in order to read the table. Can anyone help me display my table sideways and have the page also be viewed in such a way? This is what I currently have.

  \begin{sidewaystable}
  \centering
  \begin{tabular}{|p{4.5cm}|p{1.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|}
(I have my table contents here)
\end{tabular}
\end{sidewaystable}
3

First: Welcome to TeX.SX!

Just make sure you include the Minimum Working Example...so others can reproduce your problem and figureout how to solve. But I got you mean, it's a common problem with long tables.

Simply load the package pdflscape and use the landscape environment, that will do the trick and auto rotate the page. this does bug out on some tablets depending on the pdf reader thats been used (i've heard it works well with adobe and MS).

For more info check Herbert answer here.

\documentclass{article}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\begin{table}
  \centering
  \begin{tabular}{|p{4.5cm}|p{1.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|}
(I have my table contents here)
\end{tabular}\caption{A simple table}
\end{table}
\end{landscape}
\end{document}
  • That worked and turned my page, but I now have an empty page generated before the one containing my table. I removed "\newpage" but I still have that empty page. – Mike May 11 '18 at 23:04
  • @Mike I edited the code, now its producing a single page, rotated, with the table. Try now. – G. Bay May 11 '18 at 23:08
  • Thank you. I am also trying to add a caption "\caption{Table 1: Bla bla.}" between \end{tabular} and \end{landscape}, but it is giving me an error "Caption outside of float". Do you have any idea how I might fix this problem? – Mike May 11 '18 at 23:14
  • @Mike I've added caption, try now. Caption should be inside the Table enviroument... I strongly suggest you read some guide on LaTeX. I'd recommend Dickimaw dickimaw-books.com/latex/novices/html/index.html – G. Bay May 12 '18 at 0:17
  • Also consider tex.stackexchange.com/questions/11/… – G. Bay May 12 '18 at 0:26

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.