1

I need to build some sort of table with a series of equations from different papers, and I am having an hard time with formatting the table

I got something like this: enter image description here

I wanted to know if there was any way to have the equal after the G get closer to the left side of the last equation in the Model column, and also if there was any way to set the overall width of my table to equal the width of my text.

Can somebody help me? Thanks in advance

\begin{tabular}{|c|c|c|}
        \hline
        Author  &Reactions  &Model\\
        \hline
        Voltz et al & \begin{tabular}{c}
                                                    \ce{CO + 0.5 O2 -> CO2} \\
                                                    \ce{C3H6 + 4.5 O2 -> 3 CO2 + 3 H2O} 
                                                \end{tabular}   
                                                &\begin{tabular}{c}
                                                    $r_1 =  \frac{k_1 \cdot C_{\ce{CO2}} \cdot C_{\ce{O2}}}{G} $    \\
                                                    $r_2 =  \frac{k_2 \cdot C_{\ce{C3H6}} \cdot C_{\ce{O2}}}{G}$ \\
                                                    {\small$\begin{array}{rl} \renewcommand*{\tabcolsep{0pt}}
                                                    G = &\left(1 + k_{a1} \cdot C_{\ce{CO2}} + k_{a2} \cdot C_{\ce{C3H6}} \right) \\
                                                    &\cdot \left(1 + k_{a3} \cdot C_{\ce{CO2}} \cdot C_{\ce{C3H6}} \right) \cdot \left(1 + k_{a4} \cdot C_{\ce{NO}} \right) 
                                                    \end{array}$}
                                                \end{tabular}   \\
1

With help of mathtools you can easy obtain: enter image description here

\documentclass[10pt]{article}
\usepackage{mathtools}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tabular}
    \setlength\PreviewBorder{1em}

    \begin{document}
\begin{tabular}{|c|c|c|}
    \hline
Author  &   Reactions   &    Model\\
    \hline
Voltz et al 
        &   $\begin{gathered}
XXXXXX\\%    \ce{CO + 0.5 O2 -> CO2} \\
YYYYYY\\%    \ce{C3H6 + 4.5 O2 -> 3 CO2 + 3 H2O}
            \end{gathered}$
                        &   $\begin{gathered}
        r_1 =  \frac{k_1 \cdot C_{WWW} \cdot C_{WWW}}{G}   \\
        r_2 =  \frac{k_2 \cdot C_{WWW} \cdot C_{WWW}}{G}  \\
        G = \left(1 + k_{a1}\cdot C_{WW} + k_{a2}
                            \cdot C_{WW} \right)\cdot        \\
            \left(1 + k_{a3}\cdot C_{WW} \cdot C_{WW}\right)\
                            \cdot \left(1 + k_{a4} \cdot C_{WWW} \right)
                             \end{gathered}$                        \\
    \hline
\end{tabular}
    \end{document}

Since I'm not familiar with any chem related package, I replace \ce{....} function with letters W.

Edit: Nicer result and simpler code is possible to obtain with mdwtab package:

\documentclass[10pt]{article}
\usepackage{mathtools,mdwtab}

\usepackage[version=3]{mhchem}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tabular}
    \setlength\PreviewBorder{1em}

    \begin{document}
\begin{tabular}{|c|Mc|Mc|}
    \hlx{hv}
Author  &   \text{Reactions}    &   \text{Model}                    \\
    \hlx{vhv}
Voltz et al 
        &   \begin{gathered}
\ce{CO + 0.5 O2 -> CO2} \\
\ce{C3H6 + 4.5 O2 -> 3 CO2 + 3 H2O}
            \end{gathered}
                        &   \begin{gathered}
        r_1 =  \frac{k_1{\cdot}C_{\ce{CO2}}{\cdot}C_{\ce{O2}}}{G}   \\
        r_2 =  \frac{k_2{\cdot}C_{\ce{C3H6}}{\cdot}C_{\ce{O2}}}{G}  \\
        G = \begin{multlined}[t]
            \left(1 + k_{a1}{\cdot}C_{\ce{CO2}} + k_{a2}
                            {\cdot}C_{\ce{C3H6}} \right){\cdot}     \\[-2ex]
            \left(1 + k_{a3}{\cdot}C_{\ce{CO2}}{\cdot}C_{\ce{C3H6}}\right)
                            {\cdot}\left(1 + k_{a4}{\cdot}C_{\ce{NO}}\right)
            \end{multlined}
                             \end{gathered}                 \\
    \hlx{vh}
\end{tabular}
    \end{document}

enter image description here

