First a remark:
I do not use MikTeX portable myself, and honestly I don’t understand it entirely. So let me give some hints from what I’ve found. Maybe some other can give additional information.
MiKTeX apparently does not take use of the kpse mechanism. The recommended method in MikTeX for adding a local TeXMF tree is to use the MiKTeX Options dialogue:
- Start MiKTeX portable by execution of the included
- Do a right mouse click on the traybar icon, that appeared and choose “MiKTeX Options”.
- Choose there the tab “Roots” and add your local TEXMF tree. It will be saved as relative path in the
<miktex-portable>\miktex\config\miktexstartup.ini. Your local TEXMF tree must not be a subfolder of
What I wanted to do now doesn’t seem to work, I consider it a bug in MiKTeX 2.9: After activation of “Show MiKTeX-maintained root directories” one should be able to change the order of the folders, but I couldn’t manage this.
- After clicking on “OK” all will be saved in ini as written above.
<miktex-portable>\doc\miktex\miktex.pdf, section 4.6, (or see
<miktex-portable>\doc\miktex\localadditions.html, as web link : http://docs.miktex.org/manual/localadditions.html) there are 2 other ways:
- Use the command-line option
latex --include-directory=C:\path\to\my\style\files thesis.tex. I don’t know, whether this works with a full local TEXMF tree, but I fear it does not.
- Set environment variables, which are useful in scripts alias batch files. The given example is
Instead of absolute paths I would favour relative ones together with the use of command line parameters, e.g. if you save a batch script
latex.cmd directly in lets say
X:\miktex-portable and have your local TEXMF tree in
:: %~d0 enhances to X: here, %~dp0 to X:\miktex-portable\
:: I fear, this does not work in the wanted manner
:: There are some other possible environment variables
:: %* pipes all command line options, given to to batch file, to the call of latex.exe
Then you could do
latex.cmd <command line options> file_to_compile.tex.
On the other hand you could consider the use of the portable texlive version.