2

I have the following arrow and text:

\arrow{->[conjugation/hydroxylation/oxidation]}[0,2]

How do I insert a line break between conjugation/hydroxylation/ and oxidation? I've tried \break, \\ and \newline all followed by a blank, but I'm not getting any changes. Basically, I want conjugation\hydroxylation and oxidation to be stacked one over the other above the arrow.

I've also tried \substack{} from amsmath, but the word oxidation disappears.

Here's an example image (doesn't have to look identical):

enter image description here

3 Answers 3

4

You can use \parbox

\documentclass[border=2mm]{standalone}
\usepackage{chemfig}
\begin{document}
    \schemestart
    \chemfig{**6(--(-COOR)-(-COOR)---)}
    \arrow{->[\parbox{2cm}{conjugation \\ hydroxylation \\ oxidation}][]}[0,2]
    \chemfig{**6(--(-COOR)-(-COOH)---)}
    \arrow{->}
    \chemfig{**6(--(-[:-30](=[:-90]O)-[:30]O-[:-30]R)-(-[:30](=[:90]O)-[:-30]O-[:30](*6(-(-OH)-(-OH)-(-OH)-(-COOH)-O-)))---)}
    \schemestop
\end{document}

enter image description here

You can use \centering too

\arrow{->[\parbox{2cm}{\centering conjugation \\hydroxylation \\ oxidation}][]}[0,2]

enter image description here

2

Since chemfig uses TikZ we should be able to do this with just setting align = center for that node.

Unfortunately, chemfig neither uses PGFKeys nor does it offer a good interface to change all or only one of the arrow's nodes.

It does however has an interface to declare new arrow types. Here, I declare the arrow type ->* with three (user) arguments where the first two are the two nodes along the arrow and the third can be options for the two nodes.

I've also added the style chemfig/every ->* node so that you can declare a common style for all those labels. Sneaking that in via \CF_arrowdisplaylabel works because its second and sixth argument isn't protected when it is forwarded to the pos key.

I'm using the \chemfigs from the other answer to show this off since I don't know \chemfig otherwise.

Of course, this needs to be extended to other arrow types (or the original ones can be overwritten) to have this functionality available for all types.

Code

\documentclass[tikz, border=2mm]{standalone}
\usepackage{chemfig}
\catcode`\_=11
\definearrow4{->*}{%
  \CF_arrowshiftnodes{#4}%
  \draw[style/.expand once=\CF_arrowcurrentstyle]
    (\CF_arrowstartnode)--(\CF_arrowendnode);%
  \CF_arrowdisplaylabel{#1}{0.5,chemfig/every ->* node,#3}+%
     \CF_arrowstartnode{#2}{0.5,chemfig/every ->* node,#3}-\CF_arrowendnode}
\catcode`\_=8
\tikzset{chemfig/every ->* node/.append style={align=center, font=\scriptsize}}
\begin{document}

\schemestart
  \chemfig{**6(--(-COOR)-(-COOR)---)}
  \arrow{->*[conjugation/hydroxylation \\ oxidation]}[0,2]
  \chemfig{**6(--(-COOR)-(-COOH)---)}
\schemestop

\schemestart
  \chemfig{**6(--(-COOR)-(-COOR)---)}
  \arrow{->*[conjugation/\\ hydroxylation \\ oxidation][Both nodes!][
    blue, align=left, draw, rounded corners, inner sep=.15em,
    font=\normalsize\bfseries]}[0,2]
  \chemfig{**6(--(-COOR)-(-COOH)---)}
\schemestop
\end{document}

Output

enter image description here enter image description here

1

Using a tabular frees you from guessing the size.

\documentclass[border=2mm]{standalone}
\usepackage{chemfig}
\begin{document}

\schemestart
  \chemfig{**6(--(-COOR)-(-COOR)---)}
  \arrow{->[\scriptsize\begin{tabular}{@{}c@{}} conjugation/hydroxylation \\ oxidation \end{tabular}][]}[0,2]
  \chemfig{**6(--(-COOR)-(-COOH)---)}
\schemestop

\end{document}

enter image description here

Change \scriptsize to the size command you prefer.

You must log in to answer this question.

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