9
\documentclass{article}
\usepackage{fontspec,lipsum,xltxtra}
\begin{document}
This is test
\end{document}

I get an error like this "Missing \endcsname inserted....\UnicodeEncodingName {}{"007E}".

Addendum

It is also printing a tilde(~) at the top of the text, as seen here:

enter image description here

Relevant files can be found here.

Dellu
  • 847
  • 1
  • 9
  • 21
  • I don't get any errors using xelatex on an up-to-date system. Even with lualatex, the file compiles (though with a warning about not using xltxtra with LuaTeX). The file also does contain a 'line of text': This is test..? Could you give some sense of the nature of your installation? E.g., add \listfiles to the preamble and post the relevant-seeming portions of the .log? – jon Mar 05 '17 at 05:34
  • It is also printing a tild(~) at the top of the text. Look at the following picture (copies and pasted the above text to make sure i am not making a mistake)https://monosnap.com/file/16Io1NRFIpYgTxyoMg6S9eaTYF51LO.png – Dellu Mar 05 '17 at 05:55
  • I'm afraid more information is needed (for me at least, since I cannot reproduce your error with the file you have provided). – jon Mar 05 '17 at 06:04
  • All the three files, if you would like: https://www.odrive.com/s/e036c60b-d914-4ab6-8acb-6310b8b0114f-58bbacf9 – Dellu Mar 05 '17 at 06:16
  • almost certainly you have previously used fmtutil rather than fmtutil-sys so you are using an old format even after texlive updates the main formats. – David Carlisle Mar 05 '17 at 11:36
  • as you see the error is not absurd. the log is correctly showing that you are using new files with an old format. (after the warning the actual errors are spurious, the warning warns that latex is incorrectly configured, and after that anything can go wrong) – David Carlisle Mar 05 '17 at 11:48

1 Answers1

12

Looking in your .log you will find

LaTeX2e <2016/03/31>

and a little later

Package: fontspec 2017/02/12 v2.6 Font selection for XeLaTeX and LuaLaTeX

which gives the warning

*************************************************
* fontspec warning: "tu-clash"
* 
* I have found the tuenc.def encoding definition file but the TU encoding is
* not defined by the LaTeX2e kernel; attempting to correct but you really
* should update to the latest version of LaTeX2e.
*************************************************

As this says, you have an updated fontspec.def (matching the LaTeX 2017/01/01 release), but have an older format. You can see that from the file version line

File: tuenc.def 2017/02/22 v2.0g Standard LaTeX file

I'm not clear how you've updated fontspec but missed the LaTeX kernel update, but it's not surprising that 'bad stuff happens' as the changes made were tricky and do need to match up.

Either update LaTeX (and rebuild your formats) or switch back to the earlier release of fontspec.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
  • I am running the latest versions of both the Latex and the package. Packages are more often updated than the core Latex. So, this is expected. Plus, I updated the package after it started to give me the error. – Dellu Mar 05 '17 at 09:12
  • @Dellu No, the latest version of LaTeX is LaTeX2e <2017/01/01> patch level 3, and the 2017/01/01 release was put out in sync with fontspec (Will Robertson is part of the LaTeX team). – Joseph Wright Mar 05 '17 at 09:22
  • I downloaded the latest version of Texlive (which is 2016: and texlive updates once in a year, according to http://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution)--i don't get what you mentioned. – Dellu Mar 05 '17 at 09:52
  • 1
    @Dellu TeXLive is updated continually, and many/most TeX systems download the updates regularly or on user request. In your case it seems that such an update was interrupted, hence the inconsistency. – gernot Mar 05 '17 at 10:16
  • 1
    @Dellu you probably have a local format somewhere which shadows the new one. This can happen if you once run fmtutil instead of fmtutil-sys. Run kpsewhich --all -engine=xetex xelatex.fmt on a command line to check. – Ulrike Fischer Mar 05 '17 at 10:32
  • http://www.tug.org/mactex/mactex-download.html---the latest update is October 2016. I am removing all of my system and re-installing it. – Dellu Mar 05 '17 at 20:13
  • @Dellu As I've already said, the version of fontspec you have is newer than the LaTeX format you've got installed, and that is where the issue is. I think you've installed BasicTeX from your .log: you should be able to run tlmgr (or the GUI equivalent) to update everything you have installed. – Joseph Wright Mar 05 '17 at 20:46
  • Thank you. I removed the BasicTex: and installed the whole MacTex. It is working now. – Dellu Mar 05 '17 at 21:11
  • @UlrikeFischer I have this issue since this morning. I ran the command you suggested, and it returns /usr/local/texlive/2016basic/texmf-var/web2c/xetex/xelatex.fmt. What do I do with this? Must I rebuild from scratch :( . ? – Tim Mar 19 '17 at 14:41
  • 4
    @Tim try sudo fmtutil-sys --all see the comments here http://tex.stackexchange.com/questions/358996/fontspec-warning-tu-clash. Or deinstall basictex and install a full mactex, for some reason only basictex users seems to have this problem. – Ulrike Fischer Mar 19 '17 at 14:46
  • sudo fmtutil-sys --all seems to fix everything for me – Tim Mar 19 '17 at 14:52