2

I want to use XyMTeX to draw some chemical structrures, but because I am French, I need to add \usepackage[francais]{babel} in order to be able to use accents. My problem is that with this package, my structure look like this:

enter image description here

as suppose of, without the French package.

enter image description here

My codes are:

\documentclass[11pt,letterpaper,draft]{article}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{xymtex}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
\author{Mathieu Mongrain}
\title{Les figures chimiques}

\begin{document}

\sixheterovi[{f\fivefusev[d]{1==N;4==N}{1S==CH$_3$}{b}}e]
  {2==N;4==N}
  {1D==O;3D==O;4S==CH$_3$}

\end{document}

and

\documentclass[11pt,letterpaper,draft]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xymtex}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
\author{Mathieu Mongrain}
\title{Les figures chimiques}

\begin{document}

\sixheterovi[{f\fivefusev[d]{1==N;4==N}{1S==CH$_3$}{b}}e]
  {2==N;4==N}
  {1D==O;3D==O;4S==CH$_3$}

\end{document}

Does anyone has a solution to this problem, considering that I need to keep my French package?

3

Note that I do not fully investigate the problem and this is just a workaround.

Output of the first MWE contains semicolons, which I think are arguments' delimiter, not actual texts. Some property (maybe category code or something?) of ; is the cause of this issue, I guess.

The following code inspired by this mailing list seems to work well.

\documentclass[11pt,letterpaper,draft]{article}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{xymtexpdf}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
\author{Mathieu Mongrain}
\title{Les figures chimiques}
\begin{document}
\begingroup
  \shorthandoff{;}
  \sixheterovi[{f\fivefusev[d]{1==N;4==N}{1S==CH$_3$}{b}}e]
    {2==N;4==N}
    {1D==O;3D==O;4S==CH$_3$}
\endgroup
\end{document}

Output of my code


As an aside, XyMTeX offers three drawing modes listed in “Three Modes of XyMTeX for Drawing Structural Formula” of the package documentation:

  • the xymtex package (\usepackage{xymtex} for the TeX/LaTeX-compatible mode),
  • the xymtexps package (\usepackage{xymtexps} for the PostScript-compatible mode), or
  • the xymtexpdf package (\usepackage{xymtexpdf} for the PDF-compatible mode),

The fact that xymtex is compatible with LaTeX's standard feature means that it is subject to the restrictions of picture environment. Assuming that you are using pdfLaTeX, it is recommendable to use xymtexpdf, which utilizes TikZ/PGF.

All of the three modes load the xcolor package and the tikz package loads the graphicx package, so you don't have to explicitly load xcolor and graphicx when you use PDF-compatible XyMTeX.

2

The problem is that the semicolon is used by XyMTeX as a delimiter, but babel-french makes it into an active character, so defeating the search for it when the arguments to \sixheterovi and the other XyMTeX macros are parsed.

Workaround: enclose each diagram (or group thereof) into a xym environment.

\documentclass[11pt,letterpaper]{article}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}

\usepackage{xymtexpdf}% or xymtexps
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{environ}

\NewEnviron{xym}{%
  \shorthandoff{;:?!}\scantokens\expandafter{\BODY\empty}%
}

\begin{document}

\begin{xym}
\sixheterovi[{f\fivefusev[d]{1==N;4==N}{1S==CH$_3$}{b}}e]
  {2==N;4==N}
  {1D==O;3D==O;4S==CH$_3$}
\end{xym}

\end{document}

The code emits a warning, but it does so also if babel is not loaded, so it shouldn't depend on the semicolon issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.