![ChemFig 图表调整](https://linux22.com/image/454964/ChemFig%20%E5%9B%BE%E8%A1%A8%E8%B0%83%E6%95%B4.png)
我正在尝试使用 chemfig 绘制甲醇图表,有几个问题需要解决。(1)我该如何制作
答案1
\documentclass[border=3mm]{standalone}
\usepackage{chemfig}
\begin{document}
\setcharge{extra sep=6pt, macro charge=\scriptsize}
\chemfig{
H-
\charge{90=\hspace{12pt}$\delta^+$}{C}
(-[2]H)(-[@{mch}6]H)-
@{o}\charge{90=$\delta^-$}{O}-
@{h}\charge{90=$\delta^+$}{H}
}
\chemmove{
\draw[|->, thick, shorten <=1pt, shorten >=0.5pt] (mch) -- (mch -| o);
\draw[|->, thick, shorten <=0.5pt, shorten >=1pt] (mch -| h) -- (mch -| o);
}
\end{document}
答案2
(1) \charge 命令允许你将任意符号放置在原子周围的任意位置。但也可以通过插入空格将符号移到一侧。
(2)在这里我将角度设置为 90 度,并插入空格,以便所有“增量”都处于同一高度。高度可以调整(例如从 90:3pt 更改为 90:5pt)
(3)要缩短(或增加)箭头的长度,请使用 \draw 中的“缩短”选项
\documentclass[margin={2mm 2mm}]{standalone}
\usepackage{chemfig}
\begin{document}
\schemestart
%
\chemfig{\charge{90:3pt=$\quad\scriptstyle\delta^+$}{C}(-[2]H)(-[4]H)(-[6]H)(-[6,.3,,,,draw=none]@{c})-\charge{90:3pt=$\;\scriptstyle\delta^{-}$}{O}(-[6,.3,,,,draw=none]@{o})-\charge{90:3pt=$\;\scriptstyle\delta^+$}{H}(-[6,.3,,,draw=none]@{h})}
%
\schemestop
\chemmove{
\draw[|->,red,thick,shorten >=1pt] (h)--(o);
\draw[|->, red,thick,shorten <=1pt,shorten >=1pt] (c)--(o);
}
\end{document}