2

I am having increasing success with XyMTeX - but keep running into the same problem with specifying lone pair locations using either \lonepairA or \lonepairB. When ever I add optional locations for less than four lone pairs, the compiler hangs and I have to stop it with errors. Without the optional specification I get four lone pairs that overlap with bonds.

\documentclass[varwidth]{standalone}
\usepackage{xymtexpdf}
\usepackage{xcolor}
\usepackage{graphicx}

\usepackage{unicode-math}
\setmainfont{Source Sans Pro}
%\setmathfont{Latin Modern Math}% default setting
\setmathfont{latinmodern-math.otf}
\setmathfont[range={up,it}]{Source Sans Pro}

% fix the issue with \smash
\def\dotnodimension{\hbox{\smash{\hbox to0pt{\hss.\hss}}}}
%%
\begin{document}

% I only want / need lonepairs at two positions.

%This crashes the compiler 
%           \begin{XyMcompd}(800,500)(-150,50){}{}
%           \Ltrigonal{0==C;1D==\lonepairB[12]{O};2==A;3==B}
%       \end{XyMcompd}
        
        
%This works, but produces lonepairs that are unwanted
        \begin{XyMcompd}(800,500)(-150,50){}{}
            \Ltrigonal{0==C;1D==\lonepairB{O};2==A;3==B}
        \end{XyMcompd}
        
\end{document}

1 Answer 1

4

could you try this code as a possible solution? Insert in your preamble:

\makeatletter

\let\dotnodimensionorig=\dotnodimension 
\def\dotnodimension{\hbox{\dotnodimensionorig}}

\let\phantomoriginal=\phantom
\def\phantom#1{\hbox{\phantomoriginal{#1}}}

\makeatother

I received it directly from the author of XyMTeX some time ago. This code works fine for me with XeLaTeX:

\documentclass[varwidth]{standalone}
\usepackage{xymtexpdf}
\usepackage{xcolor}
\usepackage{graphicx}

\usepackage{unicode-math}
\setmainfont{Source Sans Pro}
%\setmathfont{Latin Modern Math}% default setting
\setmathfont{latinmodern-math.otf}
\setmathfont[range={up,it}]{Source Sans Pro}

% fix the issue with \smash
%\def\dotnodimension{\hbox{\smash{\hbox to0pt{\hss.\hss}}}}
%%

\makeatletter

\let\dotnodimensionorig=\dotnodimension 
\def\dotnodimension{\hbox{\dotnodimensionorig}}

\let\phantomoriginal=\phantom
\def\phantom#1{\hbox{\phantomoriginal{#1}}}

\makeatother

\begin{document}

% I only want / need lonepairs at two positions.

%This crashes the compiler 
           \begin{XyMcompd}(800,500)(-150,50){}{}
           \Ltrigonal{0==C;1D==\lonepairB[12]{O};2==A;3==B}
       \end{XyMcompd}
        
        
%This works, but produces lonepairs that are unwanted
        \begin{XyMcompd}(800,500)(-150,50){}{}
            \Ltrigonal{0==C;1D==\lonepairB{O};2==A;3==B}
        \end{XyMcompd}
        
\end{document}

I hope this help to you.

1
  • That's great - it works. Thanks so much! Commented May 16, 2023 at 13:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .