2

I have created this picture using TikZ. However, as you can see, the node labels don't perfectly align horizontally, because the nodes are different heights (due to the exponents and indices I assume). Is there any way to fix this? While I'm here: feel free to critisise and improve my code in any way, I'm quite new to Latex and TikZ so any chance to learn ...

enter image description here

\documentclass{scrbook}
\usepackage{tikz-cd}
\usepackage{chemformula}

\begin{document}
\begin{figure}

\centering

\begin{tikzpicture}[y={(0,-1cm)}]
\def\s{3} % separation between nodes

\node[label=below:{\small Singulett-Sauerstoff}] (A) at (0,0) {\Large \ch{^{1}O_2}};
\node[label=below:{\small (Triplett-)Sauerstoff}] (B) at (0,\s) {\Large \ch{^{3}O_2}};
\node[label=below:{\small Superoxid}] (C) at (\s,\s) {\Large \ch{O_2^{-.}}};
\node[label=below:{\small Peroxynitrit}] (D) at (\s,0) {\Large \ch{ONOO-}};
\node[label=below:{\small Wasserstoffperoxid}] (E) at (2*\s,\s) {\Large \ch{H2O2}};
\node[label={[align=center,below]\\\\ \small Hydroxylradikal\\\small+ Hydroxidion}] (F) at (2*\s,2*\s) {\Large \ch{^{.}OH + ^{-}OH}};
\node (G) at (3*\s,2*\s) {\Large \ch{2 H2O}};

\draw [-Latex, thick, shorten >= 6mm, shorten <= 2mm] (B) -- (A);
\draw [-Latex, thick,shorten >= 6mm, shorten <= 2mm] (C) -- (D);
\draw [-Latex, thick,shorten >= 2mm, shorten <= 2mm] (B) -- (C) node[midway, above]{\ch{+ e^{-}}};
\draw [-Latex, thick,shorten >= 2mm, shorten <= 2mm] (C) -- (E);
\draw [-Latex, thick,shorten >= 2mm, shorten <= 6mm] (E) -- (F);
\draw [-Latex, thick,shorten >= 2mm, shorten <= 2mm] (F) -- (G);

\end{tikzpicture}
\end{figure}
\end{document}
1
  • Oh yeah, the label on node (F) is terrible, I know. I just didn't know how to use "align=center" (so I could add a line break in the label) and "below" together.
    – Lilo
    Apr 27 at 13:59
3

chemfig only

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\schemestart
\chemname{\chemfig{^3O_2}}{\small (Triplett-)Sauerstoff}
\arrow[90]
\chemname{\chemfig{^1O_2}}{\small Singulett-Sauerstoff}
\arrow(@c1.mid east--.mid west){->[ + \chemfig{e^{-}}]}[,1.5]
\chemname{\chemfig{\charge{14:6pt=\.}{O}_2^{-}}}{\small Superoxid}
\arrow[90]
\chemname{\chemfig{ONOO^{-}}}{\small Peroxynitrit}
\arrow(@c3.mid east--.mid west){->}[,1.3]
\chemname{\chemfig{H_2O_2}}{\small Wasserstoffperoxid}
\arrow[-90]
\chemname{\subscheme{\chemfig{^{\phantom{-}}\charge{150=\.}{O}H} \+ \chemfig{^{-}OH}}}{\small Hydroxylradikal \\\small+ Hydroxidion}
\arrow(@c6.mid east--.mid west)
2 \chemfig{H_2O}
\schemestop
\end{document}

enter image description here

without \chemname for better alignment

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\schemestart
\chemfig{^3O_2^{\vphantom{-}}}
\arrow{->[ + \chemfig{e^{-}}]}[,1.5]
\chemfig{^{\vphantom{3}}\charge{14:6pt=\.}{O}_2^{-}}
\arrow{->}[,1.3]
\chemfig{H_2O_2^{\vphantom{-}}}
\arrow(@c1--){0}[-90,0.1]
\mbox{\small\strut (Triplett-)Sauerstoff}
\arrow(@c2--){0}[-90,0.1]
\mbox{\small\strut Superoxid}
\arrow(@c3--){0}[-90,0.1]
\mbox{\small\strut Wasserstoffperoxid}
\arrow[-90,,,,shorten <=-4pt]
\subscheme{\chemfig{^{\phantom{-}}\charge{150=\.}{O}H_{\vphantom{2}}} \+{,,1pt} \chemfig{^{-}OH_{\vphantom{2}}}}
\arrow
\subscheme{2 \chemfig{H_2O^{\phantom{-}}}}
\arrow(@c7--){0}[-90,0.1]
\begin{tabular}{c}
\small Hydroxylradikal \\[-1pt]
\small + \\[-2pt]
\small Hydroxidion
\end{tabular}
\arrow(@c1--){}[90,,,,shorten >=-3pt]
\mbox{\small\strut Singulett-Sauerstoff}
\arrow{0}[90,0.1]
\chemfig{^1O_2}
\arrow(@c2--){}[90,,,,shorten >=-3pt]
\mbox{\small\strut Peroxynitrit}
\arrow{0}[90,0.1]
\chemfig{_{\vphantom{2}}ONOO^{-}}
\schemestop
\end{document}

enter image description here

1
  • This is perfect actually! I was wondering if chemfig would be better for this but it was too daunting for me. Now I can also include -U> arrows easily, which I couldn't figure out how to do in tikz. Thank you so much!
    – Lilo
    Apr 28 at 9:22
3

I did some small changes to your code.

enter image description here

\documentclass[varwidth=\maxdimen]{standalone}
\usepackage{tikz}
\usepackage{chemformula}
\usepackage{makecell}

