Graphics, Figures & TablesMysterious missing $ in subfloats...

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
joewcross
Posts: 3
Joined: Tue Aug 31, 2010 2:21 pm

Mysterious missing $ in subfloats...

Post by joewcross »

Hi,

I am trying to make a float with subtables (in reality, arrays to get the large braces). Each subtable should look like the minimal example below.

Code: Select all

% Standard preamble
\documentclass[11pt,a4paper,twoside,titlepage]{book}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

% Graphics packages
\usepackage{graphicx}
\usepackage{subfig}

% Multirow tables
\usepackage{multirow}

\begin{document}

\begin{table}
\centering
\[ 		
	\begin{array}{rl}
  		\hline
   	 		94^{\circ}\mathrm{C} & 2^{\prime} \\
   			\multirow{3}{*}{$35\times\Bigg\{\:$}
			94^{\circ}\mathrm{C} & 30^{\prime\prime} \\ 
    		        58^{\circ}\mathrm{C} & 30^{\prime\prime} \\
			72^{\circ}\mathrm{C} & 30^{\prime\prime} \\
			72^{\circ}\mathrm{C} & 10^{\prime} \\ \hline  
  	\end{array}
  	\]
  	\caption{A single table.}
\end{table}

\end{document}

So far, so good. However, if I place several of them as \subfloats, like so:

Code: Select all

% Standard preamble
\documentclass[11pt,a4paper,twoside,titlepage]{book}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

% Graphics packages
\usepackage{graphicx}
\usepackage{subfig}

% Multirow tables
\usepackage{multirow}

\begin{document}

\begin{table}
\centering
\subfloat[Table 1]
{
\[ 		
	\begin{array}{rl}
  		\hline
   	 		94^{\circ}\mathrm{C} & 2^{\prime} \\
   			\multirow{3}{*}{$35\times\Bigg\{\:$}
			94^{\circ}\mathrm{C} & 30^{\prime\prime} \\ 
    		        58^{\circ}\mathrm{C} & 30^{\prime\prime} \\
			72^{\circ}\mathrm{C} & 30^{\prime\prime} \\
			72^{\circ}\mathrm{C} & 10^{\prime} \\ \hline  
  	\end{array}
\]
}
\subfloat[Table 2]
{
\[ 		
	\begin{array}{rl}
  		\hline
   	 		94^{\circ}\mathrm{C} & 2^{\prime} \\
   			\multirow{3}{*}{$35\times\Bigg\{\:$}
			94^{\circ}\mathrm{C} & 30^{\prime\prime} \\ 
    		        58^{\circ}\mathrm{C} & 30^{\prime\prime} \\
			72^{\circ}\mathrm{C} & 30^{\prime\prime} \\
			72^{\circ}\mathrm{C} & 10^{\prime} \\ \hline  
  	\end{array}
\]
}
  	\caption{Two tables.}
\end{table}

\end{document}
I get the following error:

Code: Select all

! Missing $ inserted.
<inserted text> 
                $
l.32 }
      
? 
! Missing $ inserted.
<inserted text> 
                $
l.32 }
      
? 

! LaTeX Error: Bad math environment delimiter.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.32 }
      
? 
For each subfloat.

I suspect it is something to do with having inline ($) math within the display (\[, \]) math environment. To be honest, I'm not sure why the arrays are styled that way - I asked on the forums about how to get multirow braces in a table and was given an example which had them arranged that way. It worked, so I didn't question it. Now, when I try and use subfloats, it becomes a issue.

For the record, the output is exactly how I want it to be so the problem is simply one of having to wade through the error messages when running pdflatex. It also offends my aesthetic sense to have code which produces errors, no matter how functional it is!

Any help would be greatly appreciated.

J

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

Mysterious missing $ in subfloats...

Post by Stefan Kottwitz »

You could place the \[ ... \] environments in a \parbox or {minipage}, then the error would go away.

Code: Select all

\begin{table}
\centering
\subfloat[Table 1]
{
\parbox{.5\textwidth}{\[             
        \begin{array}{rl}
                \hline
                        94^{\circ}\mathrm{C} & 2^{\prime} \\
                        \multirow{3}{*}{$35\times\Bigg\{\:$}
                        94^{\circ}\mathrm{C} & 30^{\prime\prime} \\
                        58^{\circ}\mathrm{C} & 30^{\prime\prime} \\
                        72^{\circ}\mathrm{C} & 30^{\prime\prime} \\
                        72^{\circ}\mathrm{C} & 10^{\prime} \\ \hline  
        \end{array}
\]
}}
\subfloat[Table 2]
{
\parbox{.5\textwidth}{\[             
        \begin{array}{rl}
                \hline
                        94^{\circ}\mathrm{C} & 2^{\prime} \\
                        \multirow{3}{*}{$35\times\Bigg\{\:$}
                        94^{\circ}\mathrm{C} & 30^{\prime\prime} \\
                        58^{\circ}\mathrm{C} & 30^{\prime\prime} \\
                        72^{\circ}\mathrm{C} & 30^{\prime\prime} \\
                        72^{\circ}\mathrm{C} & 10^{\prime} \\ \hline  
        \end{array}
\]
}}
        \caption{Two tables.}
\end{table}

Stefan
LaTeX.org admin
Post Reply