# How to fit the table into landscape mode

The below method works great for a regular table. I was wondering if there is a command phrase to shrink/resize the table in the sideways mode. I think problem is because of \textwidth which obviously doesn't work in the landscape mode.

\documentclass{article}
\usepackage{graphicx}
\begin{document}

\begin{table}
\resizebox{\textwidth}{!}{%
\begin{tabular}{cc}
Knuth & Lamport
\end{tabular}}
\end{table}

\end{document}


This code was taken from the following link on this forum. Changing the font size in a table

UPDATE:

Here's my MWE that utilizes tabularx but for some reason, I can't get the table sizing right. In portrait mode, text is getting too small with the \resizebox command. So, I've decided to make only this page to landscape mode.

\documentclass[12pt]{report}
\usepackage{graphicx,xcolor}
\usepackage{caption}
\usepackage[centertags]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{newlfont}
\usepackage[version = 3]{mhchem}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{mathptmx}
\usepackage{textcomp}
\usepackage{array}

\begin{document}
\begin{sidewaystable}
\caption{Kinetic parameters for oxygen reduction mechanism in MCFC cathode.}
\begin{tabularx}{\textwidth}{X|X|X|X|X|X|X|X}
\hline
\hline
\multicolumn{8}{c}{$i_o = i_o^o (O_2)^a (CO_2)^b$} \\
\multicolumn{8}{c}{$i_o$ = Bulk exchange current density, $mA/cm^2$} \\
\multicolumn{8}{c}{$i_o^o$ = Standard exchange current density, $mA/cm^2$} \\
\hline
$i_o$ $mA/cm^2$ & a & b & Method & Electrode & Dominant Mechanism & Electrolyte &   Reference \\
\hline
& 0.85 & -0.45 & Potential-step, AC Imped. & Au(ref), Ni(cathode) & Superoxide & 62/38 Li-K &  \\
10,27,39 & 0.1 & -0.15 & Potential-step, Coul. relax., and AC Imped. & Au smooth & Superoxide & 43/57 Li-K eutectic & \\
11,26.3 & 0.1 & -0.15 & SS potentiostatic, potential step & Au smooth & Superoxide & Li, Li-K eutectic &  \\
0.023-0.065 & - & - & SS potentiostatic & Au smooth &  & Li-Na-K eutectic &  \\
10 & 0.15 & -0.15 & Potential-step & Au, smooth & Superoxide & & \\
- & 0.3 & 0 & SS, kinetic control assumed & NiO, porous &  & & Tang (1980) \\
- & 0.6 & 0.6 &  & NiO, porous &  & & Tang (1980) \\
~1 & 0.5 & 0 & C & NiO, porous & & &  \\
4-7 & - & - & Transient potentiostatic & Au & & & IGT Proj 9105 \\
0.78 & 0.2 & 0.2 & Modeling of SS data & NiO, porous & Peroxide & Na-K &  \\
0.16-0.5 & 0.875 & -0.25 & Modeling of SS data & NiO, porous & & &  \\
0.01-0.03 & - & - & Potential-sweep & Au & Peroxide & Na-K, Li &  \\
& 0.375 & -1.25 & Modeling of SS data & NiO, porous &  & &  \\
& 0.4 & 0 & Modeling of SS data & SS porous & Superoxide & Li-Na-K, Li-K & This work \\
\hline
\end{tabularx}
\end{sidewaystable}
\end{document}

-
Why not tabularx? –  cacamailg Jul 27 at 19:26
The table is of the right width, but it's too big vertically. –  egreg Jul 27 at 20:25

The table is vertically too big for being rotated; a font size reduction is necessary anyway. I get a decent result with

\documentclass[12pt]{report}
\usepackage{graphicx,xcolor}
\usepackage{caption}
\usepackage[centertags]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[version = 3]{mhchem}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{mathptmx}
\usepackage{textcomp}
\usepackage{array}
\usepackage{ragged2e}

\begin{document}
\begin{table}

\caption{Kinetic parameters for oxygen reduction mechanism in MCFC cathode.}

\scriptsize
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
\begin{tabularx}{\textwidth}{@{}c|>{$}c<{$}|>{$}c<{$}|Y|Y|Y|Y|Y@{}}
\hline
\hline
\multicolumn{8}{c}{$i_o = i_o^o (O_2)^a (CO_2)^b$} \\
\multicolumn{8}{c}{$i_o$ = Bulk exchange current density, $mA/cm^2$} \\
\multicolumn{8}{c}{$i_o^o$ = Standard exchange current density, $mA/cm^2$} \\
\hline
$i_o$ mA/cm$^2$ & a & b & Method & Electrode & Dominant Mechanism & Electrolyte &   Reference \\
\hline
& 0.85 & -0.45 & Potential-step, AC Imped. & Au(ref), Ni(cathode) & Superoxide & 62/38 Li-K &  \\
10,27,39 & 0.1 & -0.15 & Potential-step, Coul. relax., and AC Imped. & Au smooth & Superoxide & 43/57 Li-K eutectic & \\
11,26.3 & 0.1 & -0.15 & SS potentiostatic, potential step & Au smooth & Superoxide & Li, Li-K eutectic &  \\
0.023-0.065 & - & - & SS potentiostatic & Au smooth &  & Li-Na-K eutectic &  \\
10 & 0.15 & -0.15 & Potential-step & Au, smooth & Superoxide & & \\
- & 0.3 & 0 & SS, kinetic control assumed & NiO, porous &  & & Tang (1980) \\
- & 0.6 & 0.6 &  & NiO, porous &  & & Tang (1980) \\
~1 & 0.5 & 0 & C & NiO, porous & & &  \\
4-7 & - & - & Transient potentiostatic & Au & & & IGT Proj 9105 \\
0.78 & 0.2 & 0.2 & Modeling of SS data & NiO, porous & Peroxide & Na-K &  \\
0.16-0.5 & 0.875 & -0.25 & Modeling of SS data & NiO, porous & & &  \\
0.01-0.03 & - & - & Potential-sweep & Au & Peroxide & Na-K, Li &  \\
& 0.375 & -1.25 & Modeling of SS data & NiO, porous &  & &  \\
& 0.4 & 0 & Modeling of SS data & SS porous & Superoxide & Li-Na-K, Li-K & This work \\
\hline
\end{tabularx}
\end{table}
\end{document}


