2

I would like to use something like tabular within the reactions environment provided by chemmacros. Something like this:

\documentclass[12pt]{article}  
\usepackage{chemmacros}
\usepackage{siunitx}
\newcommand{\li}[1]{\SI{#1}{\liter}}  
\begin{document}  
\begin{center}
\begin{tabular}{cccccccc}
   & \ch{C3H8\gas} & $+$ & \ch{5 O2\gas} & \ch{->} & \ch{3 CO2\gas} & $+$ & \ch{4 H2O\gas}  \\
  Hasiera & V? &   &   &   & --  &   & --     \\
  Bukaera &  --   &   &  --  &  & \li{2}  &  &      \\
\end{tabular} 
\end{center}  
\begin{center}
\begin{tabular}{cccccccc}
   & \ch{C3H8\gas} & $+$ & \ch{5 O2\gas} & \ch{->} & \ch{3 CO2\gas} & $+$ & \ch{4 H2O\gas}  \\
  Hasiera & V? &   & \li{0.5}  &   & --  &   & --     \\
  Bukaera &  --   &   &  --  &  &   &  &      \\
\end{tabular}
\end{center}
\end{document}

enter image description here

Is there any way to do this with chemmacros? Thanks

1 Answers1

2

If I understand you correctly you want the same layout as with the tabular but with chemmacros' reactions* environment? This is not exactly possible since the reactions* environment uses amsmath's align* behind the scenes which means it has the same alignment behaviour.

But it is easy to add a new environment which does what you want. The chemmacros manual says in the part about the reactions environment:

You can create new types of reactions with the command:

\NewChemReaction{<name>}[<number of arguments>]{<math name>}

[…] <math name> is the underlying math environment. […]

What it doesn't say is that the underlying environment doesn't need to be a math display environment. It is very well possible to use a tabular instead:

\documentclass{article}

\usepackage{chemmacros}
\usechemmodule{reactions}
\NewChemReaction{chemtable}[1]{tabular}

\usepackage{siunitx}
\newcommand*{\vol}[1]{\SI{#1}{\liter}}  

\begin{document}  

\begin{chemtable}{cccccccc}
          & C3H8\gas &+ & 5 O2\gas &-> & 3 CO2\gas &+ & 4 H2O\gas \\
  Hasiera & V?       &  &          &   & "--"      &  & "--" \\
  Bukaera & "--"     &  &  "--"    &   & "\vol{2}" &  &
\end{chemtable}

\end{document}

enter image description here

A better output is possible with some small modifications (needs the array package loaded):

\begin{chemtable}{l*7{c@{}}}
          & C3H8\gas &+ & 5 O2\gas &-> & 3 CO2\gas &+ & 4 H2O\gas \\
  Hasiera & V?       &  &          &   & "--"      &  & "--" \\
  Bukaera & "--"     &  &  "--"    &   & "\vol{2}" &  &
\end{chemtable}

enter image description here

cgnieder
  • 66,645