4

I have a table that has some vertical column headers, but they keep colliding with the table title. I've tried making the top row taller but that did not help the solution, simply moved all the text higher but they were still colliding

A simple example is given below

\documentclass[12pt,leftblank]{article}
\usepackage{amsmath, amsthm, amssymb, mathtools}
\usepackage{adjustbox}
\usepackage{rotating}

\begin{document}
\begin{table}[H]
\centering
\caption{Table Title}
\footnotesize
\begin{tabular}{lll}
    & \begin{rotate}{60}Long Column Title 1\end{rotate} & \begin{rotate}{60}Long Column Title 2\end{rotate} \\
    Row 1 & Data & Data\\
    Row 2 & Data & Data\\
\end{tabular}
\end{table}

\end{document}
4

From the documentation of the rotating package:

rotate prints the contents turned through an arbitrary angle but does not leave any space for the result

You have to use turn, but this would leave the horizontal space. I propose a new command that only makes zero width, but keeps the height.

\documentclass[12pt,leftblank]{article}
\usepackage{amsmath, amsthm, amssymb, mathtools}
\usepackage{adjustbox}
\usepackage{rotating}

\newcommand{\zwturn}[2]{%
  \makebox[0pt][l]{\begin{turn}{#1}#2\end{turn}}%
}

\begin{document}
\begin{table}
\centering
\caption{Table Title}
\medskip

\footnotesize
\begin{tabular}{lll}
  & \zwturn{60}{Long Column Title 1}
  & \zwturn{60}{Long Column Title 2} \\
Row 1 & Data & Data\\
Row 2 & Data & Data\\
\end{tabular}
\end{table}

\end{document}

enter image description here

However, it's better to avoid rotated headers.

|improve this answer|||||
3

You ca also use \rotatebox macro provided by graphicx package.

\documentclass[12pt,leftblank]{article}
\usepackage{amsmath, amsthm, amssymb, mathtools}
\usepackage{adjustbox}
%\usepackage{rotating}

\newcommand{\zwturn}[2]{%
  \rotatebox[origin=c]{#1}{#2}%
}

\begin{document}
\begin{table}
\centering
\caption{Table Title}
\medskip

\footnotesize
\begin{tabular}{lll}
  & \zwturn{60}{Long Column Title 1}
  & \zwturn{60}{Long Column Title 2} \\
Row 1 & Data & Data\\
Row 2 & Data & Data\\
\end{tabular}
\end{table}

\end{document}

enter image description here

|improve this answer|||||

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.