1

Is it possible to write two or more left-aligned reaction conditions above or below the arrow in a non-hacky way? The chemformula manual explicitly mentions the case of having a line break in the text above the arrow but the resulting text is centered. A possible solution is described in the attached reference which is implemented in the mwe below. Chemformula uses tikz to draw the arrows.

mhchem - adding more than two conditions/steps to reaction arrow in chemical equation

\documentclass{standalone}

\usepackage{chemformula}

\begin{document}
    \ch{A ->[{1) Step 1\hspace{28pt} \\ 2) Longer Step 2}] B}
\end{document}

enter image description here

2
  • You can use a \parbox. In order to make the box only as wide as needed, you may want to use \widthof provided by the calc package: \ch{A ->[\parbox{\widthof{2) Longer Step 2}}{{1) Step 1 \\ 2) Longer Step 2}}] B}. Would you consider this less hacky? I think the linked answers are fine. What is your question exactly? Commented Nov 14, 2022 at 14:42
  • Thank you. Yes, I would consider it less hacky, because often there are more than two lines and your solution works without manually adjusting numbers or defining a vertical stack.
    – tosogoso
    Commented Nov 14, 2022 at 15:02

1 Answer 1

2

You can use tabular:

enter image description here

\documentclass{article}

\usepackage{chemformula}

\begin{document}
    \ch{A ->[{\begin{tabular}{l}1) Step 1\\2) Longer Step 2\end{tabular}}] B}
\end{document}
2
  • Thank you. That works nicely without an additional package. A minor comment: only one "l" is needed in the tabular options.
    – tosogoso
    Commented Nov 14, 2022 at 15:04
  • @tosogoso: fixed. Thanks.
    – Sandy G
    Commented Nov 14, 2022 at 15:23

You must log in to answer this question.

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