Graphics, Figures & TablesTable Lines Spacing and Column Lines

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
workerbee
Posts: 43
Joined: Sat Nov 22, 2008 1:53 am

Table Lines Spacing and Column Lines

Post by workerbee »

Hi Community!

I've searched the forum for any answers to this but haven't found one. Is there a way to add additional space in specific rows without interrupting column lines?

For instance, the attached images that show what I would like (the first attachment using a table in Word with additional space before and after the horizontal lines with continuous column lines) and what I keep getting (the second attachment).

Coding-wise, I'm using this (with booktabs package):

Code: Select all

\begin{tabular}[t]{ l c | c c | c c }
\toprule
& & Not & & & Odds \\
& n & dependent & Dependent & Prop & (Prop$/$(1-Prop)) \\
\midrule
Female & 4573 & 4317 & 256 & 0.056 & 0.059 \\
Male & 4603 & 3904 & 699 & 0.152 & 0.179 \\
\midrule
Total & 9176 & 8221 & 955 \\
\bottomrule
\end{tabular}
Attachments
What I want.
What I want.
table-desired.png (41.98 KiB) Viewed 3939 times
What i got until now.
What i got until now.
table-result.png (53.87 KiB) Viewed 3939 times

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
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Table Lines Spacing and Column Lines

Post by localghost »

The booktabs package aims to typeset good looking tables without any vertical lines. So it is not the right tool here. Try the quite new tabu package. It offers mechanisms to get the desired result.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tabu,multirow}

\setlength{\extrarowsep}{2pt}

\begin{document}
  \begin{tabu}{lc|cc|cc}\hline
    & \multirow{2}{*}[3pt]{n} & Not & \multirow{2}{*}[3pt]{Dependent} & \multirow{2}{*}[3pt]{Prop} & Odds \\[-6pt]
    & & dependent & & & (Prop$/$(1-Prop)) \\ \hline
    Female & 4573 & 4317 & 256 & 0.056 & 0.059 \\
    Male   & 4603 & 3904 & 699 & 0.152 & 0.179 \\ \hline
    Total  & 9176 & 8221 & 955 \\ \hline
  \end{tabu}
\end{document}
The multirow package helps to align some single row entries with respect to multiple row entries.


Thorsten
Post Reply