3

I am trying to include a chemical reaction from the chemfig package into this picture of a cloud using the following code:

\documentclass{amsart}
\usepackage{chemfig}
\usepackage{tikz}
\usetikzlibrary{shapes}

\begin{tikzpicture} 
\node [cloud, draw,cloud puffs=10,cloud puff arc=120, aspect=2, inner ysep=2em] { 
\schemestart
A + B \arrow C
\schemestop
};
\end{tikzpicture}

I keep getting an error saying "Dimension too large". I have tried increasing the size of the cloud, using \tiny to reduce the size of the reaction, and nothing works, I keep getting the same error. Any help is appreciated.

1 Answers1

2

Welcome to TeX.SE! Your code (snippet) nests tikzpictures (because chemfig uses TikZ), which should be avoided. If you put the reaction in a savebox, there is no issue.

\documentclass{article}
\usepackage{chemfig}
\usepackage{tikz}
\usetikzlibrary{shapes}
\newsavebox\ReactionBox
\sbox\ReactionBox{\schemestart
    A + B \arrow C
\schemestop
}
\begin{document}
\begin{tikzpicture} 
    \node [cloud, draw,cloud puffs=10,cloud puff arc=120, aspect=2, inner ysep=2em] 
    {\usebox\ReactionBox};
\end{tikzpicture}
\end{document}

enter image description here

  • How to go about putting another reaction underneath that one? I have tried making a ReactionBoxTwo and using \usebox\ReactionBox\vspace\usebox\ReactionBoxTwo but it gives me an error. – John Miller Oct 19 '18 at 20:12
  • @JohnMiller You could add align=center to the node options and then have \usebox\ReactionBox\\ \usebox\ReactionBoxTwo inside the curly brackets of the node. An arguably cleaner way is to put both reactions in one savebox, and use this in the node. –  Oct 19 '18 at 20:22
  • 1
    I put both reactions into a box and included the align=center option but still do not get the correct result. I will go ahead and make a separate question. – John Miller Oct 19 '18 at 20:38