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.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- 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: 10335
- 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