When you rotate a table in Latex, the caption should be rotated as well. If you use \rotatebox{90}, it will produce something like this instead:

When it should be like this

So, here’s an example that shows how to rotate the entire table, including its caption, by 90 degrees:
Step-by-Step Solution
- First, add the
rotatingpackage in the preamble of your LaTeX document:
\usepackage{rotating}
- Then, use the
sidewaystableenvironment to rotate the table and the caption. Here is a minimal example:
\documentclass{article}
\usepackage{rotating} % for rotating tables
\begin{document}
\begin{sidewaystable} % Rotates the table and caption by 90 degrees
\centering
\begin{tabular}{|c|c|c|}
\hline
Header 1 & Header 2 & Header 3 \\
\hline
Row 1, Col 1 & Row 1, Col 2 & Row 1, Col 3 \\
Row 2, Col 1 & Row 2, Col 2 & Row 2, Col 3 \\
Row 3, Col 1 & Row 3, Col 2 & Row 3, Col 3 \\
\hline
\end{tabular}
\caption{This is a rotated table with its caption.}
\end{sidewaystable}
\end{document}
Explanation:
sidewaystable: This environment is provided by therotatingpackage and rotates the entire table (including the caption) 90 degrees counterclockwise.\caption{}: The caption command works as usual, and the caption will appear in its normal position relative to the rotated table.
With this approach, both the table and its caption are rotated together.