Как вставить необязательный перенос строки в химическую формулу с помощью пакета 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}

введите описание изображения здесь

Связанный контент