Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
ghostanime2001
Posts: 402 Joined: Fri May 20, 2011 9:41 am
Post
by ghostanime2001 » Wed Sep 21, 2011 2:28 am
How can I set the plus signs and right arrow on the last line align between the masses (46 g + 36 g --> 80 g + 2 g) AND align vertically with the plus and right arrow on the first line? This is the closest to what I can get please see the latex code... And yes this is my minimal example believe me.. I've got a huge table with many more equations.
Code: Select all
\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\usepackage{chemmacros}
\begin{document}
$\begin{tabular}[t]{@{}lllllllll}
\ce{$\underset{\begin{tabular}{@{}c@{}}2 molecules \\ 2 mols \\ 2(23) \\ 46g\end{tabular}}{\ce{2Na_{(s)}}}$}&+&\ce{$\underset{\begin{tabular}{@{}c@{}}2 molecules \\ 2 mols \\ 2(18) \\ 36g\end{tabular}}{\ce{2H2O_{(l)}}}$}&\ce{->}&\ce{$\underset{\begin{tabular}{@{}c@{}}2 molecules \\ 2 mols \\ 2(40) \\ 80g\end{tabular}}{\ce{2NaOH_{(aq)}}}$}&+&\ce{$\underset{\begin{tabular}{@{}c@{}}1 molecule \\ 1 mol \\ 2 \\ 2g\end{tabular}}{\ce{H2\gas{}}}$} \\
&+&&\ce{->}&&+&
\end{tabular}$
\end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.
justdeath
Posts: 69 Joined: Mon Sep 05, 2011 10:27 am
Post
by justdeath » Thu Sep 22, 2011 6:42 pm
You write tabular a little strangely. Here is my tabular:
Code: Select all
\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\usepackage{chemmacros}
\begin{document}
\begin{tabular}{*{7}{c}}
\ce{2 Na_{(s)}} & + & \ce{2H2O_{(l)}} & $\longrightarrow$ & \ce{2NaOH_{(aq)}} & + & \ce{H2\gas{}} \\
2 molecules & & 2 molecules & & 2 molecules & & 1 molecule \\
2 mols & & 2 mols & & 2 mols & & 1 mol \\
2(18) & & 2(22) & & 2(40) & & 2 \\
46g & + & 36g & $\longrightarrow$ & 80g & + & 2g
\end{tabular}
\end{document}
Nikolay
Last edited by
justdeath on Thu Sep 22, 2011 11:22 pm, edited 1 time in total.
ghostanime2001
Posts: 402 Joined: Fri May 20, 2011 9:41 am
Post
by ghostanime2001 » Thu Sep 22, 2011 9:30 pm
I'd like to keep the \underset and tabular environment in my code. I am looking for minor tweak if there is one which will allow me to do what you did.
justdeath
Posts: 69 Joined: Mon Sep 05, 2011 10:27 am
Post
by justdeath » Thu Sep 22, 2011 10:37 pm
This is the closest I can get:
Code: Select all
\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\usepackage{chemmacros}
\begin{document}
$\begin{tabular}[t]{@{}lllllllll}
\ce{$\underset{\begin{tabular}{@{}c@{}}2 molecules \\ 2 mols \\ 2(23) \\ 46g\end{tabular}}{\ce{2Na_{(s)}}}$}&
\ce{$\underset{\begin{tabular}{@{}c@{}} \\ \\ \\ + \end{tabular}}+$}&
\ce{$\underset{\begin{tabular}{@{}c@{}}2 molecules \\ 2 mols \\ 2(18) \\ 36g\end{tabular}}{\ce{2H2O_{(l)}}}$}&
\ce{$\underset{\begin{tabular}{@{}c@{}} \\ \\ \\ $\longrightarrow$ \end{tabular}}\longrightarrow$}&
\ce{$\underset{\begin{tabular}{@{}c@{}}2 molecules \\ 2 mols \\ 2(40) \\ 80g\end{tabular}}{\ce{2NaOH_{(aq)}}}$}&
\ce{$\underset{\begin{tabular}{@{}c@{}} \\ \\ \\ + \end{tabular}}+$}&
\ce{$\underset{\begin{tabular}{@{}c@{}}1 molecule \\ 1 mol \\ 2 \\ 2g\end{tabular}}{\ce{H2\gas{}}}$}
\end{tabular}$
\end{document}
And the signs on the last row are aligned vertically, but not horizontally (with the masses).
Nikolay
cgnieder
Site Moderator
Posts: 2000 Joined: Sat Apr 16, 2011 7:27 pm
Post
by cgnieder » Fri Sep 23, 2011 8:10 pm
Hi,
I don't understand, why you want to keep the \underset command and the tabular environment?
Otherwise I would propose you use the possibilities which the chemmacros package offers, seeing that you are using it already.
Code: Select all
\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\usepackage{chemmacros,siunitx}
\begin{document}
\newreaction*+{reactionsat}{alignat}
\begin{reactionsat*}{6}
& 2 Na\solid{} && {} + 2 H2O\liquid{} && -> && 2 NaOH\aq{} && {} + H2\gas{} \\
& 2 molecules && \quad{} 2 molecules && && 2 molecules && \quad{} 1 molecule \\
& \SI{2}{\mole} && \quad \SI{2}{\mole} && && \SI{2}{\mole} && \quad \SI{1}{\mole} \\
& \text{2(23)} && \quad \text{2(18)} && && \text{2(40)} && \quad 2 \\
& \SI{46}{\gram} && {} + \SI{36}{\gram} && -> && \SI{80}{\gram} && {} + \SI{2}{\gram}
\end{reactionsat*}
\end{document}
test.jpg (14.14 KiB) Viewed 8219 times
Regards
ghostanime2001
Posts: 402 Joined: Fri May 20, 2011 9:41 am
Post
by ghostanime2001 » Fri Sep 23, 2011 10:35 pm
They are used because of the spacing between the chemical formulas the first line of text beneath it