Graphics, Figures & TablesTable double Row or more Space

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
jono90one
Posts: 3
Joined: Wed Oct 27, 2010 6:06 pm

Table double Row or more Space

Post by jono90one »

Hi,
My problem seems a simple one but i haven't been able to figure it out.
Here's the table
table-capture.png
table-capture.png (159.37 KiB) Viewed 2523 times
And the command:

Code: Select all

\begin{table}[ht]
\caption{Nonlinear model results}
\centering
\addtolength{\tabcolsep}{-12pt}
\begin{tabular}{c c c c} 
\hline\hline\small{
Capacitor$/pF$  & Measured Time Constant $/\mu s$ & Theoretical Time Constant $/\mu s$ & Improved Time Constant $/\mu }s$\newline  
\hline
0 & 6.12\pm0.06 & 6.12\pm0.06 & - & - \newline 
97 & 11.6\pm0.01 & 4.56\pm0.11 & 10.7\pm0.35 & \newline
205 & 18.6\pm0.14 & 9.64\pm0.21 & 15.7\pm0.50 & \newline
441 & 27.4\pm0.14 & 20.7\pm0.44 & 26.8\pm0.84 & \newline
658 & 36.4\pm0.14 & 30.9\pm0.66 & 37.0\pm1.16 & \newline 
2214 & 105\pm0.14 & 104\pm2 & 110\pm3.45 &  \newline
8250 & 381\pm3 & 388\pm8.3 & 394\pm12.4 &\newline 
\hline
\label{Figure 6}
\end{tabular}
\end{table}
The page width is at its max possible so i can't fiddle with that.

Is it possible to have the top row two cells width worth? So the text that overlaps for the column headings simply goes in the cell below like a wrapped text?

Hope you can help :)

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Table double Row or more Space

Post by Stefan Kottwitz »

Hi,

you could use p cells which allow line breaks within. Just use p{width} instead of c. Use \centering for the alignment if needed. This could be done using the array package. For example

Code: Select all

>{\centering}p{2cm}
just instead of c. Further improvements are possible by using booktabs for horizontal lines and siunitx (or dcolumn or rccol) for alignment at symbols.

For explanation and examples regarding this, you could have a look at Creating Tables in LaTeX.

Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Table double Row or more Space

Post by localghost »

I would try another approach.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[margin=3cm]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs,multirow}
\usepackage{siunitx}

\sisetup{%
  load-configurations=abbreviations
}

\begin{document}
  \begin{table}[!ht]
    \caption{Nonlinear model results}\label{fig:nonlinear-model}
    \centering
    \begin{tabular}{%
      S
      S[separate-uncertainty,table-figures-uncertainty=2]
      S[separate-uncertainty,table-figures-uncertainty=2]
      S[separate-uncertainty,table-figures-uncertainty=2]
    }\toprule
      \multirow{2}{*}{Capacitor} & {Measured Time} & {Theoretical Time} & {Improved Time} \\
       & {Constant} & {Constant} & {Constant} \\
      {\si{\pico\farad}} & {\si{\micro\s}} & {\si{\micro\s}} & {\si{\micro\s}} \\ \midrule
      0 & 6.12(6) & 6.12(6) & {-} \\
      97 & 11.60(1) & 4.56(11) & 10.70(35) \\
      205 & 18.60(14) & 9.64(21) & 15.70(5) \\
      441 & 27.40(14) & 20.70(44) & 26.80(84) \\
      658 & 36.40(14) & 30.90(66) & 37.00(116) \\
      2214 & 105.00(14) & 104.00(200) & 110.00(345) \\
      8250 & 381.00(300) & 388.00(830) & 394.00(124) \\ \bottomrule
    \end{tabular}
  \end{table}
\end{document}
It's also worth to take a look at the quite new and very sophisticated tabu package.


Thorsten
Attachments
Rendered output of the given code.
Rendered output of the given code.
table-example.png (23.09 KiB) Viewed 2521 times
Post Reply