1

I have cobbled together something that has rotated and centered text in tabu by looking at various questions answered here. The following macro does the interesting part:

\newcommand{\vertText}[1]{
   \parbox[b]{7mm}{\centering \rotatebox[origin=c]{90}{\parbox[c]{1cm}{\centering \textbf{#1}}}}}

What I don't like about this solution is that it has to have appropriate sizes embedded in the macro to make it work. Is there a way to do this such that the sizing is done automatically?

MWE:

\documentclass[10pt]{article}
\usepackage{tabu}
\usepackage{rotating}

\begin{document}

\newcommand{\vertText}[1]{
  \parbox[b]{7mm}{\centering \rotatebox[origin=c]{90}{\parbox[c]{1cm}{\centering \textbf{#1}}}}}

\tabulinesep=1.2mm
\begin{tabu}{|X[-1,cm]|X[2m]|X[2m]|X[2m]|} 
\tabucline[1pt]-
\rowfont[c]{\bfseries} & 5 points
                   & 3 points
                   & 1 point \\ \tabucline[1pt]-
\vertText{Ref. Data}
 & City, State, Month, Day, and Year given.  Data shown with appropriate units.
 & Some information is missing or units are not shown.
 & Significant information missing, incomplete, or incorrect.
 \\ \tabucline[1pt]-
\vertText{Stats.}
 & 5 Number summary, Mean, Standard Deviation, IQR, and Range shown.
   Appropriate units and precision on all numbers.
 & Some numbers missing or incorrect, or units missing or precision
   incorrect on values.
 & Many numbers missing or incorrect.
 \\ \tabucline[1pt]-
\vertText{Histo.}
 & Computer generated histogram with 5 or 6 classes including labels
   and units on the axes, and title.
 & Number of bars incorrect or units or title missing.
 & Histogram has multiple flaws such as missing labels, title, number
    of bars.
 \\ \tabucline[1pt]-
\end{tabu}
\end{document}
2
  • as far as i know there is not simple way to automatically determine available vertical space for texts in the first column for each row separately (for example with measuring of height of the boxes in which are stored cells contents and than compare their heights and then use maximal value for determining of the lenght of rotated text)
  • slightly simpler code can be achieved by use of rothead{...} from makecell package, to which you prescribe the maximal lenght of rotated text.

enter image description here

for above table is also used ragged2e package (for better formatting of text in cells:

\documentclass[10pt]{article}
\usepackage{ragged2e}                         % <-- added
\usepackage{rotating}
\usepackage{makecell,                         % <-- added
            tabu}
\renewcommand\theadfont{\normalsize\bfseries} % <-- added

\begin{document}

\settowidth\rotheadsize{\theadfont stats.}    % <-- added
\tabulinesep=1.2mm
\begin{tabu}{|c|X[2, Lm]|X[2, Lm]|X[2 Lm]|}   % <-- changed
\tabucline[1pt]-
\rowfont[c]{\bfseries} & 5 points
                   & 3 points
                   & 1 point \\ \tabucline[1pt]-
\rothead{Ref. Data}
 & City, State, Month, Day, and Year given.  Data shown with appropriate units.
 & Some information is missing or units are not shown.
 & Significant information missing, incomplete, or incorrect.
 \\ \tabucline[1pt]-
\rothead{Stats.}
 & 5 Number summary, Mean, Standard Deviation, IQR, and Range shown.
   Appropriate units and precision on all numbers.
 & Some numbers missing or incorrect, or units missing or precision
   incorrect on values.
 & Many numbers missing or incorrect.
 \\ \tabucline[1pt]-
\rothead{Histo.}
 & Computer generated histogram with 5 or 6 classes including labels
   and units on the axes, and title.
 & Number of bars incorrect or units or title missing.
 & Histogram has multiple flaws such as missing labels, title, number
    of bars.
 \\ \tabucline[1pt]-
\end{tabu}
\end{document}
| 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.