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{CH_4}\+\chemfig{Cl_2}
\arrow{->[\footnotesize\chemfig{440\celsius}]}
\chemfig{CH_4}\+\chemfig{CH_3Cl}\+\chemfig{CH_2Cl_2}
\+\chemfig{CHCl_3}\+\chemfig{CCl_4}\
\schemestop
\end{center}
\end{document}

I wanted to produce this:

enter image description here

share|improve this question
    
Your code doesn't compile: ! Undefined control sequence. \celsius ->\ERROR. Please add the missing style files. –  Andrew Sep 1 at 10:54

2 Answers 2

up vote 3 down vote accepted

Since you're already loading the chemmacros package which loads and uses the chemformula package you can use the latter for the reaction.

The key is the !(<below>)(<text>) syntax inside of \ch.

\documentclass[12pt,letterpaper]{report}
\usepackage{chemmacros}
% \usepackage{siunitx} % already loaded by `chemmacros'

\begin{document}

\begin{center}
  \ch{
    CH4 + Cl2
    ->[\SI{440}{\celsius}]
    !(\SI{47}{\percent})( CH4 ) +
    !(\SI{20}{\percent})( CH3Cl ) +
    !(\SI{22}{\percent})( CH2Cl2 ) +
    !(\SI{10}{\percent})( CHCl3 ) +
    !(\SI{1}{\percent})( CCl4 )
  }
\end{center}

\end{document}

enter image description here

If you want the percent values in the same size as the compounds above you can set the format by changing the option name-format. The default setting is \scriptsize\centering

\documentclass[12pt,letterpaper]{report}
\usepackage{chemmacros}
% \usepackage{siunitx} % already loaded by `chemmacros'

\setchemformula{
  name-format= \centering
}

\begin{document}

\begin{center}
  \ch{
    CH4 + Cl2
    ->[\SI{440}{\celsius}]
    !(\SI{47}{\percent})( CH4 ) +
    !(\SI{20}{\percent})( CH3Cl ) +
    !(\SI{22}{\percent})( CH2Cl2 ) +
    !(\SI{10}{\percent})( CHCl3 ) +
    !(\SI{1}{\percent})( CCl4 )
  }
\end{center}

\end{document}

enter image description here

share|improve this answer
    
thank you for providing another option. I was wondering how I can resize those percentage values and there you are answering it without being asked it's as if you've read my mind thank you. Chemmacros is indeed a very flexible and simplified way doing it. thank you for sharing your knowledge. –  Ricardo Veloz Jr Sep 2 at 15:43

You can use \chembelow[<dim>]{<code>}{<stuff>}. I have used siunitx, in addition, to write those percentages.

\documentclass[12pt,letterpaper]{report}
\usepackage{chemfig,chemmacros}
\usepackage{siunitx}


\begin{document}


\begin{center}
\schemestart
\chembelow[1.5ex]{\chemfig{CH_4}}{}
\chemsign{+}
\chemfig{Cl_2}
\arrow{->[\footnotesize\chemfig{\SI{440}{\celsius}}]}
\chembelow[1.5ex]{\chemfig{CH_4}}{\SI{47}{\percent}}
\chemsign{+}
\chembelow[1.5ex]{\chemfig{CH_3Cl}}{\SI{20}{\percent}}
\chemsign{+}
\chembelow[1.5ex]{\chemfig{CH_2Cl_2}}{\SI{22}{\percent}}
\chemsign{+}
\chembelow[1.5ex]{\chemfig{CHCl_3}}{\SI{10}{\percent}}
\chemsign{+}
\chembelow[1.5ex]{\chemfig{CCl_4}}{\SI{1}{\percent}}
\chemsign{+}
\chemfig{HCl}
\schemestop
\end{center}
\end{document}

enter image description here

share|improve this answer
    
Thank you so much you've saved my life again. This is my second question that you answered.. –  Ricardo Veloz Jr Sep 1 at 11:05
    
Out of interest: why do you prefer \chemsign{+} instead of \+? I don't see any arguments for or against it? –  cgnieder Sep 1 at 16:29
    
@cgnieder It is more semantic, readable (when you write big (long) reactions). And chemfig manual consistently uses it. I have a slight doubt that the OP is mixing commands from different packages. Also it gives better spacing. –  Harish Kumar Sep 1 at 22:54
    
@HarishKumar that's because a) \chemsign was there from the beginning and b) \+ was/is defined to be used between \schemestart ... \schemestop (and only defined between them) and has been introduced with v1.0. And since the manual's examples haven't been changed... \chemsign might be more semantic but \+ has in general more options for adjustment and thus is more flexibel. –  cgnieder Sep 1 at 23:02
    
@HarishKumar I use chemfig a lot :) –  cgnieder Sep 1 at 23: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.