7

I want to display measurement outcomes in a table that lets the viewer read off the measurement value of N and $\Theta$. The picture below shows my first attempt. While this is ok, I would like to make it look nicer. For starters, how do I get the vertical line to go all the way trough? The code is also appended below.

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath, amsmath, amssymb}
\usepackage[utf8x]{inputenc}
\usepackage{caption}
\begin{document}

\begin{table}[H]\centering
\caption{\label{tab2} FMM: profiling of subroutines}
    \begin{tabular}{ll|cccccc}\toprule
    & & \multicolumn{6}{c}{N} \\
    ~ &  & 100    & 200    & 400    & 800    & 1600   & 3200   \\
    \midrule\\
    & 0.1 & 0.0008 & 0.0020 & 0.0056 & 0.0180 & 0.0556 & 0.1708 \\
    & 0.2 & 0.0008 & 0.0016 & 0.0036 & 0.0108 & 0.0300 & 0.0792 \\
   $\Theta$ & 0.4 & 0.0004 & 0.0012 & 0.0028 & 0.0060 & 0.0140 & 0.0344 \\
    & 0.8 & 0.0004 & 0.0008 & 0.0016 & 0.0036 & 0.0064 & 0.0148 \\
    & 1.6 & 0.0004 & 0.0004 & 0.0008 & 0.0028 & 0.0036 & 0.0080 \\ \hline
    \end{tabular}
\end{table}
\end{document}
  • Welcome to TeX.SX! Please make your code compilable, starting with \documentclass{...} and ending with \end{document}. – jub0bs May 14 '13 at 10:38
  • @Jubobs just did, is it ok like that? – seb May 14 '13 at 10:41
  • 1
    Yes, that looks much better :) The rationale is that you want to make it easy for others to help you; you're more likely to get a speedy and satisfactory answer if people don't have to "manually" complete your code in order to compile it, understand what you're trying to achieve and fix what's wrong or missing. So, posting a MWE is a good habit to take on this site. – jub0bs May 14 '13 at 10:47
  • 1
    I'd remove the \\ after the \midrule. – user10274 May 14 '13 at 11:02
  • 1
    Also I'd use \bottomrule instead of \hline. – user10274 May 14 '13 at 11:04
4

no vertical lines, no centering, friendlier spacing:

enter image description here

\documentclass[12pt]{article}
\usepackage{booktabs,leading}
\usepackage[utf8]{inputenc}
\usepackage[justification=raggedright,singlelinecheck=false]{caption}

\begin{document}

\begin{table}
\leading{16pt}
\caption{\label{tab2} FMM: profiling of subroutines}

    \begin{tabular}{llllllll}
    \cmidrule[0.08em](r){1-2}\cmidrule[0.08em]{3-8}
    & & \textbf{N} \\
     &  & \textbf{100} & \textbf{200} & \textbf{400} & \textbf{800} & \textbf{1600} & \textbf{3200} \\
    \cmidrule[0.08em](r){1-2}\cmidrule[0.08em]{3-8}
    $\Theta$ & 0.1 & 0.0008 & 0.0020 & 0.0056 & 0.0180 & 0.0556 & 0.1708 \\
    & 0.2 & 0.0008 & 0.0016 & 0.0036 & 0.0108 & 0.0300 & 0.0792 \\
    & 0.4 & 0.0004 & 0.0012 & 0.0028 & 0.0060 & 0.0140 & 0.0344 \\
    & 0.8 & 0.0004 & 0.0008 & 0.0016 & 0.0036 & 0.0064 & 0.0148 \\
    & 1.6 & 0.0004 & 0.0004 & 0.0008 & 0.0028 & 0.0036 & 0.0080 \\
        \cmidrule[0.05em](r){1-2}\cmidrule[0.05em]{3-8}
    \end{tabular}
\end{table}
\end{document}
5

enter image description here

Don't use vertical lines at all:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath, amsmath, amssymb}
\usepackage{caption}
\usepackage{ctable}
\usepackage{multirow}
\begin{document}

\begin{table}[H]\centering
\caption{\label{tab2} FMM: profiling of subroutines}
    \begin{tabular}{lcccccc}\FL
    \multirow{2}{*}{$\Theta$} & \multicolumn{6}{c}{N} \NN
    \cmidrule(rl){2-7}
         & 100    & 200    & 400    & 800    & 1600   & 3200   \ML
     0.1 & 0.0008 & 0.0020 & 0.0056 & 0.0180 & 0.0556 & 0.1708 \\
     0.2 & 0.0008 & 0.0016 & 0.0036 & 0.0108 & 0.0300 & 0.0792 \\
     0.4 & 0.0004 & 0.0012 & 0.0028 & 0.0060 & 0.0140 & 0.0344 \\
     0.8 & 0.0004 & 0.0008 & 0.0016 & 0.0036 & 0.0064 & 0.0148 \\
     1.6 & 0.0004 & 0.0004 & 0.0008 & 0.0028 & 0.0036 & 0.0080 
    \LL
    \end{tabular}
\end{table}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.