难以在右下角制作带有 n 的大方括号

难以在右下角制作带有 n 的大方括号

在此处输入图片描述

我已经使用 编写了以下代码\chemfig。但我在制作等式末尾的最终结果时遇到了问题[D]。有人能帮我定义这个和最终输出吗?我从 Chemfig 复制了以下代码,但这会出现错误,我尝试将定义代码放在程序的前言和主体中,但没有任何效果!

我的 MWE 在这里:

\documentclass{article}
\usepackage{mhchem}
\usepackage{chemmacros}
\usepackage{amsmath}
\usepackage{rotating}
\usepackage{chemfig}
\begin{document}
\newcommand\setpolymerdelim[2]{\def\delimleft{#1}\def\delimright{#2}}
\def\makebraces[#1,#2]#3#4#5{%
    \edef\delimhalfdim{\the\dimexpr(#1+#2)/2}%
    \edef\delimvshift{\the\dimexpr(#1#
        2)/2}%
    \chemmove{%
        \node[at=(#4),yshift=(\delimvshift)]
        {$\left\delimleft\vrule height\delimhalfdim depth\delimhalfdim
            width0pt\right.$};%
        \node[at=(#5),yshift=(\delimvshift)]
        {$\left.\vrule height\delimhalfdim depth\delimhalfdim
            width0pt\right\delimright_{\rlap{$\scriptstyle#3$}}$};}}
\setpolymerdelim[]
 \chemfig{*6(----(=[:90]NOH)--)} \schemestart \arrow(start.mid east--.mid west){->[\ce{H^{+}}]} $C$  \arrow(start.mid east--.mid west){->[Polymerisation]}[,1.85]  \schemestop 
\chemfig{\vphantom{CH_2}[@{op,.75}]CH_2CH_2[@{cl,0.25}]}
\makebraces[5pt,5pt]{}{left}{right}

\end{document}

答案1

这应该可以按你想要的方式工作。也许可以调整长度和间距。

\documentclass{article}
\usepackage{chemfig}
\newcommand\setpolymerdelim[2]{
    \def\delimleft{#1}\def\delimright{#2}} \def\makebraces[#1,#2]#3#4#5{%
     \edef\delimhalfdim{\the\dimexpr(#1+#2)/2}% 
     \edef\delimvshift{\the\dimexpr(#1-#2)/2}% 
     \chemmove{% 
        \node[at=(#4),yshift=(\delimvshift)] {$\left\delimleft\vrule height\delimhalfdim depth\delimhalfdim width0pt\right.$};%
        \node[at=(#5),yshift=(\delimvshift)] {$\left.\vrule height\delimhalfdim depth\delimhalfdim width0pt\right\delimright_{\rlap{$\scriptstyle#3$}}$
        };
    }
}
\begin{document}
\schemestart
\chemfig{*6(----(=[:90]NOH)--)}
\arrow(.(-35)--.west){->[H$^+$]}
\chemfig{C}
\arrow{->[Polymerisation]}[,2pt]
\setpolymerdelim[] 
\chemfig{{\ast}-[@{op,0.7}]D-[@{cl,0.4}]-[,0.2,,,draw=none]{\ast}} \makebraces[4pt,10pt]{n}{op}{cl}
\schemestop

\end{document}

相关内容