# Undefined control sequence pdftex_strcmp fontspec

I am trying to use latex on a CentOs machine. I have it working on my windows machine. I installed texlive-*. I am using fontspec and ultimately copied it from my windows machine into /usr/share/texmf/tex/xelatex/fontspec.

Then I ran into an issue of it saying that I was missing expl3 package. So I copied the entire l3kernel folder over from my windows machine into /usr/share/texmf/tex/latex/l3kernel

The issue I am running into in this file /usr/share/texmf/tex/latex/l3kernel/expl3-code.tex  is this:

! Undefined control sequence.
\__str_if_eq_x:nn #1#2->\pdftex_strcmp:D
{#1}{#2}
l.221   }

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.


I am executing: xelatex test.tex. and test.tex is failing on this line:

\usepackage{fontspec}


I have searched around for over an hour and am still lost as to what is happening. The closest thing that I read is that maybe by running xelatex I'm not running the pdftex packages as per this answer.

UPDATE I jsut saw that i have texlive 2007. I think the pdftex package wasn't included at that time? I am looking how to update texlive to at least 2011.

• I cannot reproduce your error. Possibly your fontspec and l3kernel are inconsistent. You will be able to fix the problem by updating packages. – Akira Kakuto Oct 28 '15 at 23:42
• I am using the same 2 packages on windows without issue, but being unfamiliar with latex in general, especially on linux, you could be right. Sorry for the ignorance, but how do I update the packages? I installed using yum if that is relevant. – alanmanderson Oct 28 '15 at 23:43
• Transplanting files of the most recent distributions into older ones is usually a lost battle. Particularly if the TeX distribution is TeX Live 2007. You should upgrade to TL 2015, if you want good results with expl3 (required by fontspec). Installing the “vanilla” TeX Live from TUG is not difficult. – egreg Oct 29 '15 at 0:02
• Never modify /usr/share` etc. unless you are absolutely certain you know what you are doing. System directories are managed by your distro's package manager. When you manually alter them, the files on disk no longer match your package manager's database. This will cause problems. You need to undo the changes you made to the system directories. Note that this has nothing to do with LaTeX: it is a point about administering a GNU/Linux box and perfectly general. – cfr Oct 29 '15 at 0:20
• pdfTeX was certainly included in 2007. – cfr Oct 29 '15 at 0:22

As stated by egreg you should drop your distro package and replace it with a standalone texlive installation.

You will be able afterwards to update your packages whenever you want, and won't have to wait the packager to do it. You'll be able to use the great tlmgr program to search packages – very often not bundled by linux distro texlive packages. You'll choose what to install: only the packages you need, all, or chosen sets of packages. If you don't have admin rights, you may do a local install on your \$HOME.

This is indeed a much better way to get TeX that your distro packager obviously decided in 2007 that he was loosing his time making a package for CentOS and dropped this.

Installation is described here Don't forget to uninstall your texlive 2007 packages with yum, or you can get into conflicts.

• I installed 2015 and now everything is working great. All packages that I was manually installing were already part of texlive 2015 so that removed a lot of headache, and it will be VERY nice to have a package manager in tlmgr. – alanmanderson Oct 29 '15 at 15:22

For people struggling with font spec package and if you get continuous errors on "undefined control sequence" errors this is what I found out to solve it!

In my case, I discovered after hours that the problem was not Lyx or definitions in the preamble. The origin of the problem is MiKTeX. Sometimes you need to update the packages you are trying to use, to do that:

1. Go to MiKTeX update
2. Update source -> I want to get packages from... Use the nearest package repository -> next
3. Select fontspec package or packages that you find are causing errors -: next
4. Packages will be updated -> Open lyx and enjoy life again after this shitty errors ;)