5

I wish to draw a chemical reaction showing a radical chain reaction. I am using chemfig and chemmacros and beamer. beamer uses sans serif fonts which is good for display and less fussy.

When I write my structure as shown in the manual I end up with my reaction in sans serif but the radical and atom attached to it in serif, Initiation reaction {1} in example below.

I have used a phantom atom to get around this as shown in Propagation reation {2} in example below. The difference is between the Cl. radical on right hand side of {1} and Cl. radical on left hand side of {2}.

Although I have furnished a workaround, my question is:

Is there a way to have the lewis fontshape set to the global font shape? \chemsetup[chemformula]{font-shape=sf} did not change anything!

\documentclass{beamer}
\usepackage{chemfig}
\usepackage{chemmacros}
\begin{document}
\chemsetup[chemformula]{font-shape=sf}
\begin{frame}
\begin{reactions}
 Cl-Cl ->[$\Delta$][$h\nu$] 2 "\Lewis{0.,Cl}"  \label{react:init}\\
R3H + Cl "\Lewis{0.,\vphantom{H}}" -> R3 "\Lewis{0.,\vphantom{H}}" + HCl \label{react:propagation}
\end{reactions}
\end{frame}
\end{document}

radical_reactions

  • Just for sans serif fonts you could also every other document class, you would have to change to \sffamily with an explicit command then. And you should use a proper screenshot tool next time, where you can select an area first. – Speravir Jan 31 '14 at 18:18
  • @Speravir Much appreciated. Will do the screenshot/crop image the next time :) – Leeser Feb 3 '14 at 9:35
6

chemfig's \Lewis uses \printatom (a chemfig macro) internally. You have to redefine it:

\documentclass{beamer}
\usepackage[T1]{fontenc}

\usepackage{chemfig}
\usepackage{chemmacros}
\chemsetup[chemformula]{font-shape=sf}
\renewcommand*\printatom[1]{\ensuremath{\mathsf{#1}}}

\begin{document}

\begin{frame}
\begin{reactions}
  Cl-Cl &->[$\Delta$][$h\nu$] 2 "\Lewis{0.,Cl}"  \label{react:init}\\
  R3H + Cl "\Lewis{0.,\vphantom{H}}"
    &->
  R3 "\Lewis{0.,\vphantom{H}}" + HCl \label{react:propagation}
\end{reactions}
\end{frame}

\end{document}

Alternatively, you can use chemmacros' own \chlewis if you have an up to date version of chemmacros:

\documentclass{beamer}
\usepackage[T1]{fontenc}

\usepackage{chemmacros}
\chemsetup[chemformula]{font-shape=sf}

\begin{document}

\begin{frame}
\begin{reactions}
  Cl-Cl &->[$\Delta$][$h\nu$] 2 "\chlewis{0.}{Cl}"  \label{react:init}\\
  R3H + "\chlewis{0.}{Cl}"
    &->
  R3 "\chlewis{0.}{\vphantom{H}}" + HCl \label{react:propagation}
\end{reactions}
\end{frame}

\end{document}

enter image description here

  • Thanks for your prompt solution. I had actually tried the \chlewis{}{} command but was getting a TeX overflow error. I have just realised I was using the wrong apostrophes ' ' instead of " around it... I also had used the redefiniton of \printatom in previous work, annoyed at myself for not thinking of this. Thanks for your help. – Leeser Jan 31 '14 at 12:40
  • @Leeser if I replace the " with ' in the above example both work fine for me – clemens Jan 31 '14 at 12:47
  • sorry my mistake I used `` and I got TeX capacity overflow... using " or ' works fine for me too. – Leeser Jan 31 '14 at 15:41
  • Thanks for telling me about chlewis – g33kz0r Sep 12 '14 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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