7

I have several question regarding LaTeX and chemfig.

My first question is :

how to create a list of schemes similar to \listoftables and \listoffigures so I can add my reaction schemes to newly created \listofschemes ?

Next question is :

how to make a caption for a reaction scheme in chemfig so I can call the scheme out and it will be displayed in "list of schemes" from my first question. Here is an example of a reaction scheme:

\documentclass[12pt,doublespacing,letterpaper]{report}
\usepackage{etex}
\usepackage[usenames,dvipsnames]{color}
\usepackage{cite}
\usepackage{fancyref}
\usepackage{lscape} 
\usepackage{morehelp}
\usepackage{setspace}
\usepackage{rotating}
\usepackage[toc,page]{appendix}
\usepackage{easytable}
\usepackage{chemfig}
\usepackage{longtable}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{dcolumn}
\usepackage{bm}
\usepackage{geometry}
\usepackage{multirow}
\usepackage{caption}

\begin{document}

\chapter{}

\schemedebug{false} 
\schemestart[0,2.5,thick] 
\scriptsize\chemfig{*6((!{Rsubst})-=-(-[,0.8]I)=(-[,0.9]N(-[:150,1.3]R\rlap{$^2$})(-[:30,1.3]R\rlap{$^1$}))-=)}\+{1em,1em ,7pt} 
\chemfig{R^4-~}
\arrow{->[\footnotesize\parbox{110pt}{\centering $3$ mol \%,
PdCl$_2${(}PPh{)}$_3$\\[-7pt] $2$ mol \%, CuI, Et$_3$N}][\footnotesize MW,
60$^\circ$C, 20 min\footnotesize]}
\scriptsize\chemfig{*6((!{Rsubst})-=-(-~-R\rlap{$^4$})=(-[,0.9]N(-[:150,1.3]
R\rlap{$^2$})(-[:30,1.3]R\rlap{$^1$}))-=)}
\schemestop 

%This should be a caption
\vspace{0.7cm}
\centerline{Scheme 1.5. Microwave assisted Sonogashira coupling
reaction.}

\end{document}

My third question is :

How to line up the reaction scheme above?

I really appreciate any help!

2
  • A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). May 18, 2013 at 5:22
  • Concerning your first question: it can be done with tocloft, like shown here. Also, are you sure your MWE is really "minimal"? You load a lot of packages, are all of them really neccesary for this short example? May 18, 2013 at 6:35

1 Answer 1

9

I'll answer under the assumption that you're the one who emailed me the other day about Missing bond type in chemical rendering packages? and to whom I suggested the following definition of the submol {Rsubst}:

\tikzset{
  subst/.style={shorten <= 10pt,preaction={draw=white,line width=6pt}}
}
\definesubmol{subst}{-[,-1,,,draw=none]-[::-30,1.5,,,subst]}
\definesubmol{Rsubst}{!{subst}R}
\definesubmol{Xsubst}{!{subst}X}

since a submol {Rsubst} is used in your code but never defined. If that is wrong please correct me.


Your first and second question are actually the same: captions and a list of <thingy> both are properties of floats. The real question therefore is: how to define a new float?

Since you're already using the caption package I suggest to use the newfloat package for defining a {scheme} environment analogous to the {figure} and {table} environments. The package is from the same author and will work together nicely.

\usepackage{newfloat}
\DeclareFloatingEnvironment[
  fileext   = los ,    % name of file extension
  name      = Scheme , % name of float type
  within    = chapter ,% counter within
  placement = htbp     % default placement
]{scheme}

This also defines a \listofschemes which will (after two compilations) give the list of schemes.


A few remarks to your scheme: I don't understand what you mean with “line up” in your third question but I made some adjustments:

  • I used the fourth possibility of stacking stuff in arrow labels from my answer to your question Chemfig new line reaction scheme. This means: no need for the \parbox.
  • I deleted the \rlap{...} constructs as I don't think they're needed. The R^2 substituents can be adjusted with chemfig's | syntax for dividing atoms and the use of the arrival option of bonds, see another answer of mine.
  • I used an invisible arrow (type 0) of length 0 to center the plus with respect to the preceding molecule. There are other ways but I find this way the most convenient one in most cases.
  • I introduced the packages siunitx and chemmacros for typesetting of units and for typesetting of chemical formulae.
  • I shortened the bond length of the molecules in the scheme by setting \setatomsep{1.8em}.

The result of all of the above is this, page one:

the list of schemes

and on page two:

the scheme


Here's the whole code:

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

% make the arrow label nodes center aligned. This will also allow to use \\ in
% the arrow labels and will make the use of \parbox unnecessary
\usepackage{regexpatch}
\makeatletter
% \xpatchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
% the starred variant replaces all occurrences of <search>
\xpatchcmd*\CF@arrow@display@label@i
  {node[}% search
  {node[align=center,}% replace
  {}% success
  {}% failure
\makeatother

% define the substituent submol:
\tikzset{
  subst/.style={shorten <= 10pt,preaction={draw=white,line width=4pt}}
}
\definesubmol{subst}{-[,-1,,,draw=none]-[::-30,1.5,,,subst]}
\definesubmol{Rsubst}{!{subst}R}
\definesubmol{Xsubst}{!{subst}X}

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

% set units in a unified way:
\usepackage{siunitx}
\DeclareSIUnit{\molpercent}{mol\%}

% customize captions, define floating scheme environment:
\usepackage{caption}
\usepackage{newfloat}
\DeclareFloatingEnvironment[
  fileext   = los ,
  name      = Scheme ,
  within    = chapter ,
  placement = htbp
]{scheme}


\begin{document}

\listofschemes

\chapter{Foo Bar}

\begin{scheme}
  \footnotesize\centering
  \setatomsep{1.8em}
  \schemestart[0,2.5,thick] 
    \chemfig{*6(
      -(!{Rsubst})
      =-(-[,0.8]I)
      =(-[,0.9]N(-[:150,1.3,,1]R|^2)(-[:30,1.3]R|^1))
      -=)
    }
    \arrow{0}[,0]\+
    \chemfig{R^4-~}
    \arrow{->%
      [\SI{3}{\molpercent}, \ch{PdCl2(PPh)3}\\ \SI{2}{\molpercent},\ch{CuI}, \ch{Et3N}]%
      [MW, \SI{60}{\degree}, \SI{20}{\minute}]}
    \chemfig{*6(
      -(!{Rsubst})
      =-(-~-R|^4)
      =(-[,0.9]N(-[:150,1.3,,1]R|^2)(-[:30,1.3]R|^1))
      -=)
    }
  \schemestop 
  \caption{Microwave assisted Sonogashira coupling reaction.}
\end{scheme}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .