## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Different vertical Alignment in Table Columns Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
richi-rich
Posts: 4
Joined: Tue Jul 30, 2013 10:13 am

### Different vertical Alignment in Table Columns

Hy,

I still haven't found a solution for the following problem:

I want to create a table in which specified columns should be vertically centered, but not all. In the first column the text should be aligned at the top.

Within the tabularx environment the m{} column aligns the text along with the top line. Redefining the X column with \renewcommand{\tabularxcolumn}[1]{m{#1}} helps to center the columns, but then the p{} column is ignored (or does something I don't understand )

Here is the example:


Does anybody know how to solve this?

Thanks,
Richie

btw: sorry for the bad english, I hope you still get what i want to tell you
Last edited by richi-rich on Tue Jul 30, 2013 3:03 pm, edited 1 time in total.

Tags:

localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm
Just for information to other users for awareness of possibly already existing solutions. The question has also been posted to MrUnix and GoLaTeX (two German forums, partly with answers). Please read what our administrator thinks about that.

Board Rules wrote:A crossposting is always contra-productive. But there is nothing really against it as long as it is mentioned. This means that a direct link has to be added. So other users who want to help are preserved from double efforts and waste of time.

What about trying it with the tabu package? Where are the difficulties when using its column specifications? Please give a corresponding minimal example if you have already tried it.

Best regards and welcome to the board
Thorsten
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

richi-rich
Posts: 4
Joined: Tue Jul 30, 2013 10:13 am
Hy,

thanks for clarification. I've cross-posted this here because in the german forum my question couldn't be answered.

To the topic:

I've tried it also with the tabu-package, the probleme here is the same, as you can see in this example:

\documentclass[a4paper,14pt,BCOR10mm,oneside]{scrartcl}\usepackage[ngerman]{babel}\usepackage[utf8]{inputenc}\usepackage[babel,german=quotes]{csquotes}\usepackage[T1]{fontenc}\usepackage{tabularx}\usepackage[absolute,overlay]{textpos}\usepackage{wallpaper}\usepackage{tabu}\areaset{17cm}{26cm}\setlength{\topmargin}{-1.5cm}\setlength{\marginparwidth}{0.5cm} \renewcommand{\familydefault}{\sfdefault}\usepackage{helvet}   \begin{document} \tabulinesep=0.5ex\begin{table}[H]     \begin{tabu} spread \linewidth {|p{0.1cm}X[m]|m{2.5cm}|m{2.5cm}|m{2.5cm}|}         \hline          & \textbf{Fragen} & \centering{Antwort A} & \centering{Antwort B - braucht auch etwas mehr Platz} &         \centering{Antwort C} \tabularnewline         \hline         c.& langer Text langer Text langer Text langer Text langer Text & \centering{1} & \centering{2} & \centering{3} \tabularnewline         \hline         d. & kurzer Text & \centering{1} & \centering{2} & \centering{3} \tabularnewline         \hline         e. & kurzer Text & \centering{1} & \centering{2} & \centering{3} \tabularnewline         \hline         f. & langer Text langer Text langer Text langer Text langer Text langer Text langer Text & \centering{1} & \centering{2} & \centering{3} \tabularnewline         \hline     \end{tabu}\end{table}  \end{document}

best regards
Richie

cgnieder
Site Moderator
Posts: 1990
Joined: Sat Apr 16, 2011 7:27 pm
Hi Richie,

Welcome to the LaTeX community. I must confess it's not really clear to me what you want to achieve... However, since you apparently understand German you may be interested in this post on TeXwelt.de/wissen: Wie kann ich innerhalb einer Tabellenzelle vertikal zentrieren?. It explains how the vertical alignment of p{}-, m{}- and b{}-type columns works.

Regards
site moderator & package author

richi-rich
Posts: 4
Joined: Tue Jul 30, 2013 10:13 am

What I try to achieve is a table, that looks like this:

a.xxxxxxxxx|         |         |         |   xxxxxxxxx|    x    |    x    |    x    |   xxxxxxxxx|         |         |         |------------------------------------------b.xxxxxxxxx|         |         |         |   xxxxxxxxx|    x    |    x    |    x    |   xxxxxxxxx|         |         |         |------------------------------------------

and so on...

best regards,
Richie

cgnieder
Site Moderator
Posts: 1990
Joined: Sat Apr 16, 2011 7:27 pm
Here's an idea: make the labels a., b., ... part of the full cells. Below I use a dummy first column and place the labels with \llap to the left of the first line of the full cells:


tabelle.png (25.5 KiB) Viewed 15716 times

Regards
site moderator & package author

richi-rich
Posts: 4
Joined: Tue Jul 30, 2013 10:13 am
Hy,

This works well, also with arabic numbers using \arabic instead of \alpha

\newcounter{tablabel}\renewcommand*\thetablabel{\arabic{tablabel}.}\newlength\tablabelsep\setlength\tablabelsep{1em}\newlength\tablabelwidth\setlength\tablabelwidth{1em}

Thanks for the help!

Regards
Richie