As commented, the first \\ causes the extra vertical lines. Also, \cline{1-4} is equivalent to \hline, which better describes how you’re using it.

But I would redesign the table a bit. The first thing is to use booktabs and take its advice: vertical lines kill puppies, and horizontal lines are usually unnecessary (more seriously, lines should not be necessary to help interpret the data in a table, and can actually hinder interpretation). We can also use siunitx to have it format the numbers and line things up nicely. (And to keep the line breaks, we’ll use \specialcell from https://tex.stackexchange.com/a/19678/107497). I end up with:

\documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{siunitx}

\newcommand{\specialcell}[2][c]{%
  \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}

\begin{document}

\begin{tabular}{
S[table-format=1]
 S[table-format=1.6]
  S[table-format=6]
   S[table-format=2.2]}\toprule
{\multirow{2}{*}{\specialcell{Exact\\age}}} & \multicolumn{3}{c}{male}\\ \cmidrule(l){2-4}
    & {\specialcell{Death\\probability}}
    & {\specialcell{Number\\of lives}}
    & {\specialcell{Life\\expectancy}} \\ \midrule
0   & 0.007589      & 100000     & 73.98 \\
1   & 0.000543      & 99241      & 73.54 \\
2   & 0.000376      & 99187      & 72.58 \\\bottomrule
\end{tabular}

\end{document}

which renders as
code output

When you go to include females, you’ll want to change the \cmidrule(l) to (lr). And as a bonus, this table is a little more compact (although that is mostly due to new linebreaks in the first and last columns).



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *