Texmaker and Xetex on OS X

As I am coming from a Linux world I am quite used to some software that is available for Linux. One of the software I used often was Texmaker. After switching to OS X I used TexShop (as it comes bundled with MacTex) for a couple of years. It is a good LaTex editor and it (besides Latex) also supports Xetex (a TeX typesetting engine that uses Unicode and system fonts) out of the box and it nicely updates PDF documents almost on the fly.

But I recently switched back to Texmaker because of some of its strengths that I really like (most UI related):

  • one window
  • tabs
  • auto completition of commands, references …
  • a lot of icons for math symbols
  • document structure on the left side
  • quick access to almost every LaTeX command from menus and most often used ones from drop down menus
  • a better search box (although I would like it to be incremental like in Emacs :))

But it doesn’t work with Xetex right away. There is a simple solution
to this, though. All it is needed is to change two preferences
(assuming you have MacTex installed).

Go to  texmaker -> Preferences

Under Commands change Latex field to:

  /usr/texbin/xelatex  %.tex

Under Quick Build change User field to:

  /usr/texbin/xelatex %.tex|open %.pdf 

The second command can include several commands divided by | sign. So
for example we could compile the .tex file with xetex first, then
compile the auxiliary .aux file and compile the .tex document twice more
(why this is necessary is beyond this post). User field should now look
like (all in one line):

/usr/texbin/xelatex %.tex|/usr/texbin/bibtex %.aux
      |/usr/texbin/xelatex %.tex|/usr/texbin/xelatex %.tex
          |open %.pdf

Edit: there’s one drawback  —  if there are some errors in the .tex
document, Texmaker hangs up and only forcing it to shut down helps.