Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My code is:

\documentclass[12pt,letterpaper]{report}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage{titlesec}

\setcounter{secnumdepth}{5}

\titleformat{\chapter}[display]
{\filcenter\normalfont\bfseries}
{\MakeUppercase{\chaptertitlename}\ \thechapter}
{0pt}
{}
\titlespacing{\chapter}{0pt}{-24pt}{20pt}
\titleformat{\section}
{\normalfont\normalsize\bfseries}{\thesection}{12pt}{}
\titlespacing{\section}{0pt}{0pt}{0pt}
\titleformat{\subsection}
{\normalfont\normalsize\bfseries}{\thesubsection}{12pt}{}
\titlespacing{\subsection}{0pt}{0pt}{0pt}
\titleformat{\subsubsection}
{\normalfont\normalsize\bfseries}{\thesubsubsection}{12pt}{}
\titlespacing{\subsubsection}{0pt}{0pt}{0pt}

\usepackage{indentfirst}
\usepackage{parskip}
\setlength{\parindent}{.5in}

\usepackage{setspace}
\renewcommand{\baselinestretch}{1.75} 

\usepackage{natbib}
\usepackage{chemfig,chemmacros}

\begin{document}


\begin{center}
\schemestart
\chemfig{C(-[:0]H)(-[:90]H)(-[:180]H)(-[:270]H)}\+\chemfig{Cl_2}
\arrow
\chemfig{C(-[:0]Cl)(-[:90]H)(-[:180]H)(-[:270]H)}\+\chemfig{H(-[:0]Cl)
\schemestop
\end{center}

\end

I wanted to produce this:

enter image description here

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You had a syntax error with a final } bracket missing on the last compound. Apart from that to put a label on an arrow use the general form

\arrow{->[up][down]}

To colour atoms, use {\color{red}H}. However, in a number of situations, such as ends of bonds, you need to write {}|{\color{red}H} instead.

Sample output

\documentclass[12pt,letterpaper]{report}

\usepackage{chemfig,chemmacros}

\begin{document}

\begin{center}
  \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
\end{center}

\end{document}

The named colours come from the xcolor package, so as Manuel points out you could use magenta instead of red and cyan instead of blue.

Note: I originally wrote the material over the arrow as h\chemnu, but as cgneider points out that is most certainly not correct.

share|improve this answer
    
Use magenta and cyan and it's perfect. –  Manuel Sep 1 at 7:30
    
@Manuel Yes, those are closer to the poster's image colours. I'll leave it up to the the poster to adjust that. –  Andrew Swann Sep 1 at 7:32
    
I'm not sure the \chemnu is the right choice here. It's purpose is to provide an upright nu (which it gives when upreek is loaded for example). Here nu is a normal variable (frequency of light) and h is Planck's constant so IMHO it should be $h\nu$ –  cgnieder Sep 1 at 8:13
    
@cgnieder Thanks, I have added such a comment to the answer. The poster does not load upgreek in the given code. –  Andrew Swann Sep 1 at 8:56
    
@AndrewSwann How \chemnu looks is not fixed (see texwelt.de/wissen/fragen/2105#2107 for an example in German). However, only in the default setting when the user loads no package for upright Greek letters it maps to \nu. Details are explained in chemgreek's and chemmacros' manuals –  cgnieder Sep 1 at 9:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.