# Texmaker / TeXstudio does not compile XeLaTeX with MiKTeX portable

I am trying to migrate from TeXworks to Texmaker (just for the fact that it is better for handling multi-files projects). I am using portable versions of both MiKTeX and Texmaker, so, in Texmaker I went to Options > Configure Texmaker > Commands and point every command available to the current path of MiKTeX. And it works just fine with PDFLaTeX, but at the moment I try to compile some XeLaTeX document it just do not generate any PDF output.

For a brief moment, in the log frame says that it can not recognize xdvipdfmx as a program or a command. So I figure that it is trying to find it in the default installed MiKTeX directory (because xdvipdfmx.exe indeed exist in the same folder than xelatex.exe and TeXworks never has a problem finding it). There is an option to set the path to dvipdfm (which —I am guessing— works with PDFLaTeX), but not for xdvipdfmx.

So, a concise question would be, Is there a way to change (or add) the default directory for Texmaker to look for? Or is the problem another?

[Addendum] [edited] So, I decided to put a xdvipdfmx.bat file into the Windows folder (which only contains one line: E:\LaTeX\MiKTeX\miktex\bin\xdvipdfmx.exe), and now it appears that compiles as it should, BUT it does not produce any PDF file, even tho the log file ends saying “Output written on satre-merleau-ponty-levinas.pdf (175 pages)” or, if I add an \includeonly sentence, “Output written on satre-merleau-ponty-levinas.pdf (9 pages)”. Every auxiliar file is also created, just not the PDF. Any thoughts?

A minimal example (not PDF output generated) is

\documentclass[11pt,twoside,book]{memoir}
\usepackage{lipsum}
\usepackage{fontspec}
\begin{document}
\lipsum
\end{document}


Under this conditions: MiKTeX portable 2.9, Texmaker portable 3.5.2 (or TeXstudio portable 2.5)

It indeed generates a PDF output if I compile it from TeXworks OR if I comment out the \usepackage{fontspec} line and compile it with pdfLaTeX.

-
You must activate the creation of the according format files first. See this answer of mine tex.stackexchange.com/a/71460. – Speravir Nov 9 '12 at 23:46
Also search here on TeX.SE for the (not so much) questions and their answers, put in the search: [miktex] +portable +texmaker. – Speravir Nov 10 '12 at 0:09
I tried what you suggested and still doesn’t work. Frankly, I don’t think there’s anything wrong with MiKTeX or its configuration (besides, it compiles as expected with TeXworks). The error said that it can’t execute xdvipdfmx.exe because it can’t find it; I just want to know how to point Texmaker to it… or whether that’s possible or not. – marlonob Nov 10 '12 at 22:12
I do not have more clues, then. If pdflatex wouldn’t have worked, too, I would have thought, it was a system path issue, and suggested to read the answers in texmaker 3.5 miktex portable 2.9 and epstopdf, but so unfortunately I cannot help. – Speravir Nov 10 '12 at 22:32
Oops, noticed just now: sourceforge.net/p/miktex/discussion/33789/thread/74621cdc – Speravir Nov 11 '12 at 1:22

This is not the optimal response, but it is an answer. You have to edit the path enviromental variable to add, at the end of it, the path to the bin MiKTeX folder (thanks to Speravir for pointing it out). In this case, just add ;E:\LaTeX\MiKTeX\miktex\bin (the semicolon is the separator). A guide to do that is in http://www.computerhope.com/issues/ch000549.htm.
The bad thing is, in this way your MiKTeX distribution is not portable anymore! Try to modify your miktex-portable.cmd similar as shown in tex.stackexchange.com/a/51110/9237 and tex.stackexchange.com/a/68915/9237 (in the striked out part). – Speravir Nov 16 '12 at 0:42