GeneralVertical space in table cells

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
drumex
Posts: 12
Joined: Mon Apr 14, 2008 2:18 am

Vertical space in table cells

Post by drumex »

Hi. I ran into this problem today. I had the table below, and the fractions collided with the borders and there wasn't enough padding around them in general.

Image

So I browsed around and I though I had found a solution to this (adding the [1ex] bit), but it doesn't work as I hoped it would.

Here's what I used to produce the table.

Code: Select all

Code, edit and compile here:
\begin{tabular}{c|c|cccccc|cl}
Basic & z & $x_1$ & $x_2$ & $x_3$ & $x_4$ & $x_5$ & $x_6$ & Solution & \\[1ex]
\cline{1-9}
$x_4$ & 0 & $-\frac{4}{7}$ & $-\frac{1}{7}$ & 0 & 1 & $-\frac{3}{7}$ & 0 & $-\frac{170}{7}$ & $r_1:=r_1-3r_2$\\[1ex]
$x_3$ & 0 & $\frac{4}{7}$ & $\frac{5}{7}$ & 1 & 0 & $\frac{1}{7}$ & 0 & $\frac{40}{7}$ & \\[1ex]
$x_6$ & 0 & $\frac{9}{7}$ & $\frac{20}{7}$ & 0 & 0 & $-\frac{3}{7}$ & 1 & $\frac{100}{7}$ & $r_3:=r_3-3r_2$\\[1ex]
\cline{1-9}
$z$ & 1 & $-1$ & $-2$ & 0 & 0 & $-1$ & 0 & 40 &\\
\end{tabular}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
And this is what it comes up with.

Image

As you can see, it's not exactly what I wanted. How can I fix this?
Windows Vista (SP1), MiKTeX 2.7, TeXnicCenter 1.0 RC1

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Vertical space in table cells

Post by balf »

Try the booktabs package, which has commands/parameters for that. Just one problem : you cannot use vertical lines. Take a look at the doc: the author explains why vertical lines should be prohibited for professional quality documents.

B.A.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Vertical space in table cells

Post by Stefan Kottwitz »

Hi drumex,

try redefining \arraystretch, for example:

Code: Select all

\renewcommand*\arraystretch{1.5}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Vertical space in table cells

Post by localghost »

The array package offers the option to declare the length \extrarowheight for additional line spacing. Details can be found in the documentation.


Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
drumex
Posts: 12
Joined: Mon Apr 14, 2008 2:18 am

Re: Vertical space in table cells

Post by drumex »

Thank you all for your suggestions. I used Stefan's method as it looked very simple and it did the job.
Windows Vista (SP1), MiKTeX 2.7, TeXnicCenter 1.0 RC1
Post Reply