Long table header vertical alignment
A solution as I suggested in a comment, and a simpler one, based on eqparbox
:
\documentclass{article}
\usepackage{graphicx}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\usepackage{eqparbox}
\begin{document}
\begin{table}
\centering
\begin{tabular}{|C{2em}|C{2em}|}\hline
\multicolumn{1}{|p{2em}}{\centering\rotatebox[origin = l]{90}{Long long heading 1}~} &\multicolumn{1}{|p{2em}|}{\centering \rotatebox[origin = l]{90}{Long long longer longer heading 2~}}\\ \hline %%%%%%%%%%% `~` is inserted at end of headings to keep the margin away
Text 1 & Text 2\\ \hline
\end{tabular}
\qquad
\begin{tabular}{|C{2em}|C{2em}|}\hline
\rotatebox{90}{\eqmakebox[H][l]{Long long heading 1}~} & \rotatebox{90}{\eqmakebox[H][l]{Long long longer longer heading 2}~}\\ \hline %%%%%%%%%%% `~` is inserted at end of headings to keep the margin away
Text 1 & Text 2\\ \hline
\end{tabular}
\end{table}
\end{document}
Two cases with use of the rotating
and makecell
packages:
\documentclass[12pt]{article}
\usepackage{rotating}
\usepackage{makecell}
\renewcommand\theadfont{\normalsize}
\begin{document}
\begin{table}[ht]
\centering
\settowidth\rotheadsize{Long Long longer longer heading 2}
\begin{tabular}{|c|c|}
\hline
\rothead{Long Long heading}
& \rothead{Long Long longer longer heading 2} \\
\hline
\makecell{Text\\ 1} & \makecell{Text\\ 2} \\
\hline
\end{tabular}
\end{table}
or table design which I more prefer:
\begin{table}[ht]
\centering
\settowidth\rotheadsize{Long Long heading}
\begin{tabular}{|c|c|}
\hline
\rothead{Long Long heading}
& \rothead{Long Long longer longer heading 2} \\
\hline
\makecell{Text\\ 1} & \makecell{Text\\ 2} \\
\hline
\end{tabular}
\end{table}
\end{document}
My proposal....
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{graphicx}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|c|c|}
\hline
\rotatebox{90}{Long Long heading~} & \rotatebox{90}{Long Long longer longer heading 2~} \\ \hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}Text\\ 1\end{tabular}} & \begin{tabular}[c]{@{}c@{}}Text\\ 2\end{tabular} \\ \hline
\end{tabular}
\end{table}
\end{document}