General ⇒ help with tabular columns please
-
- Posts: 2
- Joined: Fri Apr 04, 2008 3:02 pm
help with tabular columns please
1. set the width of both columns to 4cm (to get appr. 8cm table)
2. center both columns' input
\begin{tabular}[H]{ c | c }
nicht gewichtet & statistisch gewichtet \\ \hline \\
$\frac{\Delta x_c}{x_c} = 0,00343$ & $\frac{\Delta x_c}{x_c} = 0,00543$ \\
$\frac{\Delta w}{w} = 0,03769$ & $\frac{\Delta w}{w} = 0,05194$ \\
$\frac{\Delta A}{A} = 0,03264$ & $\frac{\Delta A}{A} = 0,05410$ \\
\end{tabular}
{c | c} centers the fractions however the columns have different width, which I don't want.
{p{4cm} | p{4cm}} sets both columns' width to 4cm but doesn't center the input
I'd really appreciate your help as this paper is due to monday.
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
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
help with tabular columns please
you could use p-columns and \centering inside the table cells.
Additionally you may use the aligned environment of amsmath, to align the equal signs:
Code: Select all
\begin{tabular}[H]{p{4cm}|p{4cm}}
nicht gewichtet & statistisch gewichtet \\ \hline \\
\centering$\begin{aligned}
\tfrac{\Delta x_c}{x_c} &= 0,00343 \\
\tfrac{\Delta w}{w} &= 0,03769 \\
\tfrac{\Delta A}{A} &= 0,03264
\end{aligned}$ &
\centering$\begin{aligned}
\tfrac{\Delta x_c}{x_c} &= 0,00543 \\
\tfrac{\Delta w}{w} &= 0,05194 \\
\tfrac{\Delta A}{A} &= 0,05410
\end{aligned}$
\end{tabular}
Stefan
-
- Posts: 2
- Joined: Fri Apr 04, 2008 3:02 pm
Re: help with tabular columns please
One question though, why do you use the command \tfrac{}{}? When I try it, I do not get a fraction but rather a multiplication. Anyway thanks again!
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
help with tabular columns please
I used \tfrac because it gives the fraction like {\textstyle\frac ... } (actually defined as \genfrac{}{}{}1) , see amsmath user's manual. It should work if you are using amsmath.
Stefan