Graphics, Figures & Tablesalign vertical text in a tabular

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Elendil
Posts: 1
Joined: Sat Jan 03, 2009 6:18 pm

align vertical text in a tabular

Post by Elendil »

Hello everybody,

my problem is the following: I would like to create a table that contains a column with only rotated text in it in order to save space (I also tried this with the rotatebox-command). However, this way I waste space above each itemization. Is there a way to align the text of the first column (with the vertical text)?
Every attempt of centering the sideways text did not change anything to the output.

Here is my minimum example:

Code: Select all

\documentclass{article}

\usepackage{rotating}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage[alwaysadjust]{paralist}


\begin{document}

\begin{tabularx}{\textwidth}{|c|X|X|}
  \hline 
  \begin{sideways}
    first category
  \end{sideways}
  &   \begin{compactitem}
    \item first 
    \item second  
    \item third  
  \end{compactitem}
  &   \begin{compactitem}
    \item first 
    \item second  
    \item third  
  \end{compactitem}
 \\ 
  \hline 
  \begin{sideways}
    second category   
  \end{sideways}
  &
  \begin{compactitem}
    \item first 
    \item second  
    \item third  
  \end{compactitem}
  &   \begin{compactitem}
    \item first 
    \item second  
    \item third  
  \end{compactitem} \\ 
  \hline 
\end{tabularx}

\end{document}
Thanks in advance,
Elendil

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

align vertical text in a tabular

Post by kaiserkarl13 »

You can get something close to what I suspect you want with the following:

Code: Select all

\raisebox{-4em}{
\begin{sideways}
  {first category}
\end{sideways}}
(do the same around your second category).

If you're going to do this for a bunch of entries, I recommend defining a new command, such as

Code: Select all

\newcommand{\raiserot}[2]{\raisebox{#1}{%
  \begin{sideways}%
    #2
  \end{sideways}%
  }%
}
Post Reply