\begin{document}
    \begin{figure}
        
        \centering
        
        \begin{tikzpicture}[y={(0,-1cm)}]
            
            \tikzset{%
                every node/.style={font=\strut},
            }
            
            \def\s{3} % separation between nodes
            
            \node (A) at (0,0) {\Large \ch{^{1}O_2}}; 
            \node[below=5pt] at (A) {\small Singulett-Sauerstoff};
            \node (B) at (0,\s) {\Large \ch{^{3}O_2}};
            \node[below=5pt] at (B) {\small (Triplett-)Sauerstoff};
            \node (C) at (\s,\s) {\Large \ch{O_2^{-.}}};
            \node[below=5pt] at (C) {\small Superoxid};
            \node (D) at (\s,0) {\Large \ch{ONOO-}};
            \node[below=5pt] at (D) {\small Peroxynitrit};
            \node (E) at (2*\s,\s) {\Large \ch{H2O2}};
            \node[below=5pt] at (E) {\small Wasserstoffperoxid};
            \node (F) at (2*\s,2*\s) {\Large \ch{^{.}OH + ^{-}OH}};
            \node[below=5pt] at (F) {\small \makecell[c]{Hydroxylradikal \\ + \\ Hydroxidion}};
            \node (G) at (3*\s,2*\s) {\Large \ch{2 H2O}};
            
            \draw [-Latex, thick, shorten >= 6mm, shorten <= 2mm] (B) -- (A);
            \draw [-Latex, thick,shorten >= 6mm, shorten <= 2mm] (C) -- (D);
            \draw [-Latex, thick,shorten >= 2mm, shorten <= 2mm] (B) -- (C) node[midway, above]{\ch{+ e^{-}}};
            \draw [-Latex, thick,shorten >= 2mm, shorten <= 2mm] (C) -- (E);
            \draw [-Latex, thick,shorten >= 2mm, shorten <= 6mm] (E) -- (F);
            \draw [-Latex, thick,shorten >= 2mm, shorten <= 2mm] (F) -- (G);
            
        \end{tikzpicture}
    \end{figure}
\end{document}

The font=\strut makes the nodes equal size and \makecell can be used for a better label.

2

With tikz-cd, makecell and amsmath packages (beside chemformula):

\documentclass[border=3.141592]{standalone}
\usepackage{tikz-cd}
\usetikzlibrary{arrows.meta}
\usepackage{makecell}
\usepackage{amsmath}
\usepackage{chemformula}

\begin{document}
    \begin{tikzcd}[sep=large, 
every arrow/.append style = {-{Straight Barb[scale=0.8]}, semithick},
 /tikz/font = \Large\linespread{0.76}\selectfont
                ]
\makecell[t]{\ch{^{1}O_2}\\ \text{\small Singulett-Sauerstoff}}
    &   \makecell[t]{\ch{ONOO-}\\   \text{\small Peroxynitrit}}  
        &   &   \\
\makecell[t]{\ch{^{3}O_2}\\ \text{\small (Triplett-) Sauerstoff}}
\ar[u]\ar[r,"+e^{-}"]
    &   \makecell[t]{\ch{O_2^{-.}}\\   \text{\small Superoxid}}
        \ar[u]  \ar[r]
        &   \makecell[t]{\ch{H2O2}\\   \text{\small Wasserstoffperoxid}}
            \ar[d]
            &   \\
     &   &  \makecell[t]{\ch{^{.}OH + ^{-}OH}\\
                          \text{\small Hydroxylradikal} + \\
                          \text{\small Hydroxidion}} 
            \ar[r]   
            &   2\ch{H2O}
   \end{tikzcd}
\end{document}

enter image description here

2

While it is possible to specify the style options for a label, I prefer to make them separate nodes. Also, the base anchor aligns the baselines rather than the centers.

\documentclass{standalone}
\usepackage{tikz-cd}
\usepackage{chemformula}

\begin{document}

\begin{tikzpicture}[y={(0,-1cm)}]
\def\s{3} % separation between nodes

\node (A) at (0,0) {\Large \ch{^{1}O_2}};
\node[below, inner sep=0pt] (AL) at (A.south) {\small Singulett-Sauerstoff};% first row align point
\node (B) at (0,\s) {\Large \ch{^{3}O_2}};
\node[below, inner sep=0pt] (BL) at (B.south) {\small (Triplett-)Sauerstoff};% second row align point
\node (C) at (\s,\s) {\Large \ch{O_2^{-.}}};
\node[anchor=base] at (BL.base -| C) {\small Superoxid};
\node (D) at (\s,0) {\Large \ch{ONOO-}};
\node[anchor=base] at (AL.base -| D) {\small Peroxynitrit};
\node (E) at (2*\s,\s) {\Large \ch{H2O2}};
\node[anchor=base] at (BL.base -| E) {\small Wasserstoffperoxid};
\node (F) at (2*\s,2*\s) {\Large \ch{^{.}OH + ^{-}OH}};
\node[below, inner sep=0pt, align=center] at (F.south) {\small Hydroxylradikal\\\small+ Hydroxidion};
\node (G) at (3*\s,2*\s) {\Large \ch{2 H2O}};

\draw [-Latex, thick, shorten >= 6mm, shorten <= 2mm] (B) -- (A);
\draw [-Latex, thick,shorten >= 6mm, shorten <= 2mm] (C) -- (D);
\draw [-Latex, thick,shorten >= 2mm, shorten <= 2mm] (B) -- (C) node[midway, above]{\ch{+ e^{-}}};
\draw [-Latex, thick,shorten >= 2mm, shorten <= 2mm] (C) -- (E);
\draw [-Latex, thick,shorten >= 2mm, shorten <= 6mm] (E) -- (F);
\draw [-Latex, thick,shorten >= 2mm, shorten <= 2mm] (F) -- (G);

\end{tikzpicture}
\end{document}

demo

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.