Package mhchem Gives an Error

This is a bug in mhchem, which doesn't either define the command \pdf@strcmp or load the package pdftexcmds explicitly, where it is defined, but relies on the driver code (graphics.cfg) to load it.

The bug can be seen when using MiKTeX with pdfLaTeX or XeTeX (not LuaLateX). When using TeX Live it can be noticed compiling with XeTeX.

As a workaround, it should suffice to load this package

\usepackage{pdftexcmds}

MWE

\documentclass{article}
\usepackage[version=3]{mhchem}

\usepackage{pdftexcmds}    

\begin{document}
  \ce{X-X}
  \ce{C\bond{~-}C}
\end{document} 

Output

enter image description here

Tags:

Errors

Mhchem