Graphics, Figures & TablesVertical centering in table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Vertical centering in table

Post by svend_tveskaeg »

Hi all.

Consider the following example.

Code: Select all

\documentclass{article}

\usepackage[danish]{babel}
\usepackage{ragged2e,array,booktabs}

\begin{document}

\begin{center}
\begin{tabular}{>{\RaggedRight\arraybackslash}p{4cm} @{\quad}
c c c c c c c c}
  \toprule
   Tid ({\aa}r efter 1960)
   & $0$     & $6$     & $11$    & $15$    & $20$    & $25$
   & $30$    & $37$\\
  \midrule
   Hektarudbytte \newline (ton hvede pr. hektar)
   & $1{,}1$ & $1{,}3$ & $1{,}5$ & $1{,}6$ & $1{,}8$ & $2{,}1$
   & $2{,}3$ & $2{,}6$\\
  \bottomrule
\end{tabular}
\end{center}

\end{document}
I would like the numbers in the second row (1.1, 1.3, ...) to be vertically centered relative to the text ``Hektarudbytte (ton hvede pr. hektar)''.

How do I do that?

Thanks in advance (and merry christmas)!
Last edited by svend_tveskaeg on Mon Dec 27, 2010 4:45 am, edited 1 time in total.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Vertical centering in table

Post by Montag »

Hey, I think what you are looking for can be done via multicol. :)
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Vertical centering in table

Post by svend_tveskaeg »

Thank you!

I have looked at the package but I could not figure out how to do it.
Can you (or someone else) please `knead' my example in order for it to work the way I want.

(Normally I use ``Introduktion til LaTeX'' (``Introduction to LaTeX'')---a free Danish LaTeX book by Lars Madsen---for quick references but I have not found a solution in it which does exactly what I want.)

Thank you in advance!
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Vertical centering in table

Post by Montag »

When I wrote of "multicol" in my last reply, I meant and actually thought of multirow instead - please don't ask why I wrote the actual opposite (concerning tables). :)
Attachments
multicol-ragged2e.tex
(665 Bytes) Downloaded 266 times
Last edited by Montag on Mon Dec 27, 2010 1:20 pm, edited 1 time in total.
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Re: Vertical centering in table

Post by svend_tveskaeg »

This is exactly what I was looking for. Thank you very much!
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Post Reply