# Use XeLaTeX in Texmaker instead of pdfLaTeX

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 :

 ‎\documentclass{article}‎
‎\usepackage{pstricks}‎
‎\usepackage{‎pst‎-‎bezier}‎
‎‎\usepackage{xepersian}‎
‎\settextfont{XB Zar}‎
‎\setlatintextfont{Junicode}‎
‎\setdigitfont{XB Zar}‎
‎\begin{document}‎
‎!‎سلام دنیا‎‎
‎\begin{pspicture}(‎3‎,3)‎
‎\psbcurve(1,2)(5,7)(2,2)(12,3)‎
‎\end{pspicture}‎
‎
‎\end{document}


but the output does not include the shapes .

-
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

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.

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:

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.

-
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