There are several problems in the table, I fixed some; however the names of the chemical elements are still wrong and you should fix them with mchem commands.

If you decide for a rotated table, you can use \footnotesize:

\documentclass[12pt]{report}
\usepackage{graphicx,xcolor}
\usepackage{caption}
\usepackage[centertags]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[version = 3]{mhchem}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{mathptmx}
\usepackage{textcomp}
\usepackage{array}
\usepackage{ragged2e}

\begin{document}
\begin{sidewaystable}

\caption{Kinetic parameters for oxygen reduction mechanism in MCFC cathode.}

\footnotesize
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
\begin{tabularx}{\textwidth}{@{}c|>{$}c<{$}|>{$}c<{$}|Y|Y|Y|Y|Y@{}}
\hline
\hline
\multicolumn{8}{c}{$i_o = i_o^o (O_2)^a (CO_2)^b$} \\
\multicolumn{8}{c}{$i_o$ = Bulk exchange current density, $mA/cm^2$} \\
\multicolumn{8}{c}{$i_o^o$ = Standard exchange current density, $mA/cm^2$} \\
\hline
$i_o$ mA/cm$^2$ & a & b & Method & Electrode & Dominant Mechanism & Electrolyte &   Reference \\
\hline
& 0.85 & -0.45 & Potential-step, AC Imped. & Au(ref), Ni(cathode) & Superoxide & 62/38 Li-K &  \\
10,27,39 & 0.1 & -0.15 & Potential-step, Coul. relax., and AC Imped. & Au smooth & Superoxide & 43/57 Li-K eutectic & \\
11,26.3 & 0.1 & -0.15 & SS potentiostatic, potential step & Au smooth & Superoxide & Li, Li-K eutectic &  \\
0.023-0.065 & - & - & SS potentiostatic & Au smooth &  & Li-Na-K eutectic &  \\
10 & 0.15 & -0.15 & Potential-step & Au, smooth & Superoxide & & \\
- & 0.3 & 0 & SS, kinetic control assumed & NiO, porous &  & & Tang (1980) \\
- & 0.6 & 0.6 &  & NiO, porous &  & & Tang (1980) \\
~1 & 0.5 & 0 & C & NiO, porous & & &  \\
4-7 & - & - & Transient potentiostatic & Au & & & IGT Proj 9105 \\
0.78 & 0.2 & 0.2 & Modeling of SS data & NiO, porous & Peroxide & Na-K &  \\
0.16-0.5 & 0.875 & -0.25 & Modeling of SS data & NiO, porous & & &  \\
0.01-0.03 & - & - & Potential-sweep & Au & Peroxide & Na-K, Li &  \\
& 0.375 & -1.25 & Modeling of SS data & NiO, porous &  & &  \\
& 0.4 & 0 & Modeling of SS data & SS porous & Superoxide & Li-Na-K, Li-K & This work \\
\hline
\end{tabularx}
\end{sidewaystable}
\end{document}


-
aren't you going to tell the OP not to insert vertical lines ;-) –  FionaSmith Jul 27 at 20:50
@egreg you have fixed the MWE but seems due to package xthesis and some other definitions, it's not working in my original document. I need to look into this. Thanks for your help. –  ritesh Jul 27 at 21:01
@ritesh - Mentioning that you use a package named xthesis and employ various "other definitions" (which ones?!) ought to be done up front, in your MWE, rather than after the fact in a comment to an answer. –  Mico Jul 28 at 2:48
@Mico You are right, I should have. But it's only after the fact that I realized the importance of it. I'll create another MWE and post it here. –  ritesh Jul 29 at 19:11
\documentclass{article}
\pagestyle{empty}

\usepackage[landscape,top=0pt,bottom=0pt,left=0pt,right=0pt]{geometry}
\usepackage{tabularx}

\begin{document}

\begin{table}
\begin{tabularx}{\paperwidth}{|X|X|} % \textwidth also works
\hline
Knuth & Lamport \\
\hline
\end{tabularx}
\end{table}

\end{document}

-
\textwidth is strongly preferred over \paperwidth. –  Mico Jul 27 at 19:43
@cacamailg I can't landscape the whole document. I just need this table to be landscaped but with appropriate width/height. I am unable to work tabularx with sidewaystable. It's giving me errors due to the overflowing page perhaps. –  ritesh Jul 27 at 19:52