Math & Science ⇒ Multiline Underset
-
- Posts: 402
- Joined: Fri May 20, 2011 9:41 am
Multiline Underset
How can I mimick the substack command in mathematical formula except this time for chemical formula?
Last edited by ghostanime2001 on Fri Aug 26, 2011 7:55 am, edited 1 time in total.
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
Re: writing stuff underneath a chemical formula
I guess you can use \substack for chemical formulas as well, depending on how they are written.
Stefan
Stefan
LaTeX.org admin
-
- Posts: 402
- Joined: Fri May 20, 2011 9:41 am
Re: writing stuff underneath a chemical formula
I tried using substack except the things I wanted underneath the chemical formula were set as subscripts instead 

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: writing stuff underneath a chemical formula
How should we help you if you don't tell what you are doing? If you don't show a code example? If I write chemical equations with standard or amsmath tools, of course I can use \substack. You did not tell that you use a chemistry package such as mhchem, possibly.
Stefan
Stefan
LaTeX.org admin
-
- Posts: 402
- Joined: Fri May 20, 2011 9:41 am
Re: writing stuff underneath a chemical formula
Yes I am using mhchem to write my formula then using amsmath (\substack command) with chemical formula typset using mhchem
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: writing stuff underneath a chemical formula
Well, it's still theoretic. If you would have posted an example formula, I would have worked on it. I am not using mhchem myself and I will not work out an example myself just because it saves you time not to copy your example here in. Perhaps somebody else does. I'm off for today, as it's late.
Stefan
Stefan
LaTeX.org admin
-
- Posts: 402
- Joined: Fri May 20, 2011 9:41 am
Multiline Underset
I'm sort of close. Except I need to put more lines below "4.5 g". Here is my code:
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\begin{document}
\ce{2Al + $\underset{\text{4.5 g}}{\ce{Zn(OH)2}}$ -> Al2(SO4)3 + 3H2}
\end{document}
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Multiline Underset
You could use array, tabular, \substack, subarray, \parbox and more.
Here's a tabular example:
If it should be math, omit \text and use array, subarray or \substack.
Stefan
Here's a tabular example:
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\begin{document}
\ce{2Al + $\underset{\text{\begin{tabular}{c}4.5 g\\[-1ex]more\end{tabular}}}{\ce{Zn(OH)2}}$ -> Al2(SO4)3 + 3H2}
\end{document}
Stefan
LaTeX.org admin
-
- Posts: 402
- Joined: Fri May 20, 2011 9:41 am
Multiline Underset
Is this what you mean by using 'array' ?
Also, is this what you mean by 'subarray' ?
Is this what you mean by 'substack' ?
Is this what you mean by using '\parbox' ?
I am showing you all of these because I do not want to get my code wrong and knowing that I have done something wrong but in fact there was some other way that you recommended. So that's why I am showing you.
Also, what are the 'more' in your previous post? I am hoping they are something I am indeed looking for rather than these. I want to make my selection based on everything I test.
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\begin{document}
\ce{2Al + $\underset{\begin{array}{c}4.5 g\\98.1 g/mol\\more\\more\end{array}}{\ce{Zn(OH)2}}$ -> Al2(SO4)3 + 3H2}
\end{document}
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\begin{document}
\ce{2Al + $\underset{\begin{subarray}{c}4.5 g\\98.1 g/mol\\Top shelf\\more\end{subarray}}{\ce{Zn(OH)2}}$ -> Al2(SO4)3 + 3H2}
\end{document}
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\begin{document}
\ce{2Al + $\underset{\substack{\begin{subarray}{c}4.5 g\\98.1 g/mol\\Top shelf\\more\end{subarray}}}{\ce{Zn(OH)2}}$ -> Al2(SO4)3 + 3H2}
\end{document}
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\begin{document}
\ce{2Al + $\underset{\parbox[c]{3cm}{4.5 g\\98.1 g/mol$^-$}}{\ce{Zn(OH)2}}$ -> Al2(SO4)3 + 3H2}
\end{document}
Also, what are the 'more' in your previous post? I am hoping they are something I am indeed looking for rather than these. I want to make my selection based on everything I test.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Multiline Underset
It it similar to what I meant. Those examples work, however it's important to know when to use math mode and when text mode. We can see that text is incorrectly used in math mode when it's italic and spacing is strange.
I mentioned those possibilities in order to say that there are usually many ways, of which we could choose the best.
Stefan
I mentioned those possibilities in order to say that there are usually many ways, of which we could choose the best.
- A simple `\parbox` would be a good choice for (possibly justified) muliline text.
- A minipage would work similar (that's for example meant by 'more' ealier).
- tabular would be good if you need alignment (centered, right or left) and if the content should be in text mode.
- array would also be good for aligned multiline content, which is mainly maths.
- \substack is a handy tool exactly for multiline subscripts which are centered to each other.
- The subarray environment is like \substack but is an environment and allows left alignment.
it wasn't possible to recommend one, so I just could list some for you to check out.I need to put more lines below "4.5 g"
Stefan
LaTeX.org admin