如何使用 chemformula 套件將可選換行符插入化學論壇?

如何使用 chemformula 套件將可選換行符插入化學論壇?

當使用\iupac命令時,chemmacros我可以做類似的事情\ch{1,2\-dimethyl|really|long|name},以便 LaTeX 知道它可以分割名稱以及在哪裡。但是,當我有一個很長的公式時,命令\ch{UO2}(來自chemformula子包)在手冊中沒有列出這樣的選項(我已經嘗試過)。有沒有辦法分解我的長化學式(45 個字元)?

微量元素:

\documentclass[letterpaper]{article}
%\usepackage[left = 1.5 in, right = 1.5 in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[language=british]{chemmacros}
    \chemsetup[iupac]{coord-use-hyphen=true} %Puts hypens after bridging and hapto

%misc

%Load last stuff.
\begin{document}
This works See, it breaks at where I tell it to: \iupac{methyl|phenyl|piperidin|yl|acetate}


Here is a chemical formula: \ch{Cu(NCMe)2(pyz)[AuCl2(CN)2]2UO2(NO3)2}

Here is that same chemical formula with a bunch of filler text: \ch{Cu(NCMe)2(pyz)[AuCl2(CN)2]2UO2(NO3)2}

Here is that same chemical formula with a bunch of filler text: \ch{Cu(NCMe)2(pyz)|[AuCl2(CN)2]|2UO2(NO3)2}

Here is that same chemical formula with a bunch of filler text: \ch{Cu(NCMe)2(pyz) [AuCl2(CN)2] 2UO2(NO3)2}

Note a complete lack of this working despite spaces and such. 

The one way I've seen it work is (filler text filler text) \ch{Cu(NCMe)2(pyz)[AuCl2(CN)2] * 2 MeCN}
\end{document}

答案1

不確定這是否是正確的方法,但是,嘿,它有效!

新增允許換行的新屬性。我建議兩種:一種只允許中斷,另一種還添加連字符。隨你挑選。

\documentclass[letterpaper]{article}
%\usepackage[left = 1.5 in, right = 1.5 in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[language=british]{chemmacros}

\chemsetup[iupac]{coord-use-hyphen=true} %Puts hypens after bridging and hapto

\NewChemCompoundProperty{|}{\linebreak[0]}
\NewChemCompoundProperty{?}{\-}

%misc

%Load last stuff.
\begin{document}
This works See, it breaks at where I tell it to: \iupac{methyl|phenyl|piperidin|yl|acetate}


Here is a chemical formula: \ch{Cu(NCMe)2(pyz)[AuCl2(CN)2]2UO2(NO3)2}

Here is that same chemical formula with a bunch of filler text:
\ch{Cu(NCMe)2 | (pyz) | [AuCl2(CN)2]2 | UO2(NO3)2}

Here is that same chemical formula with a bunch of filler text:
\ch{Cu(NCMe)2 ? (pyz) ? [AuCl2(CN)2]2 ? UO2(NO3)2}

\end{document}

在此輸入影像描述

相關內容