Graphics, Figures & TablesA better table ?

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

A better table ?

Post by Cham »

How can I add an extra vertical space below the first line, just before the data ? \vspace doesn't work.

Recommended reading 2024:

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

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

User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

A better table ?

Post by Cham »

Guys, I still need some help.

For the moment, I can't decide between these three table styles :

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*4{>{\centering\arraybackslash}p{1cm}}}
	\toprule[1.5pt]
	\toprule[.5pt]
	$\mathcal{C}$ & & $\tensor{\Omega}{_{\text\it mat}}$ & $\tensor{\Omega}{_{\text\it rad}}$ & $\tensor{\Omega}{_{\Lambda}}$ & $k$ \\
	\midrule %\hline
	%\rowcolor[gray]{0.9}
	1 & Univers vide : & 0 & 0 & 0 & $-1 $ \\
	2 & Univers de poussières : & 1 & 0 & 0 & $0$ \\
	%\rowcolor[gray]{0.9}
	3 & Univers clos : & 4 & 0 & 0 & $1$ \\
	4 & Univers de radiation : & 0 & 1 & 0 & $0$ \\
	%\rowcolor[gray]{0.9}
	5 & Univers de deSitter : & 0 & 0 & 1 & $0$ \\
	6 & $\Lambda$CDM : & 0.3 & 0 & 0.7 & $0$ \\
	\bottomrule[.5pt]
	\bottomrule[1.5pt]
	\end{tabular}
	\caption{A caption.}
\end{table}

\begin{table}[H]
	\centering
\begin{tabular}{cl*4{>{\centering\arraybackslash}p{1cm}}}
	\toprule[1.5pt]
	\toprule[.5pt]
	$\mathcal{C}$ & & $\tensor{\Omega}{_{\text\it mat}}$ & $\tensor{\Omega}{_{\text\it rad}}$ & $\tensor{\Omega}{_{\Lambda}}$ & $k$ \\
	%\hline
	\rowcolor[gray]{0.9}
	1 & Univers vide : & 0 & 0 & 0 & $-1 $ \\
	2 & Univers de poussières : & 1 & 0 & 0 & $0$ \\
	\rowcolor[gray]{0.9}
	3 & Univers clos : & 4 & 0 & 0 & $1$ \\
	4 & Univers de radiation : & 0 & 1 & 0 & $0$ \\
	\rowcolor[gray]{0.9}
	5 & Univers de deSitter : & 0 & 0 & 1 & $0$ \\
	6 & $\Lambda$CDM : & 0.3 & 0 & 0.7 & $0$ \\
	\bottomrule[.5pt]
	\bottomrule[1.5pt]
	\end{tabular}
	\caption{A caption again.}
\end{table}

\begin{table}[H]
	\centering
\begin{tabular}{!{\vline}cl*4{>{\centering\arraybackslash}p{1cm}}!{\vline}}
	\hline
	\rowcolor[gray]{0.6}\color{white} $\mathcal{C}$ & & $\color{white} \tensor{\Omega}{_{\text\it mat}}$ & $\color{white} \tensor{\Omega}{_{\text\it rad}}$ & $\color{white} \tensor{\Omega}{_{\Lambda}}$ & $\color{white} k$ \\
	%\hline
	\rowcolor[gray]{0.98}
	1 & Univers vide : & 0 & 0 	& 0 & $-1 $ \\
	\rowcolor[gray]{0.9}
	2 & Univers de poussières : & 1 & 0 & 0 & $0$ \\
	\rowcolor[gray]{0.98}
	3 & Univers clos : & 4 & 0 & 0 & $1$ \\
	\rowcolor[gray]{0.9}
	4 & Univers de radiation : & 0 & 1 & 0 & $0$ \\
	\rowcolor[gray]{0.98}
	5 & Univers de deSitter : & 0 & 0 & 1 & $0$ \\
	\rowcolor[gray]{0.9}
	6 & $\Lambda$CDM : & 0.3 & 0 & 0.7 & $0$ \\
	\hline
	\end{tabular}
	\caption{Another caption.}
\end{table}

\end{document}
The first one is perfect, but it's dull to look at. The third table is very nice too, but there are some white vertical lines in the first row, and I would prefer to remove them (how ?), I would also like to raise a bit the spacing between each line in this case.

Any suggestion ?

Here's a preview :
3tables.jpg
3tables.jpg (88.92 KiB) Viewed 1868 times
Post Reply