3

I know I should probably separate the questions into multiple stems but I don't want to spam. I am attempting to recreate this diagram but there are a few parts I am unsure of:

enter image description here

Here is my code for some of the diagram (I have decided to not include all the nodes and diagrams because that would clutter the code) but here it is and the diagram it renders:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=0.00cm, right=0.00cm]{geometry}
\usepackage{tikz}
\usepackage{chemfig}
\usepackage{mhchem}
\usetikzlibrary{calc,fadings,decorations.markings}
\begin{document}
    \begin{tikzpicture}
        \setchemfig{atom sep=2em}
        % ---------------- LABELS ----------------
        \node[align=center] (alkyne) at (0,0) {Alkyne\\{{\footnotesize \chemfig{-C~C-}}}};
        \node[align=center] (haloalkene) at (2,3) {Haloalkene};
        \node[align=left] at (3.65,3) {{\footnotesize \chemfig{C(-[:-120])(-[:120]R)=C(-[:60]X)-[:-60]}}};
        \node[align=center] (haloalkane) at (0,6) {Haloalkane};
        \node[align=left] at (1.8,6) {{\footnotesize \chemfig{-C(-[:90]R1)(-[:-90]R2)-C(-[:90]X)(-[:-90]R3)-}}};
        \node (alkane) at (-1,3) {Alkane};
        \node at (0.2,2.7) {\footnotesize\chemfig{-C(-[:90]H)(-[:-90]H)-C(-[:90]H)(-[:-90]H)-}};
        \node (tertiaryalcohol) at (0,8) {3$^\circ$ Alcohol};
        \node (alkene) at (-3.2,3) {Alkene};
        \node (ketone) at (-4,0.4) {Ketone};
        \node (alcohol) at (-6,3) {Alcohol};
        \node (glucose) at (-6,6) {Glucose};
        \node (ester) at (-6,-1) {Ester};
        \node (carboxylicacid) at (-9,1) {Carboxylic Acid};
        % BOXES FOR PRIMARY (1 DEGREE) AND SECONDARY (2 DEGREE) ALCOHOL
        \draw[-latex] (alcohol) -- (ketone);
        \draw[fill=white] (-6.5,2.3) rectangle (-6,2.8) (-6,2.3) rectangle (-5.5,2.8);
        \node at (-6.25,2.55) {1$^\circ$};
        \node at (-5.75,2.55) {2$^\circ$};
        % ---------------- ARROWS ----------------
        \draw[-latex] (alkyne) -- node[above,midway] {\ce{HX},\ce{X2}} node[below,midway] {halogenation} (haloalkene); % HOW DO I ROTATE THE LABELS ABOVE AND BELOW THE ARROWS HERE
        \draw[-latex] (haloalkene) -- (haloalkane);
        \draw[-latex] (alkyne) -- (alkane);
        \draw[-latex] (alkane) -- (haloalkane);
        \draw[-latex] (alkene) -- (alkane);
        \draw[-latex] (alkyne) -- (ketone);
        \draw[-latex] (alcohol) -- (haloalkane); % HOW DO I DRAW THE REVERSE ARROW HERE
        \draw[-latex] (haloalkane) -- (tertiaryalcohol);
        \draw[-latex] (alkene) -- (haloalkane);
        \draw[-latex] (alcohol) -- (alkene); % HOW DO I DRAW THE REVERSE ARROW HERE
        \draw[-latex] (glucose) -- (alcohol);
        \draw (alcohol) -- (ester); % HOW DO I ADD THE CURLY BRACKETS AT THE ALCOHOL AND HOW DO I ADD THE EQUILIBRIUM REACTION ARROW AT THE KETONE END 
        \draw (carboxylicacid) .. controls +(0:3) and +(90:2) .. (ester);
        % ---------------- ADDITIONAL DECORATIONS ----------------
        \draw[-latex] (glucose) .. controls +(-90:1) and +(180:1) .. (-5,5) node[right] {\ce{CO2}};
    \end{tikzpicture}
\end{document}

enter image description here

The first problem is with the nodes on the arrow, I am unsure of how to rotate them so that they are at the same angle as the arrow. For example see the nodes on the arrow between alkyne to haloalkene on my diagram and the original.

The second problem is say the arrows between the alcohol and haloalkane should be a set of two arrows one that goes forwards and the other backwards. I am unsure of how to do this without specifying exact coordinates as this would be tedious.

The third problem is that I am unusre of how to add the curly brackets at the alcohol underneath the boxes for the first and second degree.

The fourth and final problem is the double headed end arrow (equilibrium reaction arrow) at the ester.

Note that I have labelled the relavant points in the code for your help. Thank you

Edit

Also is it possible with along with the rotation of the nodes above and below the arrow, that if the arrow was say a bezier cruve (..controls +(point 1) and +(point 2) ..) that the node text could follow the curve of the arrow?

5

