LaTeX forum ⇒ Generalchemical equation numbering

LaTeX specific issues not fitting into one of the other forums of this category.
yotama9
Posts: 61
Joined: Thu Sep 24, 2009 2:59 pm

Re: chemical equation numbering

Postby yotama9 » Thu Dec 10, 2009 3:18 pm

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.

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sat Dec 12, 2009 12:33 pm

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. […]

References are mostly to the current version of a manual available on CTAN.
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? […]

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).

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.
  1. \makeatletter
  2. \@definecounter{reaction}
  3. \def\reaction{$$\refstepcounter{reaction}}
  4. \def\endreaction{\eqno \hbox{\@reacnum}$$\@ignoretrue}
  5. \def\@reacnum{{\normalfont \normalcolor (\thereaction)}}
  6. \@ifundefined{chapter}%
  7. {\renewcommand\thereaction{C\,\@arabic\c@reaction}}
  8. {\@addtoreset{reaction}{chapter}
  9. \renewcommand\thereaction{C\,\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@reaction}}
  10. \makeatother

At the moment a starred version of the reaction environment is missing.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

rainsong
Posts: 1
Joined: Mon Nov 19, 2018 1:12 am

Postby rainsong » Mon Jan 07, 2019 6:14 pm

Thanks @localghost! Your method solved my problem


Return to “General”

Who is online

Users browsing this forum: No registered users and 7 guests