TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use TeX Live 2010 and my editor is Texmaker Bidi. It was working probably good but from 2 months ago I've encountered with the error:

! 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>.

when I'm trying to load xepersian LaTeX. but I do not know how can I change pdfLaTeX to XeLaTeX.

This is the second edit of my question . the code is :

 ‎\settextfont{XB Zar}‎
 ‎\setdigitfont{XB Zar}‎
 ‎!‎سلام دنیا‎‎

but the output does not include the shapes .

share|improve this question
See TeXmakers's online manual in: xm1math.net/texmaker/doc.html#SECTION25 – Leo Liu Oct 19 '11 at 12:20
Thanks Leo , the link was really helpful – Negin Oct 19 '11 at 13:27
I would prefer lualatex. I used xelatex in the past (I needed some special fonts and lualatex wasn't stable enough). But now I'm switching to luaLaTeX, and I think lualatex will be the future. – knut Oct 19 '11 at 17:39
Your TeX Live folder path must contain no space character. – user16095 Jun 29 '12 at 11:22
up vote 24 down vote accepted

Added Update to the existing answer:

For those using Texmaker Version's > 3.5.1

From Texmaker Version 3.5.1 onwards xelatex support has been added . Download Latest version of Texmaker: 4.1.1 dated Jan 3 2014 that has xelatex support in standard commands like shown below.

standard commands in texmaker

xelatex has been added to the standard commands (with a new "quick compilation" mode : xelatex + view pdf)

Hence there might be no need of Configuring Texmaker for xelatex with `User Commands.

Note: From Texmaker Version 4.1 onwards LuaLaTeX support also has been added

For those using Texmaker Version's < 3.5

You will have to define a custom command in Texmaker - it's fairly simple.

Open the User → User Commands menu and select Edit User Commands. This will bring up a dialog box like so:

xelatex custom command

Add a menu item name and set the command to xelatex %

Hit okay and you will now be able to run the newly created command from the User → User Commands menu or by hitting alt-shift-Fn where n is the number of the command. So, for instance, alt-shift-F1 will run the command I have defined here. This may be Windows specific. It will also appear on the build menu in the toolbar, underneath everything else.

Hope this helps.

share|improve this answer
Thank you Richard – Negin Oct 19 '11 at 13:26
I tired this but I encountered another problem : the output will be a blank page . I change the users part as u said to :xelatex -interaction=nonstopmode -synctex=-1 %.tex , but it cause me face with a blank output !!!!!!!!! – Negin Oct 19 '11 at 16:22
@Negin - I would need to see your input to be able to tell you why this is happening. Try running xelatex on a minimal document and see if you get the same problem. – Richard Terrett Oct 25 '11 at 9:38
‎@ Richard -I included the code in the new edit of my question . I would really appreciate it if you help me . – Negin Oct 26 '11 at 6:45
@Negin - Try running xelatex on your .tex file in a console, and see what the output looks like. It is likely that your file is producing errors, but that it's being ignored by texmaker, due to the fact that you are using the nonstopmode flag. – Richard Terrett Oct 26 '11 at 11:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.