Latex: Alignment of a fixed-width column in the tabular-environment

Based on the post even fixed-width columns can be aligned.

\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[german]{babel}
\usepackage{array}
\begin{document}
% Centered fixed-width column
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
% Right-aligned fixed-width column
\newcolumntype{R}[1]{>{\rtab\arraybackslash}m{#1}}

\begin{tabular}{C{2cm}R{2cm}}
\hline
Ein etwas langer Text, der sicherlich umbrochen wird & a\\
\hline
oder kurz & b\\
\hline
\end{tabular}
\end{document}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s