I encountered an error while trying to compile a xelatex document from texmaker. This is information about my system

Ubuntu Gnome 15.10

Texmaker 4.4.1 (installed form synaptic)

texlive-2015 full installation from dvd iso (not debian package)(installed as root)

$ type xelatex
xelatex is /usr/local/texlive/2015/bin/x86_64-linux/xelatex
$ ls -l /usr/local/texlive/2015/bin/x86_64-linux/
lrwxrwxrwx 1 root root        5 Aug 14  2014 xelatex -> xetex
lrwxrwxrwx 1 root root        5 Aug 14  2014 xelollipop -> xetex
-rwxr-xr-x 1 root root 22473712 May  7  2015 xetex

This is the document which i tried to compile. (smallest document which produces the error)


some text.

Here is what I tried

With the document opened, I first tried quick build and it failed as expected since texmaker was set to quick build with pdflatex. The fontspec package threw an error asking me to use xelatex or lualatex. Now, I manually chose Tools-> Xelatex. This also failed with the same error from fonstpec. the error message is


This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex 2016.1.15) 23 FEB 2016 19:51

entering extended mode

restricted \write18 enabled.




! Fatal fontspec error: "cannot-use-pdftex"


! The fontspec package requires either XeTeX or LuaTeX to function.


! You must change your typesetting engine to, e.g., "xelatex" or "lualatex"

! instead of plain "latex" or "pdflatex".


! See the fontspec documentation for further information.


! For immediate help type H <return>.


l.43 }


| This is a fatal error: LaTeX will abort.


I thought that texmaker was probably not calling xelatex even I chose it from the Tools->XeLatex menu. Now, I opened a terminal and typed

$ xelatex myfile.tex

And it compiled without errors and gave me a pdf.

So, I searched the net/SE and found out a workaround used for old versions of texmaker. (Use XeLaTeX in Texmaker instead of pdfLaTeX). As per the instructions (even though i am using version 4.4.1 of texmaker), I went to User->UserCommands and made a new command as follows

xelatex -synctex=1 -interaction=nonstopmode %.tex

This also invoked pdflatex and compile failed. So, I modified the user command as

notify-send sometext | xelatex -synctex=1 -interaction=nonstopmode %.tex

This caused texmaker to call notify-send(just a program to display a popup on the screen) and then call xelatex and the compile succeeded.

I do not know if the problem is caused by texmaker (since terminal xelatex works), or due to path problems (since I have installed non-debian texlive package and adding a dummy command before xelatex has caused texlive to call xelatex correctly)

I checked out these posts and they do not seem to have the same problem

XeLaTex and TexMaker "cannot-use-pdftex"

Moving from pdfLaTeX to XeTeX - what do I need to know?

Frequently loaded packages: Differences between pdfLaTeX and XeLaTeX

  • 1
    Try deleting any intermediate files, *.aux, *.log, everything except the TeX file. – darthbith Feb 23 '16 at 16:35
  • @darthbith It worked. Now xelatex command in tex maker generates a correct looking pdf; but tex maker pops up a dialog saying log file not found. Then I ran latex once, a *.log file was created (and compile failed as earlier) and further runs of xelatex started giving the same error as in my question. Also tex maker does not use a separate build directory as in the case of pdflatex. Anyway, your suggestion solves the problem in my question. I will accept your answer if you post it as an answer. – AJN Feb 23 '16 at 17:46
  • I guess its a tex maker problem since xeleatex from terminal and xelatex from tex maker (with a dummy command as prefix) work without any errors. – AJN Feb 23 '16 at 17:51

Your Answer

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

Browse other questions tagged or ask your own question.