[Tex/LaTex] Caption for a table in landscape environment

landscapetables

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}

Best Answer

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}
Related Question