An XeLaTeX Compilation Error: Undefined control sequence. \pdfglyphtounicode
Today, when I compile a .tex
file (which I created on another computer before) in TeXstudio, some errors like Undefined control sequence. \pdfglyphtounicode
are printed in Log
box:
But on the other hand, corresponding PDF file can be normally generated, and I can preview it as usual. Besides, these errors don’t exist when I compile other .tex
files.
Later, I notice messages in Messages
box:
which shows that complier pdflatex works well but xelatex doesn’t. Probably this is why above case appears.
I remember that previously these two “green” lines always appeared after a successful compilation, and I thought they indicate that everything is OK, so I have never read it carefully. Now I realize that I have been using two compilers to compile .tex
files all along, and Default Compiler
configuration also shows this point:
After I changing Default Compiler
option from txs:///pdflatex | txs:///xelatex
to txs:///pdflatex
, that is cancel xelatex compilation, aforementioned errors disappear. So, I guess these errors are caused by that some characters in this .tex
file are not supported by xelatex (but I’m not certain, because all characters in the file are English letters).
As introduced on 31th page of Prof. Liu’s book, Introduction to LaTeX1, there are different compilation methods, and hence different compilers like pdflatex2, xelatex3, and dvips4, to convert TeX source code to PDF file, and in which xelatex can best support processing Chinese characters:
So, I think for this reason I added xelatex as a default compiler before.
References