Edit (2): Meanwhile I succeed to convince my MikTeX installation to upgrade chem packages, so I'm now able to correct equations -- replace the WWW with correct chem formulas. I also improve last equation in third column. This change I do only in second possibilities, but they are applicable in the firs too.

  • Thanks a lot this worked just fine =). Can I just ask if I have a multicolumn inside my table how can I do to have the same height has the one from tabular enviroment? Because after and \hlx{vh} I get a bit of white space if after I have a multicolumn. – theArtfulDodger Jun 25 '15 at 8:52
  • I suspect that I correctly understand you. Options v in \hlx{h}` add some vertical space between horizontal line and cells content. You can put more v in option, if you like to have more vertical space. Regarding \multicolumn cells: It should behaving the same as in tabular with tiny differences: vertical lines doesn't end at horizontal lines above and below of multi column cell, but intrude a while in it (for amount determined with v. This is features of \hlx lines. Of course, you can use ordinary \hline instead \hlx, but then the control on vertical spaces in rows is lost. – Zarko Jun 25 '15 at 9:47
  • Ok my usual problem is that I do not know hwo to compensate the height intruded with hlx{hv} with the multicolumn. For example for something like this: \hlx{hv} \multicolumn{1}{|c|}{\ce{CO}} & 2.72 I get a bit of white space between my horizontal line and my line from multicolumn – theArtfulDodger Jun 25 '15 at 10:47
  • Hm, why you need \multicolumn{1}{|c|}{\ce{...}} ? what special is in this cell that you need it? I guessing that you can simpli write content in cell without use multicolumn spanned only one cell. – Zarko Jun 25 '15 at 11:32
1

You can have a multiline equation. I propose two variants, using mathtools, cellspace, sansmath and, for one of them, booktabs:

\documentclass{article}
\usepackage{geometry} 
\usepackage{mathtools}
\usepackage{amssymb, sansmath}
\usepackage{array, cellspace, booktabs}
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}
\usepackage[version=3]{mhchem}

\begin{document}
\sffamily\sansmath\noindent
\begin{tabular}{|c|c|Sc|}%>{\arraybackslash}p{8cm}
  \hline
  Author &Reactions &Model\\
  \hline
  Voltz et al. &$ \begin{aligned}%{c}
  \ce{CO + 0.5 O2 & -> CO2} \\[0.5ex]
  \ce{C3H6 + 4.5 O2 & -> 3 CO2 + 3 H2O}
  \end{aligned} $
  & $ \begin{alignedat}{2}
  r_1 & = \mathrlap{\frac{k_1 \cdot C_{\ce{CO2}} \cdot C_{\ce{O2}}}{G}}& \\[0.5ex]
  r_2 & = \mathrlap{\frac{k_2 \cdot C_{\ce{C3H6}} \cdot C_{\ce{O2}}}{G}}& \\[0.5ex]
  G & =(1 & & + k_{a1} \cdot C_{\ce{CO2}} + k_{a2} \cdot C_{\ce{C3H6}})\cdot{} \\[-1ex]
    & & & \overset{\phantom{\textstyle+}} \cdot\left(1 + k_{a3} \cdot C_{\ce{CO2}} \cdot C_{\ce{C3H6}} \right) \cdot \left(1 + k_{a4} \cdot C_{\ce{NO}} \right)
  \end{alignedat} $ \\
  \hline
\end{tabular}
\vskip1cm\noindent
\begin{tabular}{ccSc}%>{\arraybackslash}p{8cm}
  \toprule
  Author &Reactions &Model\\
  \cmidrule(lr){1-1}\cmidrule(lr){2-2}\cmidrule(lr){3-3}
  Voltz et al. &$ \begin{aligned}
  \ce{CO + 0.5 O2 & -> CO2} \\[0.5ex]
  \ce{C3H6 + 4.5 O2 & -> 3 CO2 + 3 H2O}
  \end{aligned} $
  & $ \begin{alignedat}{2}
  r_1 & = \mathrlap{\frac{k_1 \cdot C_{\ce{CO2}} \cdot C_{\ce{O2}}}{G}}& \\[0.5ex]
  r_2 & = \mathrlap{\frac{k_2 \cdot C_{\ce{C3H6}} \cdot C_{\ce{O2}}}{G}}& \\[0.5ex]
  G & =(1 & & + k_{a1} \cdot C_{\ce{CO2}} + k_{a2} \cdot C_{\ce{C3H6}})\cdot{} \\[-1ex]
    & & & \overset{\phantom{\textstyle+}} \cdot\left(1 + k_{a3} \cdot C_{\ce{CO2}} \cdot C_{\ce{C3H6}} \right) \cdot \left(1 + k_{a4} \cdot C_{\ce{NO}} \right)
  \end{alignedat} $ \\
  \bottomrule
\end{tabular}

\end{document} 

enter image description here

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.