OK. the code I want if on page 11 and not 10. This is the source to my misunderstanding. This part start with explaining how to create a mhchem costume command in the equation environment so I skipped the end of this part. My mistake.
As for your code. I don't understand it completely. Is there a latex commands database to understand it? what does the @ or the $$ stand for?
Thanks.
General ⇒ chemical equation numbering
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
chemical equation numbering
References are mostly to the current version of a manual available on CTAN.yotama9 wrote:OK. the code I want if on page 11 and not 10. This is the source to my misunderstanding. This part start with explaining how to create a mhchem costume command in the equation environment so I skipped the end of this part. My mistake. […]
For the documentation of the LaTeX2e sources you can take a look at source2e (or a web search for source2e.pdf). The »at« sign protects important internal LaTeX commands and registers. It should be used very careful. The double dollar signs are a TeX command and enclose a displayed equation environment (not to be used in LaTeX syntax, see l2tabu).yotama9 wrote:[…] As for your code. I don't understand it completely. Is there a latex commands database to understand it? what does the @ or the $$ stand for? […]
Supplement:
In the meantime I was able to work out a more general solution that works with the standard classes. The relevant part of the code has to be modified as shown below.
Code: Select all
\makeatletter
\@definecounter{reaction}
\def\reaction{$$\refstepcounter{reaction}}
\def\endreaction{\eqno \hbox{\@reacnum}$$\@ignoretrue}
\def\@reacnum{{\normalfont \normalcolor (\thereaction)}}
\@ifundefined{chapter}%
{\renewcommand\thereaction{C\,\@arabic\c@reaction}}
{\@addtoreset{reaction}{chapter}
\renewcommand\thereaction{C\,\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@reaction}}
\makeatother
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
chemical equation numbering
Thanks @localghost! Your method solved my problem