2

The first image below looks a bit better than the one on the right, but I had to use phantoms to align the H and I with the line above them. I also forced some vertical space with \\[0.2em].

Both solutions seem hacky. What should I do instead?

Diagram

\documentclass[tikz]{standalone}

\usepackage{chemformula}

\begin{document}

\begin{tikzpicture}[very thick, scale=0.9]
\draw[|-|]  (0,0) node[below, align=center] {\\[0.2em]\ch{\phantom{2}H2}} node[left] {$E_0$} --  (0,3) node[left] {$E_1$};
\draw[|-|]  (1,0) node[below, align=center] {\\[0.2em]\ch{\phantom{2}I2}} node[right] {$E_0$} --  (1,1.5) node[right] {$E_1$};

\begin{scope}[xshift=3 cm]

\draw[|-|]  (0,0) node[below, align=center] {\\[0.2em]\ch{H2}} node[left] {$E_0$} --  (0,3) node[left] {$E_1$};
\draw[|-|]  (1,0) node[below, align=center] {\\[0.2em]\ch{I2}} node[right] {$E_0$} --  (1,1.5) node[right] {$E_1$};
\end{scope}
\end{tikzpicture}

\end{document}
  • 1
    \ch{H\rlap{2}} works. – John Kormylo Mar 11 '17 at 19:21
  • 2
    Note that it is probably better to say something like below={.5\baselineskip+.2em} rather than using \\[.2em] with centring. The positioning library may be helpful. All this is off-topic as your question is already answered above. – cfr Mar 12 '17 at 1:58
  • @JohnKormylo An answer? – cfr Mar 13 '17 at 22:15
  • @cfr - I wasn't sure if this would be regarded as any less hacky. – John Kormylo Mar 13 '17 at 22:45
  • @JohnKormylo It is a good answer. Write it down! – Symbol 1 Mar 17 '17 at 19:40
3
\documentclass[tikz]{standalone}
\usepackage{chemformula}

\begin{document}
\begin{tikzpicture}[very thick, scale=0.9]
\draw[|-|]  (0,0) node[below=.2em] {\ch{H\rlap{2}}} node[left] {$E_0$} --  (0,3) node[left] {$E_1$};
\draw[|-|]  (1,0) node[below=.2em] {\ch{I\rlap{2}}} node[right] {$E_0$} --  (1,1.5) node[right] {$E_1$};
\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.