4
\$\begingroup\$

Yes, I know, I did an (ab) use of the nodes. Is there a better way to make this image with TeX/LaTeX?

Using MiKTeX with Texmaker

\documentclass{article}
\usepackage[margin=1.5cm,top=1cm,headheight=16pt,headsep=0.1in,heightrounded]{geometry}
\usepackage{chemfig}
\usetikzlibrary{arrows.meta,shapes,positioning,intersections,quotes}
\setchemfig{%
%       %scheme debug=true,
        arrow offset=9pt,
        arrow coeff=0.7,
%       compound sep=5em,
        + sep left=0.6em,
        + sep right=0.6em,
        atom sep=1.25em,
        fixed length=true
}
\begin{document}
\begin{tikzpicture}
        
\node (n-eptane) at (0, 0) {\chemfig{[:30]--[:-30]--[:-30]--[:-30]}};
\draw[-Triangle] (1.75,0)--++(1,0);
\node (n-eptane-cation) at (5.5, 0) {
    \chemfig{[:30]--[:-30]-\charge{90:4pt=$\oplus$}{}-[:-30]--[:-30]}
};
\draw[gray] (3,.5)--++(5,0);
\draw[gray] (3,.75)--++(5,0);
\foreach \i in {3,3.25,3.5,3.75,...,7.75} {
    \draw[gray] (\i,.5)--(\i+0.25,.75);
}
\draw[-Triangle] (8.5,0)--++(1,0);
\node (propane_and_buthane) at (11.25, 0) {
    \chemfig{[:30]--[:-30]} + \chemfig{[:30]--[:-30]-}
};
\draw[gray] (3,-.4)--++(5,0);
\draw[gray] (3,-.65)--++(5,0);
\foreach \i in {3,3.25,3.5,3.75,...,7.75} {
    \draw[gray] (\i,-.65)--(\i+0.25,-.4);
}
        
\node (2-methyl-exane) at (.15, -1.15) {
    \chemfig{[:30]--[:-30]--[:-30](-[:-90])-[:30]}
};
\node (c) at (2, -1.1 + .3) {};
\node (d) at (2, -1.1 - .3) {};
\draw[-Triangle] (c)  to [out=0,in=0,looseness=2] (d);

\draw[gray] (3,-1.5)--++(5,0);
\draw[gray] (3,-1.75)--++(5,0);
\foreach \i in {3,3.25,3.5,3.75,...,7.75} {
    \draw[gray] (\i,-1.75)--(\i+0.25,-1.5);
}
\end{tikzpicture}
\end{document}

enter image description here

\$\endgroup\$

1 Answer 1

5
\$\begingroup\$

I think the hatched lines could be simplified a bit. Instead of drawing two lines and then all the tiny lines in the for-loop, you could draw a double line and fill it with a hatched pattern:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{patterns,patterns.meta}

\begin{document}
\begin{tikzpicture}

\draw[gray,double distance=0.25cm] (3,-1.625)--++(5,0);
\fill[pattern={Lines[angle=45,distance={5pt}]},pattern color=gray] (3,-1.5) rectangle ++(5,-0.25);

\end{tikzpicture}
\end{document}

And instead of manually calculating all your coordinates, you could position them relative to the nodes you names, e.g. you can position the arrow relative to the n-eptane node:

\documentclass{article}

\usepackage{chemfig}
\usetikzlibrary{arrows.meta}
\setchemfig{%
%       %scheme debug=true,
        arrow offset=9pt,
        arrow coeff=0.7,
%       compound sep=5em,
        + sep left=0.6em,
        + sep right=0.6em,
        atom sep=1.25em,
        fixed length=true
}
\begin{document}
\begin{tikzpicture}
        
\node (n-eptane) at (0, 0) {\chemfig{[:30]--[:-30]--[:-30]--[:-30]}};
\draw[-Triangle] (n-eptane) ++(1.8,0)--++(1,0);

\end{tikzpicture}
\end{document}
\$\endgroup\$

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.