![在 chemfig 的某些部分添加 underbrace](https://linux22.com/image/410907/%E5%9C%A8%20chemfig%20%E7%9A%84%E6%9F%90%E4%BA%9B%E9%83%A8%E5%88%86%E6%B7%BB%E5%8A%A0%20underbrace.png)
所以我想用下支撑来制作类似的东西。我应该怎么做?另外,充电部分也应该怎么做?谢谢。
\documentclass[tikz,border=3mm]{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,calc,positioning,decorations,decorations.pathreplacing,calligraphy}
\usepackage{chemfig,chemmacros}
\chemsetup{modules=all}
\begin{document}
\definesubmol{x}{-[:+30,.6]-[:-30,.6]}
\def\RED{\gdef\printatom##1{\color{red}\ensuremath{\mathrm{##1}}}}
\chemfig{!x!x!x!x!x!x!x!x(-[,,,,draw=none]\RED)(-[:30,.6,,,,,red](=[:90,.7,,,,,red]O)-[:-30,.8,,,,,,red]ONa)}
\end{document}
答案1
很可能有更优雅的方法,但您可以添加一些锚点并用 绘制括号\chemmove
。不过,我强烈建议不要使用\RED
宏。
\documentclass{article}
\usepackage{chemfig,chemmacros}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\chemsetup{modules=all}
\begin{document}
\definesubmol{x}{-[:+30,.6]-[:-30,.6]}
\chemfig{@{l1}!x!x!x!x!x!x!x!x@{l2}(-[,,,,draw=none])(-[:30,.6,,,,,red](=[:90,.7,,,,,red]{\color{red}O})-[:-30,.8,,,,,,red]{\color{red}ONa})@{l3}}
\chemmove{%
\draw[-,thick,decorate,
decoration={calligraphic brace,amplitude=3pt,raise=1.2ex,mirror}]
(l1|-l3) -- node[below=1.7ex,font=\sffamily\small] {Nonpolar tail} (l2|-l3);
\draw[-,thick,decorate,red,
decoration={calligraphic brace,amplitude=3pt,raise=1.2ex,mirror}]
(l2|-l3) -- node[below=1.7ex,font=\sffamily\small] {Polar head}
([xshift=1em]l3.east); }
\end{document}