Information and discussion about graphics, figures & tables in LaTeX documents.
Cham
Posts: 937 Joined: Sat Apr 02, 2011 4:06 pm
Post
by Cham » Tue Mar 06, 2012 5:51 am
The table below (complete compilable code) has a small aesthetical problem with its vertical spacing. The lines are too close from each other. How can I make them "breath" ?
Code: Select all
\documentclass[12pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{amsmath}
\usepackage{tensor}
\usepackage{booktabs}
\usepackage{xcolor}
\usepackage{colortbl}
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{cl*5{>{\centering\arraybackslash}p{1cm}}}
\arrayrulecolor{black}
\toprule[1.5pt]
\toprule[.5pt]
$\mathcal{C}$ & & $\tensor{\Omega}{_{\text\it mat}}$ & $\tensor{\Omega}{_{\text\it rad}}$ & $\tensor{\Omega}{_{\Lambda}}$ & $\tensor{a}{_*} / \tensor{a}{_0}$ & $k$ \\
\midrule
1 & Univers de poussières : & $1$ & $0$ & $\tfrac{3 \sqrt{3}}{2}$ & $\tfrac{1}{\sqrt{3}}$ & $1$ \\
2 & Univers de radiation : & $0$ & $1$ & $4$ & $\tfrac{1}{\sqrt{2}}$ & $1$ \\
3 & Univers mixte : & $\tfrac{1}{2}$ & $\tfrac{1}{2}$ & $\tfrac{27}{8}$ & $\tfrac{2}{3}$ & $1$ \\
\bottomrule[.5pt]
\bottomrule[1.5pt]
\end{tabular}
\caption{A caption}
\end{table}
\end{document}
EDIT : I added the option
[4pt] after each "
\\ ", which is almost right. The remaining problem is the spacing below the
\midrule isn't the same as the
[4pt] above the
\bottomrule[.5pt] .
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
localghost
Site Moderator
Posts: 9202 Joined: Fri Feb 02, 2007 12:06 pm
Post
by localghost » Tue Mar 06, 2012 10:43 am
You can stretch the complete table vertically by redefining the
\arraystretch
command.
Code: Select all
\documentclass[12pt,letterpaper,french]{book}
\usepackage[T1]{fontenc}
\usepackage{selinput}
\SelectInputMappings{
aacute={á},
ccedilla={ç},
Euro={€}
}
\usepackage{babel}
\usepackage[tableposition=top]{caption}
\usepackage{mathtools} % loads »amsmath«
\usepackage{booktabs}
\usepackage{tensor}
\usepackage[table]{xcolor}
\begin{document}
\begin{table}[!ht]
\renewcommand{\arraystretch}{1.3} % <<< This is the set screw
\caption{A caption}
\centering
\begin{tabular}{cl*5{>{\centering\arraybackslash}p{1cm}}}\toprule[1.5pt]\toprule[.5pt]
$\mathcal{C}$ & & $\tensor{\Omega}{_{\text\it mat}}$ & $\tensor{\Omega}{_{\text\it rad}}$ & $\tensor{\Omega}{_{\Lambda}}$ & $\tensor{a}{_*} / \tensor{a}{_0}$ & $k$ \\ \midrule
1 & Univers de poussières : & $1$ & $0$ & $\tfrac{3 \sqrt{3}}{2}$ & $\tfrac{1}{\sqrt{3}}$ & $1$ \\
2 & Univers de radiation : & $0$ & $1$ & $4$ & $\tfrac{1}{\sqrt{2}}$ & $1$ \\
3 & Univers mixte : & $\tfrac{1}{2}$ & $\tfrac{1}{2}$ & $\tfrac{27}{8}$ & $\tfrac{2}{3}$ & $1$ \\ \bottomrule[.5pt]\bottomrule[1.5pt]
\end{tabular}
\end{table}
\end{document}
Thorsten
Cham
Posts: 937 Joined: Sat Apr 02, 2011 4:06 pm
Post
by Cham » Tue Mar 06, 2012 4:52 pm
Well, I don't understand why the spacing isn't the same above and under the table's content. See the picture below :
spacing.jpg (24.81 KiB) Viewed 4445 times
How can we make the table vertically symetrical ?
localghost
Site Moderator
Posts: 9202 Joined: Fri Feb 02, 2007 12:06 pm
Post
by localghost » Tue Mar 06, 2012 5:57 pm
I can't confirm these difficulties (see attachment). Perhaps a matter of outdated packages. With the
\listfiles
as very first line in my example I get this this list of used files (not all up to date) from the log file.
Code: Select all
*File List*
book.cls 2007/10/19 v1.4h Standard LaTeX document class
bk12.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
fontenc.sty
t1enc.def 2005/09/27 v1.99g Standard LaTeX file
selinput.sty 2007/09/09 v1.2 Select input encoding (HO)
inputenc.sty 2008/03/30 v1.1d Input encoding file
kvsetkeys.sty 2011/04/07 v1.13 Key value parser (HO)
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/message (HO)
etexcmds.sty 2011/02/16 v1.5 Prefix for e-TeX command names (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
stringenc.sty 2010/03/01 v1.8 Converts strings between encodings (HO)
ltxcmds.sty 2011/04/18 v1.20 LaTeX kernel commands for general use (HO)
pdfescape.sty 2011/04/04 v1.12 Provides string conversions (HO)
pdftexcmds.sty 2011/04/22 v0.16 Utilities of pdfTeX for LuaTeX (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
kvoptions.sty 2010/12/23 v3.10 Keyval support for LaTeX options (HO)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
ix-name.def 2011/04/10 v1.8 Name list (inputenx)
se-utf8.def 2010/03/01 v1.8 stringenc: UTF-8
utf8.def 2008/04/05 v1.1m UTF-8 support for inputenc
t1enc.dfu 2008/04/05 v1.1m UTF-8 support for inputenc
ot1enc.dfu 2008/04/05 v1.1m UTF-8 support for inputenc
omsenc.dfu 2008/04/05 v1.1m UTF-8 support for inputenc
babel.sty 2008/07/06 v3.8l The Babel package
frenchb.ldf 2009/03/16 v2.3d French support from the babel system
frenchb.cfg
scalefnt.sty
caption.sty 2010/01/09 v3.1m Customizing captions (AR)
caption3.sty 2010/01/14 v3.1m caption3 kernel (AR)
mathtools.sty 2011/02/12 v1.10 mathematical typesetting tools
calc.sty 2007/08/22 v4.3 Infix arithmetic (KKT,FJ)
mhsetup.sty 2010/01/21 v1.2a programming setup (MH)
amsmath.sty 2000/07/18 v2.13 AMS math features
amstext.sty 2000/06/29 v2.01
amsgen.sty 1999/11/30 v2.0
amsbsy.sty 1999/11/29 v1.2d
amsopn.sty 1999/12/14 v2.01 operator names
booktabs.sty 2005/04/14 v1.61803 publication quality tables
tensor.sty 2004/12/20 v2.1 tensor indices package (PGR)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
colortbl.sty 2001/02/13 v0.1j Color table columns (DPC)
array.sty 2008/09/09 v2.4c Tabular extension package (FMi)
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
epstopdf-base.sty 2010/02/09 v2.5 Base part for package epstopdf
grfext.sty 2010/08/19 v1.1 Managing graphics extensions (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Defining keys (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
supp-pdf.mkii
***********
So you might need an update.
Attachments
The output as obtained by the given example. table-vertical-spacing.png (12.02 KiB) Viewed 4441 times
Cham
Posts: 937 Joined: Sat Apr 02, 2011 4:06 pm
Post
by Cham » Tue Mar 06, 2012 7:58 pm
I've updated my LaTeX installation to the latest version and there's no differences in the table's output. I'm still getting an asymmetrical vertical spacing. I compiled your example above, and changed that command :
\renewcommand{\arraystretch}{1.3}
to
\renewcommand{\arraystretch}{2.3}
just to see the difference. And the vertical spacing is clearly asymmetrical.