2

I know within the chemfig package compounds can be named with the command \chemname. Is there a way to label some compounds under a single label? For example, put a label "Reactants" under the reactants in a reactions scheme.

In the following example:

\documentclass{article}
\usepackage{chemfig,chemmacros}
\begin{document}

\schemestart
\chemfig{R-[:30](=[:90]O)-[:-30]R}
\arrow{0}[,.5]
\chemfig{R'-[:30](=[:90]O)-[:-30]R'}
\arrow{0}[,1.5]
\chemfig{R'-[:30](=[:90]O)-[:-30]R}
\schemestop

\end{document}

I can put a label under the third compound with \chemname, but how can I put a single label under the first two compounds?

2
  • If you're creating a scheme with \schemestart ... \schemestop you can place any label you like anywhere you like as if it where a compound, e.g. using invisible arrows for positioning. Do you have a concrete example?
    – cgnieder
    May 22, 2013 at 10:02
  • Just edited for an example
    – user32004
    May 22, 2013 at 10:34

2 Answers 2

2

If you place the first two compounds in a \subscheme{...} the whole subscheme gets a unique name that you can refer to in an arrow using the \arrow{@<name>--) syntax:

\documentclass{article}
\usepackage{chemfig}
\begin{document}

% uncomment to see the names:
% schemedebug{true}
\schemestart
\subscheme{
  \chemfig{R-[:30](=[:90]O)-[:-30]R}
  \arrow{0}[,.5]
  \chemfig{R'-[:30](=[:90]O)-[:-30]R'}
}
\arrow{0}[,1.5]
\chemfig{R'-[:30](=[:90]O)-[:-30]R}
% use an invisible arrow pointing downwards to place the label text:
\arrow(@c1--){0}[-90,.1]
Below the first two compounds
\schemestop

\end{document}

enter image description here

2
  • Thanks! Nice and clean trick. One question, I assume that the identifier "@c1--" is internal and systematic, rather that being arbitrarily defined by the user? Because it is no defined along with the subscheme.
    – user32004
    May 22, 2013 at 12:12
  • If you uncomment \schemedebug{true} you will see the the compounds are named by chemfig automatically with c1, c2, ... in order of appearance. You can give them names of your own, though, again with the arrow syntax \arrow(<name1>--<name2>) (without @). If you like I'll add an example.
    – cgnieder
    May 22, 2013 at 12:26
3

I know Clemens loves \arrow{0} but his solution sounds complicated to me. Why don't you use \schemestart...\schemestop inside \chemname, which seems more natural?

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\schemestart
\chemname{%
    \schemestart
        \chemfig{R-[:30](=[:90]O)-[:-30]R}
        \arrow{0}[,.5]
        \chemfig{R'-[:30](=[:90]O)-[:-30]R'}
    \schemestop
    }
    {One long name here!}
\arrow(.base east--.base west){0}[,1.5]
\chemfig{R'-[:30](=[:90]O)-[:-30]R}
\schemestop
\end{document}
2
  • Nice solution as well. But I have a little issue, the following command: \arrow(.base east--.base west){0}[,1.5] gets an undefined error since it's outside the scheme block. Which package do I need to use so such commands can be used outside these blocks?
    – user32004
    May 22, 2013 at 15:07
  • 1
    @B3y0nd3r there are two schemes - an outer and an inner scheme
    – cgnieder
    May 22, 2013 at 15:28

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.