General ⇒ Chemical Equations numbered separate from Mathematical ones
Chemical Equations numbered separate from Mathematical ones
Hello,
I am currently writting a document that contains both mathematical and chemical equations.
The problem being they are all numbered sequentially.
My maths ones are in the: \begin{equation} \end{equation} enviroment
and similarly my chemical equations are in the \begin{array} \end{array} enviroment
they come out like this:
m = a.t.h.s (1)
CH + MISTRY <-> EQ + ATION (2)
CH + MISTRY <-> EQ + ATION (3)
m = a.t.h.s (4)
Where as I want them to come out like:
m = a.t.h.s (1)
CH + MISTRY <-> EQ + ATION [1]
CH + MISTRY <-> EQ + ATION [2]
m = a.t.h.s (2)
Any help?
Thanks.
I am currently writting a document that contains both mathematical and chemical equations.
The problem being they are all numbered sequentially.
My maths ones are in the: \begin{equation} \end{equation} enviroment
and similarly my chemical equations are in the \begin{array} \end{array} enviroment
they come out like this:
m = a.t.h.s (1)
CH + MISTRY <-> EQ + ATION (2)
CH + MISTRY <-> EQ + ATION (3)
m = a.t.h.s (4)
Where as I want them to come out like:
m = a.t.h.s (1)
CH + MISTRY <-> EQ + ATION [1]
CH + MISTRY <-> EQ + ATION [2]
m = a.t.h.s (2)
Any help?
Thanks.
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
Chemical Equations numbered separate from Mathematical ones
Hi Eenzc,
you could define a new environment for chemical equations and use a different counter. Here is an example to show you how you could write it:
As you can see after compiling math and chemical equations are numbered independently, chemical equations are tagged using square brackets instead of parantheses.
Stefan
you could define a new environment for chemical equations and use a different counter. Here is an example to show you how you could write it:
Code: Select all
\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\newcounter{chemequation}
\renewcommand*\thechemequation{[\arabic{chemequation}]}
\newenvironment{chemequation}{%
\stepcounter{chemequation}%
\begin{equation}}%
{\tag*{\thechemequation}%
\end{equation}}
\begin{document}
\begin{equation}
e^{\pi i} + 1 = 0
\label{eq:1}
\end{equation}
\begin{chemequation}
\text{CO}_2 + \text{C} \longrightarrow 2\text{CO}
\label{ch:1}
\end{chemequation}
\begin{equation}
ax + by +c = 0
\label{eq:2}
\end{equation}
\begin{chemequation}
\text{H}_2\text{O}
\label{ch:2}
\end{chemequation}
\begin{equation}
y = x^3 + x
\label{eq:3}
\end{equation}
For the second math equation see \eqref{eq:2},
for the first chemical equation see \ref{ch:1}.
\end{document}
Stefan
LaTeX.org admin
Re: Chemical Equations numbered separate from Mathematical ones
Thanks,
Its good and complies, however specifically I've used:
\begin{chemequation}
\begin{align}
\mathrm{SiH_{4} + O_{2}} ~& \mathrm{\rightleftharpoons SiO_{2} + 2H_{2} } \\
\mathrm{SiCl_{2}H_{2} + 2N_{2}O} ~& \mathrm{\rightleftharpoons SiO_{2} + 2N_{2} + 2HCl}
\end{align}
\end{chemequation}
Which doesn't compile the align should provide two equations on top of each other.
I don't really understand what \tag*{} or the \thechemequation do; Also I don't understand why the counter has the same name as the environment and not chemequationcounter or something.
----
edit: I now understand this "sort of" but \tag*{} does not work if I change begin{equation} to begin{align} in the preamble
----
Ultimately I'd like to add a chemical equation contents page:
I assume I can do this by :
\listof{chemequation}{List of Chemical Equations}
Many thanks for your time, effort and speedy help
Its good and complies, however specifically I've used:
\begin{chemequation}
\begin{align}
\mathrm{SiH_{4} + O_{2}} ~& \mathrm{\rightleftharpoons SiO_{2} + 2H_{2} } \\
\mathrm{SiCl_{2}H_{2} + 2N_{2}O} ~& \mathrm{\rightleftharpoons SiO_{2} + 2N_{2} + 2HCl}
\end{align}
\end{chemequation}
Which doesn't compile the align should provide two equations on top of each other.
I don't really understand what \tag*{} or the \thechemequation do; Also I don't understand why the counter has the same name as the environment and not chemequationcounter or something.
----
edit: I now understand this "sort of" but \tag*{} does not work if I change begin{equation} to begin{align} in the preamble
----
Ultimately I'd like to add a chemical equation contents page:
I assume I can do this by :
\listof{chemequation}{List of Chemical Equations}
Many thanks for your time, effort and speedy help
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Chemical Equations numbered separate from Mathematical ones
Hi Eenzc,
you cannot put chemequation around align, but you could define a chemalign environment.
Here's a quick solution just using align:
Regarding your other question we had a similar discussion in the topic List of Equations.
Stefan
you cannot put chemequation around align, but you could define a chemalign environment.
Here's a quick solution just using align:
Code: Select all
\newcommand*\chemtag{%
\stepcounter{chemequation}%
\tag*{\thechemequation}}
...
\begin{align}
\mathrm{SiH_{4} + O_{2}} ~&
\mathrm{\rightleftharpoons SiO_{2} + 2H_{2} } \chemtag\\
\mathrm{SiCl_{2}H_{2} + 2N_{2}O} ~&
\mathrm{\rightleftharpoons SiO_{2} + 2N_{2} + 2HCl} \chemtag
\end{align}
Stefan
LaTeX.org admin
Re: Chemical Equations numbered separate from Mathematical ones
Great stuff, thanks very much.
Chemical Equations numbered separate from Mathematical ones
My problem resurfaces:
I am using the following code to define an enviroment:
I also have defined a new float for the purpose of creating a chemical equation t.o.c.
I implement my equations as follows:
And my t.o.c. as
The trouble being that it still captions my equations in the body text with a number in the caption space under the equation. I don't want anything there!
Please help.
Thanks.
I am using the following code to define an enviroment:
Code: Select all
%%%%% create chemequation environment
\newcounter{chemequation}
\renewcommand*\thechemequation{[\arabic{chemequation}]}
\newenvironment{chemequation}{%
\stepcounter{chemequation}%
\begin{equation}}%
{\tag*{\thechemequation}%
\end{equation}}
%%%%% create chemtag to iterate and ref chemequations in an align environment
\newcommand*\chemtag{%
\stepcounter{chemequation}%
\tag*{\thechemequation}}
%%%%%
Code: Select all
%%%%% to create a chemicalequation float
\usepackage{float}
\newfloat{chemicalequation}{htbp}{cex}[chapter]
\floatname{chemicalequation}{}
%%%%%%
Code: Select all
\begin{chemicalequation} [H]
\begin{align}
\mathrm{SiH_{4} + O_{2}} ~& \mathrm{\rightleftharpoons SiO_{2} + 2H_{2} }\chemtag \\
\mathrm{SiCl_{2}H_{2} + 2N_{2}O} ~& \mathrm{\rightleftharpoons SiO_{2} + 2N_{2} + 2HCl}\chemtag
\end{align}
\caption[The Equation 1]{}
\label{chem:PECVD}
\end{chemicalequation}
Code: Select all
\listof{chemicalequation}{Chemical Equations}
The trouble being that it still captions my equations in the body text with a number in the caption space under the equation. I don't want anything there!
Please help.
Thanks.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Chemical Equations numbered separate from Mathematical ones
Hi,
instead of using \caption you could define a new \chemicalcaption, that steps the counter and writes to the cex file like this:
Stefan
instead of using \caption you could define a new \chemicalcaption, that steps the counter and writes to the cex file like this:
Code: Select all
\newcommand\chemicalcaption[1]{%
\refstepcounter{chemicalequation}
\addcontentsline{cex}{section}%
{\protect\numberline{\thechemicalequation}{\ignorespaces #1}}
}
LaTeX.org admin
-
- Site Moderator
- Posts: 814
- Joined: Tue Jul 01, 2008 2:19 pm
Re: Chemical Equations numbered separate from Mathematical ones
Just to say that the mhchem package would make writing your equations a bit easier, for example:
\documentclass{article}
\usepackage[version=3]{mhchem}
\begin{document}
\ce{H2 + O2 -> H2O}
\end{document}
Joseph Wright
\documentclass{article}
\usepackage[version=3]{mhchem}
\begin{document}
\ce{H2 + O2 -> H2O}
\end{document}
Joseph Wright
Joseph Wright
Re: Chemical Equations numbered separate from Mathematical ones
Thanks again guys, especially Stefan!
It works well and does what I want it to.
It works well and does what I want it to.