I'd like to create a chart where the column titles are rotated, as per this toy example:
I used the rotating
package to generate the above. It has certain shortcomings: the rotate command doesn't leave space for the titles, so I have to manually space things to prevent overlaps. The turn command, by contrast, creates too much space, where each column is the width of the entire rotated column title.
There is also no easy way to have long titles be split into multiple lines.
Is there a package for creating tables of this sort, or at least one that would relieve some of the manual placing and spacing that goes into creating such a table?
This question is more to make sure I don't miss any easy way of doing what I want than seeking help on manually doing it, but the code for above is included anyways:
\begin{tabular}{r|ccc}
&
\begin{rotate}{60} Property 1 \end{rotate} &
\begin{rotate}{60} Property 2 \end{rotate} &
\begin{rotate}{60} Property 3 \end{rotate} \\ \hline
System 1 & & & X \\
System 2 & X & X & X \\
System 3 & X & & X \\ \hline
\end{tabular}
Best Answer
You can use the
adjustbox
package to rotate the content and limit it official width. I would also recommend to use a separate\newcolumntype
for it as well as a\rot
macro which inserts the required\multicolumn
command. You won't avoid that one. However, such a macro must be fully expandable and start directly with\multicolumn
. If you want multi line headings add theminipage=<width>
option to\adjustbox
.