5

I am trying to use XyMTeX for typesetting a variety of chemical reactions and keep getting errors, namely with

  • \ChemEquation
  • \LewisSbond
  • \LewistetrahedralA or B
  • electron shift arrows and
  • Reaction schemes.

I have noticed that it doesn't handle white space well, at all. For example:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xymtexpdf}
\usepackage{xcolor}
\usepackage{graphicx}

\begin{document}
\LewisTetrahedralA{0==C;1==A;2==B;3==X;4==Y}
\end{document

I either get errors in the code or crazy typesetting where things are very strangely aligned. Common errors include

  • You can't use `\prevdepth' in horizontal mode.
  • Missing $ inserted.
  • Missing number, treated as zero.
  • Illegal unit of measure (pt inserted).
  • Extra }, or forgotten $.

1 Answer 1

6

The file lewisstruc.sty uses \smash in the assumption (no longer valid) that \smash doesn't initiate horizontal mode.

Simple fix:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xymtexpdf}
\usepackage{xcolor}
\usepackage{graphicx}

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

\begin{document}

\LewisTetrahedralA{0==C;1==A;2==B;3==X;4==Y}

\end{document}

enter image description here

1
  • 2
    Brilliant - Thanks. That's sorted it. Commented Apr 30, 2023 at 13:20

You must log in to answer this question.

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