Graphics, Figures & TablesBetter looking Table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Better looking Table

Post by NELLLY »

Hi,

I want to get the table more pretty. For example I want that the "Namecol" becomes aligned with the \cmidrule.

Code: Select all

\documentclass{article}

\begin{document}
  \begin{table}[bth]
    \caption{Level planning of the input parameters}
    \begin{tabular}{ccc}\toprule[1.2pt]
      &\multicolumn{2}{c}{Level}\\\cmidrule{2-3}
      Namecol&aa&bb\\\midrule
      $...&...&... \\\bottomrule[1.2pt]
    \end{tabular}
  \end{table}
\end{document}
Is there alternatives to do so and other way to get the table looks more pretty?

Thanks.

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

Better looking Table

Post by mas »

You should post a compilable example. You have forgotten to include booktabs package which makes the code uncompilable.

Here is my attempt at what you might need. Take a look at multirow for entries spanning multiple rows.

Code: Select all

\documentclass{article}
\usepackage{booktabs,multirow}

\begin{document}
  \begin{table}[bth]
    \caption{Level planning of the input parameters}
    \centering
    \begin{tabular}{ccc}\toprule[1.2pt]
      \multirow{2}{*}{Namecol} &
      \multicolumn{2}{c}{Level}\\\cmidrule{2-3}
      &aa&bb\\\midrule
     ...&...&... \\\bottomrule[1.2pt]
    \end{tabular}
  \end{table}
\end{document}

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Re: Better looking Table

Post by NELLLY »

Many thanks. This works perfectly.
Post Reply