GeneralResults table

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
niall
Posts: 2
Joined: Wed Oct 29, 2008 12:54 pm

Results table

Post by niall »

Hello all,

I'm doing an assignment for one of my electives this year, and I need to put a table of results in it. I somehow managed to get by last year without using any tables in my Dissertation, so I'm a bit new to the tables bit. What I want to achieve looks like this:

Image

the code i've used so far looks like this:

Code: Select all

\begin{tabular}{| c | c | c | c | c | c | c | c | c | c |}
\hline
QB & \multicolumn{2}{c |}{Conductivity} &  \multicolumn{2}{c |}{Absorbance} &  \multicolumn{2}{c|}{Pressure} & Dial. Temp &  \multicolumn{2}{c |}{Clearance} \\
ml min$^{-1}$& mS & mmHg & & $^\circ$C & ml min$^{-1}$ \\
\hline
 & inlet & outlet & inlet & outlet & P$_{Bo}$ & P$_{Do}$ &  & NaCl & Na-BSP\\
\hline
300 & 13.87 & 6.42 & 0.465 & 0.39 & 28 & 0 & 38.2 &  & \\
200 & 14.03 & 4.09 & 0.467 & 0.367 & 18 & 0 & 36.5 &  & \\
100 & 13.63 & 1.75 & 0.477 & 0.345 & 13 & 0 & 36.4 &  & \\
50 & 13.75 & 0.30 & 0.482 & 0.292 & 12 & 0 & 37.0 &  & \\
\hline
\end{tabular}
and this gives:

Image

I've had a go with multirows, but that doesn't seem to be working either:

Image

The code i used to try that is the following:

Code: Select all

\begin{tabular}{| c | c | c | c | c | c | c | c | c | c |}
\hline
\multirow{2}{*}{QB} & Conductivity &&  Absorbance &  Pressure & Dial. Temp &  Clearance \\
ml min$^{-1}$& \multicolumn{2}{c|}{mS} & mmHg & & $^\circ$C & ml min$^{-1}$ \\
\hline
 & inlet & outlet & inlet & outlet & P$_{Bo}$ & P$_{Do}$ &  & NaCl & Na-BSP\\
\hline
300 & 13.87 & 6.42 & 0.465 & 0.39 & 28 & 0 & 38.2 &  & \\
200 & 14.03 & 4.09 & 0.467 & 0.367 & 18 & 0 & 36.5 &  & \\
100 & 13.63 & 1.75 & 0.477 & 0.345 & 13 & 0 & 36.4 &  & \\
50 & 13.75 & 0.30 & 0.482 & 0.292 & 12 & 0 & 37.0 &  & \\
\hline
\end{tabular}
cheers!

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Results table

Post by localghost »

First of all you should avoid vertical lines to increase readability of your table. The misalignment comes from a wrong placement of the alignment character (&) and incorrect usage of the \multicolumn command. Look at the following code.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage{fixltx2e}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage[centering,includeheadfoot,margin=2cm]{geometry}
\usepackage{array,dcolumn,booktabs}
\usepackage{textcomp,txfonts}
\usepackage{units}

%General settings
\parindent0em

% Column settings for tables (array,dcolumn)
\newcolumntype{d}{D{.}{.}{-2}}
\newcolumntype{e}{D{.}{.}{-3}}

\begin{document}
  \begin{table}[!ht]
    \centering
    \caption{A results table}\label{tab:results}
    \begin{tabular}{cddeeccccc} \toprule
      QB & \multicolumn{2}{c}{Conductivity} & \multicolumn{2}{c}{Absorbance} & \multicolumn{2}{c}{Pressure} & Dial.~Temp & \multicolumn{2}{c}{Clearance} \\
      \unitfrac{ml}{min} & \multicolumn{2}{c}{mS} & & & \multicolumn{2}{c}{mmHg} & \textcelsius & \multicolumn{2}{c}{\unitfrac{ml}{min}} \\ \midrule
      & \multicolumn{1}{c}{inlet} & \multicolumn{1}{c}{outlet} & \multicolumn{1}{c}{inlet} & \multicolumn{1}{c}{outlet} & P\textsubscript{Bo} & P\textsubscript{Do} &  & NaCl & Na-BSP\\ \toprule
      300 & 13.87 & 6.42 & 0.465 & 0.39 & 28 & 0 & 38.2 &  & \\
      200 & 14.03 & 4.09 & 0.467 & 0.367 & 18 & 0 & 36.5 &  & \\
      100 & 13.63 & 1.75 & 0.477 & 0.345 & 13 & 0 & 36.4 &  & \\
      50 & 13.75 & 0.30 & 0.482 & 0.292 & 12 & 0 & 37.0 &  & \\ \bottomrule
    \end{tabular}
  \end{table}
\end{document}
As you can see, I did also some minor visual enhancements to typesetting of physical units. You can get information about the used packages and their documentations on the servers of the CTAN.


Best regards and welcome to the board
Thorsten¹
niall
Posts: 2
Joined: Wed Oct 29, 2008 12:54 pm

Re: Results table

Post by niall »

thank you! I'll give it a try just now and see what happens!
Post Reply