# ChemFig: Numbering each step in (defined) scheme environment

Before asking my question I have several related issues concerning chemfig and chemmacros packages.

While defining a new scheme environment (link) for chemfig, I keep having Errors if I have chemacros also loaded.

• Are they incompatible?
• While chemmacros is very fine for equations represented by chemical formulas it cannot draw anything and chemfig is suitable doing that. Is there any way to have both of them at the same time? Can chemfig do what chemmacros does and write chemical formulas too?

I'm really confused!

- How can I number each reaction in an scheme environment using chemfig? Example:

Scheme 1 1) Nitration 2) Reduction

MWE:

  \documentclass[titlepage, 12pt]{article}

%\documentclass[titlepage, 17pt]{extarticle} for larger font sizes
\usepackage{geometry}
\geometry{
a4paper,
total={8.5 in,11 in},
left=1 in,
top=1 in,
right=1 in,
bottom=1 in,
}

\usepackage{setspace}
\doublespacing

\usepackage{graphicx}

\usepackage[version=4]{mhchem}

\usepackage{cite}
\usepackage{fancyhdr}
\pagestyle{fancy}

% For ACS citation Style
\usepackage{achemso}

\usepackage{lipsum}

% use other useful chemistry tools, too, e.g. the handy \ch command:
\usepackage{chemmacros}
\usechemmodule{reactions}

\usepackage{chemfig}
%for Scheme float

\usepackage{float}

\newfloat{scheme}{hbp}{los}
\floatname{scheme}{Scheme}

% customize captions, define floating scheme environment:
\usepackage{caption}

\begin{document}

\begin{reaction}
A + B -> C + D

\end{reaction}

\begin{scheme}
\schemestart
\chemfig{C(-[:0]{}|{\color{red}H})(-[:90]H)(-[:180]H)(-[:270]H)}
\+\chemfig{{}|{\color{blue}Cl_2}}
\arrow{->[$$h\nu$$][]}
\chemfig{C(-[:0]{}|{\color{blue}Cl})(-[:90]H)(-[:180]H)(-[:270]H)}
\+\chemfig{{\color{red}H}(-[:0]{}|{\color{blue}Cl})}
\schemestop

\caption{bla bla}

\label{sch1}
\end{scheme}
\end{document}

• Please -- as usual here -- show us a short compilable code you have tried so far resulting in your issue. – Mensch Dec 14 '18 at 10:47
• Sure, I edited the question. – Ardalan Dec 14 '18 at 15:27


## option 1

\documentclass[titlepage, 12pt]{article}

%\documentclass[titlepage, 17pt]{extarticle} for larger font sizes
\usepackage{geometry}
\geometry{
a4paper,
total={8.5 in,11 in},
left=1 in,
top=1 in,
right=1 in,
bottom=1 in,
}

\usepackage{setspace}
\doublespacing
\usepackage{graphicx}

\usepackage{chemmacros}
\usechemmodule{scheme}
\usepackage[version=4]{mhchem}
\usepackage{chemfig}

\usepackage{caption}

%\usepackage{float}

%\newfloat{scheme}{hbp}{los}
%\floatname{scheme}{Scheme}
%\newcommand*\listofschemes{\listof{scheme}{List of schemes}}

\begin{document}
\section*{Abstract}

\section{Introduction}

$$\ch{ A + B -> C + D }$$

\begin{scheme}
\schemestart
\chemfig{C(-[:0]{}|{\color{red}H})(-[:90]H)(-[:180]H)(-[:270]H)}
\+\chemfig{{}|{\color{blue}Cl_2}}
\arrow{->[$$h\nu$$][]}
\chemfig{C(-[:0]{}|{\color{blue}Cl})(-[:90]H)(-[:180]H)(-[:270]H)}
\+\chemfig{{\color{red}H}(-[:0]{}|{\color{blue}Cl})}
\schemestop

\caption{bla bla}

\label{sch1}
\end{scheme}
\end{document}


## option 2 (with reactions)

\documentclass[titlepage, 12pt]{article}

%\documentclass[titlepage, 17pt]{extarticle} for larger font sizes
\usepackage{geometry}
\geometry{
a4paper,
total={8.5 in,11 in},
left=1 in,
top=1 in,
right=1 in,
bottom=1 in,
}

\usepackage{chemmacros}
\usechemmodule{reactions}  % <--------- load the module
\usepackage{setspace}
\doublespacing
\usepackage{graphicx}

\usepackage[version=4]{mhchem}
\usepackage{chemfig}

\usepackage{caption}

\usepackage{float}

\newfloat{scheme}{hbp}{los}
\floatname{scheme}{Scheme}
\newcommand*\mylistofschemes{\listof{scheme}{List of schemes}} % <---- change the name here

\begin{document}
\mylistofschemes
\listofreactions  % <--------- list of reactions
\section*{Abstract}

\section{Introduction}

\begin{reaction}  % <--------- reaction environment
A + B -> C + D
\end{reaction}

\begin{scheme}
\schemestart
\chemfig{C(-[:0]{}|{\color{red}H})(-[:90]H)(-[:180]H)(-[:270]H)}
\+\chemfig{{}|{\color{blue}Cl_2}}
\arrow{->[$$h\nu$$][]}
\chemfig{C(-[:0]{}|{\color{blue}Cl})(-[:90]H)(-[:180]H)(-[:270]H)}
\+\chemfig{{\color{red}H}(-[:0]{}|{\color{blue}Cl})}
\schemestop

\caption{bla bla}

\label{sch1}
\end{scheme}
\end{document}


• Thanks. I cannot get the "scheme environment" to work if I don't have that command there. My problem now is that I cannot have "scheme environment" forr chemfig and have a "reaction environment" for chemmacros at the same time. ;-( – Ardalan Dec 14 '18 at 17:45
• you can't get the environment to work if you don't have which command? your code example doesn't have a reaction environment.. can you update your code to properly reflect what you want? – Troy Dec 14 '18 at 17:47
• Sorry. I went over your answer and Option 2 works perfectly fine now. one last question. " equation environment" will give a "list of equations" how can I have a reaction environment? – Ardalan Dec 14 '18 at 17:55
• isn't the reaction environment already predefined by the chemmacros package? just \begin{reaction}...\end{reaction}? you'll need to load the reactions module in the preamble as well. – Troy Dec 14 '18 at 17:58
• if you mean you want a "list of reactions", you can use \listofreactions` also defined by the chemmacros package. – Troy Dec 14 '18 at 18:04