Math & ScienceEnumerated equations in tables

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
rrodolfo
Posts: 5
Joined: Mon Mar 02, 2009 4:05 pm

Enumerated equations in tables

Post by rrodolfo »

I'm new in LaTeX. Since last month I'm transcripting my Thesis from Word2007 to LaTeX and I've got some problems with Tables.

I would like to reproduce similar Table from MS Word:

--
Image
--

to LaTeX. It's 2 enumerated Equations inside Table (in first 2 columns) where there's only one Equation ID in last one column.

I've coded this in LaTeX:

Code: Select all

\begin{table}[!h]
\caption{Cinética da evaporação da umidade adaptada de \citeonline{Benkoussas2007}.}
\centering
\scriptsize
\begin{tabular}{p{30mm} p{35mm} p{20mm} p{20mm} p{20mm} p{8mm}}%{c c c c c c}
\hline
Taxa da reação ($R_j$) & Taxa específica da reação ($k_j$) & Fator pré-exponencial ($A_j$)\footnotemark[1] & Energia de ativação ($E_j$)\footnotemark[1] (kJ/mol) & Calor de reação ($\Delta H_j$) (kJ/kg) & \\
\hline
$R_m = k_mT^{-1/2}\rho_m$ & $k_m = A_m\exp{\left(-\frac{E_m}{RT_s}\right)}$ & 1,0 \cdot 10^4s^{-1} & 57 & 2.2269,7 & \begin{equation}\end{equation}\\
\hline
\multicolumn{6}{l}{\footnotemark[1]{Estimado}}
\end{tabular}
\label{tab:reacevap}
\end{table}
I've written the Equations between $$ and a blank Equation tag \begin{equation}\end{center} to do enumeration.

And I obtained this:

--
Image
--

There're 2 problems:
(1) the vertical space in last column is bigger than others;
(2) when I refered this Table in text using \autoref it appears the label of Equation ("Equação") and the enumeration of Table ("4.6").

My main question is: What's best way to do this task?
Any suggestion'll be welcome...

[]'s
Rodolfo
WinXP(SP2) + MiKTeX 2.7 + TexMaker 1.8

Recommended reading 2024:

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

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

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Enumerated equations in tables

Post by phi »

I think both problems come from the empty equation environment. Normally you don't use equations in tables.
A \label command generally refers to the last structure that has used \refstepcounter. Both \caption and the equation environment change the current reference in this way, so you have to put the \label command after \caption, but before the equation environment. Generally, it's best to put labels as close to the thing they label as possible.
It is better to simulate equation numbering than inserting an empty equation. Perhaps a dedicated units package like siunitx makes typesettings units and quantities a bit easier. Using booktabs gives better results for the horizontal lines. Here is a complete example:

Code: Select all

\documentclass[brazil, version=last, captions=abovetable, pagesize=auto]{scrartcl}

\usepackage{lmodern}
\usepackage{mathpazo}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[locale=DE]{siunitx}


\begin{document}

\begin{table}
\caption{Cinética da evaporação da umidade adaptada de FOOBAR.}
\label{tab:reacevap}
\centering
\scriptsize
\begin{tabular}{@{} p{25mm} p{27mm} p{20mm} p{25mm} p{21mm} r @{}}
\toprule
Taxa da reação ($R_j$) & Taxa específica da reação ($k_j$) & Fator pré"-exponencial ($A_j$)\footnotemark[1] & Energia de ativação ($E_j$)\footnotemark[1] (\si{\kilojoule\per\mole}) & Calor de reação ($\Delta H_j$) (\si{\kilojoule\per\kilogram}) & \\
\midrule
$R_m = k_mT^{-1/2}\rho_m$ & $k_m = A_m\exp \! \bigl(-\frac{E_m}{RT_s}\bigr)$ & \SI{1,0e4}{\per\second} & 57 & \num{22269,7} & \stepcounter{equation}\thetag{\theequation}\\
\bottomrule
\addlinespace
\multicolumn{6}{l}{\footnotemark[1]{Estimado}}
\end{tabular}
\end{table}

\end{document}
rrodolfo
Posts: 5
Joined: Mon Mar 02, 2009 4:05 pm

Enumerated equations in tables

Post by rrodolfo »

Perfect! Really thanks phi... Now I have many other Tables in this sense to fix... :)
WinXP(SP2) + MiKTeX 2.7 + TexMaker 1.8
argreen
Posts: 2
Joined: Tue Nov 02, 2010 8:14 pm

Enumerated equations in tables

Post by argreen »

I had some trouble referencing equations from the table. So after some messing around I figured it out:

Code: Select all

\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage{booktabs,hyperref}
\hypersetup{colorlinks=true}
\usepackage{float,caption,hypcap}

%set up a command to insert a table equation number
\providecommand{\numberTblEq}[1]{\refstepcounter{tblEqCounter}\label{#1}\thetag{\thetblEqCounter}}
\begin{document}
\newcounter{tblEqCounter} %create a counter

\begin{equation} 	a=b+c \end{equation}

\setcounter{tblEqCounter}{\theequation} %at the start of the table, set the counter to equation numbering
\begin{table}[h]
\caption{Basic Table}
\label{tab:reacevap}
\centering
\scriptsize
\begin{tabular}{llc}
\toprule
EqnA ($R_j$) & EqnB ($k_j$) & \\
\midrule
$R_m = k_mT^{-1/2}\rho_m$ & $k_m = A_m\exp \! \bigl(-\frac{E_m}{RT_s}\bigr)$ & \numberTblEq{eq1}\\ %set the equation number 
$R_m = k_mT^{-1/2}\rho_m$ & $k_m = A_m\exp \! \bigl(-\frac{E_m}{RT_s}\bigr)$ & \numberTblEq{eq2}\\
$R_m = k_mT^{-1/2}\rho_m$ & $k_m = A_m\exp \! \bigl(-\frac{E_m}{RT_s}\bigr)$ & \numberTblEq{eq3}\\ 
$R_m = k_mT^{-1/2}\rho_m$ & $k_m = A_m\exp \! \bigl(-\frac{E_m}{RT_s}\bigr)$ & \numberTblEq{}\\ %labels are optional
\bottomrule
\end{tabular}
\end{table}
\setcounter{equation}{\thetblEqCounter} %at the end of the table, set the equation numbering to the counter

Yet another equation:
\begin{equation} 	d=b+c \end{equation}

This is a ref to the first three table eqns: \eqref{eq1}, \eqref{eq2}, \eqref{eq3}. And a ref to the whole Table \ref{tab:reacevap}.
\end{document}
argreen
Posts: 2
Joined: Tue Nov 02, 2010 8:14 pm

Re: Enumerated equations in tables

Post by argreen »

But this does not work for chapter equation numbering (eg 4.5).
Post Reply