To rotate the labels, use sloped. The brace can be drawn with the brace decoration. In order to have the two parallel arrows, I added a style of this name. (I also added a shapes.multipart node for your convenience.) As for the arrow to Ester, I'd propose the in and out syntax instead of the controls, but it may not make too much sense to define a style for the parallel arrow. As for the special arrows there, they are so-called harpoons and can be found e.g. on pp. 193 of the pgfmanual. I took the Latex variant but you may like other variants better.

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=0.00cm, right=0.00cm]{geometry}
\usepackage{tikz}
\usepackage{chemfig}
\usepackage{mhchem}
\usetikzlibrary{calc,fadings,decorations.markings}
\usetikzlibrary{decorations.pathreplacing,calc,positioning,shapes.multipart,arrows.meta}
\tikzset{two parallel arrows/.style={decorate,decoration={show path construction,
      lineto code={
       \draw [-latex] ($(\tikzinputsegmentfirst)!#1!90:(\tikzinputsegmentlast)$) 
        -- ($(\tikzinputsegmentlast)!#1!-90:(\tikzinputsegmentfirst)$); 
       \draw [latex-] ($(\tikzinputsegmentfirst)!#1!-90:(\tikzinputsegmentlast)$) 
        -- ($(\tikzinputsegmentlast)!#1!90:(\tikzinputsegmentfirst)$); 
      }}},two parallel arrows/.default=2pt}
\begin{document}
    \begin{tikzpicture}
        \setchemfig{atom sep=2em}
        % ---------------- LABELS ----------------
        \node[align=center] (alkyne) at (0,0) {Alkyne\\{{\footnotesize \chemfig{-C~C-}}}};
        \node[align=center] (haloalkene) at (2,3) {Haloalkene};
        \node[align=left] at (3.65,3) {{\footnotesize \chemfig{C(-[:-120])(-[:120]R)=C(-[:60]X)-[:-60]}}};
        \node[align=center] (haloalkane) at (0,6) {Haloalkane};
        \node[align=left] at (1.8,6) {{\footnotesize \chemfig{-C(-[:90]R1)(-[:-90]R2)-C(-[:90]X)(-[:-90]R3)-}}};
        \node (alkane) at (-1,3) {Alkane};
        \node at (0.2,2.7) {\footnotesize\chemfig{-C(-[:90]H)(-[:-90]H)-C(-[:90]H)(-[:-90]H)-}};
        \node (tertiaryalcohol) at (0,8) {3$^\circ$ Alcohol};
        \node (alkene) at (-3.2,3) {Alkene};
        \node (ketone) at (-4,0.4) {Ketone};
        \node (alcohol) at (-6,3) {Alcohol};
        \node (glucose) at (-6,6) {Glucose};
        \node (ester) at (-6,-1) {Ester};
        \node (carboxylicacid) at (-9,1) {Carboxylic Acid};
        % BOXES FOR PRIMARY (1 DEGREE) AND SECONDARY (2 DEGREE) ALCOHOL
        \draw[-latex] (alcohol.south east) -- (ketone);
        \node[rectangle split,rectangle split horizontal, rectangle split parts=2, draw, anchor=center,
        below=0pt of alcohol] (degrees) {1$^\circ$ \nodepart{two} 2$^\circ$};
        \draw[decorate,decoration=brace] (degrees.south east) -- 
        (degrees.south west) coordinate[midway,below=2pt] (brace);
        % ---------------- ARROWS ----------------
        \draw[-latex] (alkyne) -- node[above,midway,sloped] {\ce{HX},\ce{X2}}
        node[below,midway,sloped] {halogenation} (haloalkene); % HOW DO I ROTATE THE LABELS ABOVE AND BELOW THE ARROWS HERE
        \draw[-latex] (haloalkene) -- (haloalkane);
        \draw[-latex] (alkyne) -- (alkane);
        \draw[-latex] (alkane) -- (haloalkane);
        \draw[-latex] (alkene) -- (alkane);
        \draw[-latex] (alkyne) -- (ketone);
        \draw[two parallel arrows] (alcohol) -- (haloalkane.south west); % HOW DO I DRAW THE REVERSE ARROW HERE
        \draw[-latex] (haloalkane) -- (tertiaryalcohol);
        \draw[-latex] (alkene) -- (haloalkane);
        \draw[two parallel arrows] (alcohol) -- (alkene); % HOW DO I DRAW THE REVERSE ARROW HERE
        \draw[-latex] (glucose) -- (alcohol);
        \draw (brace) -- (ester); % HOW DO I ADD THE CURLY BRACKETS AT THE ALCOHOL AND HOW DO I ADD THE EQUILIBRIUM REACTION ARROW AT THE KETONE END 
        \draw[-{Latex[harpoon]}] (carboxylicacid) to[out=0,in=90,looseness=1.6] (ester);
        \draw[-{Latex[harpoon]}] ([xshift=-4pt]ester.north) -- ++ (0,1);
        % ---------------- ADDITIONAL DECORATIONS ----------------
        \draw[-latex] (glucose) to[out=-90,in=180,looseness=1.6] (-5,5) node[right] {\ce{CO2}};
    \end{tikzpicture}
\end{document}

enter image description here

  • ok thank you I will look at the brace decoration. I assume for the special arrowhead at the ester it just needs to be manually drawn? – sab hoque Jun 20 at 15:08
  • @sabhoque Sorry, I missed that part. I would use in and out instead of controls and draw the parallel arrow by hand, it is as simple as \draw[-latex] ([xshift=4pt]ester.north) -- ++ (0,1.5); so writing a style may be an overkill. – user121799 Jun 20 at 15:24
  • sorry to be a bother, but the arrowhead for the ester bit is supposed be as in the original diagram with like half an arrowhead kind of like the left right harpoon command. But don't worry about it I've drawn it manually – sab hoque Jun 20 at 15:24
  • 1
    @sabhoque These arrow heads are in arrows.meta, and I added a proposal. – user121799 Jun 20 at 15:31
  • oh wow, ok thank you! – sab hoque Jun 20 at 15:34

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.