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}
5
  • 1
    \ch{H\rlap{2}} works. Mar 11, 2017 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, 2017 at 1:58
  • @JohnKormylo An answer?
    – cfr
    Mar 13, 2017 at 22:15
  • @cfr - I wasn't sure if this would be regarded as any less hacky. Mar 13, 2017 at 22:45
  • @JohnKormylo It is a good answer. Write it down!
    – Symbol 1
    Mar 17, 2017 at 19:40

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .