Re: mhchem ed align

#62313
Up
0
Down
::


Questo è quanto ho scritto in un file richiamato dal preambolo

`%Comandi per reazioni
\makeatletter
\newcounter{reaction}
\renewcommand\thereaction{\thechapter.\alph{reaction}}
\@addtoreset{reaction}{chapter}
\newcommand\reactiontag{\refstepcounter{reaction}\tag{\thereaction}}
\newcommand\reaction@[2][]{\begin{equation}\cee{#2}%
\ifx\@empty#1\@empty\else\label{#1}\fi%
\reactiontag\end{equation}}
\newcommand\reaction@nonumber[1]{\begin{equation*}\cee{#1}%
\end{equation*}}
\newcommand\reaction{\@ifstar{\reaction@nonumber}{\reaction@}}
\makeatother

%%Suggerito da egreg
\numberwithin{reaction}{chapter}
\makeatletter
\newcounter{storeequation}
\let\keptc@equation\c@equation
\newenvironment{reactions}{%
\setcounter{storeequation}{\value{equation}}%
\setcounter{equation}{\value{reaction}}%
\let\c@equation\c@reaction
\renewcommand\theequation{\thechapter.\alph{reaction}}%
\start@align\@ne\st@rredfalse\m@ne
}{%
\math@cr \black@\totwidth@
\egroup
\ifingather@
\restorealignstate@
\egroup
\nonumber
\ifnum0=`{\fi\iffalse}\fi
\else
$$%
\fi
\let\c@equation\keptc@equation
\setcounter{equation}{\value{storeequation}}%
\ignorespacesafterend
}
\makeatother`

Quel che avviene è che l’ambiente reactions non tabula le reazioni chimiche secondo le regole di mhchem ma le stampa come semplici equazioni matematiche: credo manchi il comando \cee{} ma non capendo il codice non saprei dove inserirlo. Inoltre, le reazioni chimiche inserite impiegando il comando \reaction{} vengono tabulate come equazioni matematiche, al contrario di quanto avviene con la numerazione relativa all’ambiente reactions che risulta invece corretta.

Go to top