How to set superscript for expandable parentheses?

This seems to work:

\documentclass{report}
\usepackage{chemfig}

\begin{document}

\schemestart
\chemfig{R-C(=[:60]O)-[:-60]O-H}
\arrow{<=>}
\chemleft[\chemfig{R-C(=[:60]O)-[:-60]O}\chemright{]^{-}}
\+
\chemfig{H^+}
\schemestop

\end{document}

enter image description here

ChemFig provides the \chemleft and \chemright command pair. These allow to set expandable delimiters on either side of a material. The commands must be followed by delimiters, just like in the case of TeX primitive commands \left and \right:

\chemleft<car1><material>\chemright<car2>

where <car1> and <car2> can be “(” et “)” or “[” and “]”, or any other expandable delimiter consistent with the \left et \right commands.

I just tried: miracles happen. ;-)


If you put the corresponding formula inside a \subscheme it will get a node name that you can refer to from another tikzpicture with remember picture,overlay for which chemfig has the shortcut \chemmove. Then you can add anything anywhere:

\documentclass{article}
\usepackage{chemfig}
\begin{document}

% \schemedebug{true} % look up and visualize the nodes and node names

\schemestart
  \chemfig{R-C(=[:60]O)-[:-60]O-H}
  \arrow{<=>}
  \subscheme{\chemleft[\chemfig{R-C(=[:60]O)-[:-60]O}\chemright]}
  \+
  \chemfig{H^+}
\schemestop
\chemmove[red]{
  \node[right] at (c3.north east) {top right} ;
  \node[right] at (c3.south east) {bottom right} ;
  \node[left] at (c3.north west) {top left} ;
  \node[left] at (c3.south west) {bottom left} ;
}

\end{document}

enter image description here