# Caption for a table in landscape environment

I want to insert a caption for a table in the landscape environment but can't find a way to do it.

\begin{landscape}
\pagestyle{empty}%
\resizebox{0,1\textwidth}{!}{%
\begin{tabular}{|c|c|}
\hline
&  \\
\hline
&  \\
\hline
\end{tabular} }
\end{landscape}

• you can just use \caption inside table inside landscape just as for a normal table (it is best to avoid \resizebox on tabular though – David Carlisle Dec 12 '16 at 18:31
• without the \resizebox my table is too big for the page. Which is the best way to change the size of a table in the tabular environment? – Eleonora Dec 12 '16 at 18:37
• resizebox just produces horribly inconsistent fonts, you would not justify paragraph text by scaling so why tables? see any one of a thousand answers on this site for controlling table width, use \small or use a column like p{3cm} instead of c so you can have linebreaking within the cells or .... – David Carlisle Dec 12 '16 at 18:44
• @Eleonora: Note that 0,1\textwidth should probably be 0.1\textwidth. – Werner Dec 12 '16 at 18:56

You could load the rotating package and make use of its sidewaystable environment to typeset both the caption and the tabular material in landscape mode.

Oh, and I wouldn't the \resizebox method unless all other, more reasonable methods have already been exhausted.

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

\begin{sidewaystable}
\caption{A table in landscape format}

\resizebox{\textwidth}{!}{%
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
abc & abc & abc & abc & abc & abc & abc & abc & abc & abc & abc &
abc & abc & abc & abc & abc & abc & abc & abc & abc & abc & abc \\
\hline
\end{tabular}%
} % end of scope of \resizebox
\end{sidewaystable}

\end{document}


Maybe some examples to illustrate the suggestions given in the comments to your question are in order. In particular, if you use the p column type suggested by David, you might not need a landscape environment after all.

\documentclass{article}

\usepackage{
lscape,
lipsum  % just to obtain some filler text
}

\renewcommand{\arraystretch}{1.5}

\begin{document}

\pagestyle{empty}%

\begin{landscape}
\small

\begin{table}
\caption{Pokemons of the world}

\begin{tabular}{|p{0.5\linewidth}|p{0.5\linewidth}|}
\hline
Before &  After \\
\hline
\lipsum[1-2]  & \lipsum[2] \\
\hline
\end{tabular}
\end{table}

\end{landscape}

\begin{table}

\caption{Pokemons of the world}

\begin{tabular}{|p{0.7\linewidth}|p{0.3\linewidth}|}
\hline
Before &  After \\
\hline
\lipsum[1-2]  & \lipsum[2] \\
\hline
\end{tabular}
\end{table}

\end{document}
`