Tag Archives: portableapps

Configuring Texmaker USB With MiKTeX Portable

Note: this article was last updated on February 24, 2014, for users of Windows 7 only. Your mileage may vary with other versions of Windows.

I’ve had a number of requests to update my tutorial for installing a portable version of \LaTeX for current versions of both MiKTeX and Texmaker. There are very few step-by-step tutorials out there for building your own portable \LaTeX workshop, so I thought it might prove advantageous to document my build to save others the headache of troubleshooting the process.

The advantages of a portable \LaTeX installation is that it is relatively lightweight because it installs only the packages you need to get up and running. If one of your files calls a package that isn’t installed yet, Texmaker will install it for you on the fly. All you need is an empty USB thumbdrive and a little bit of time. Fortunately, since my last update, Texmaker no longer requires Ghostscript or GSView to render PDF files, which makes this process a whole lot simpler and cleaner.

First of all, you need an empty USB thumbdrive. I recommend at least 2GB to give you room to install additional packages as needed. Then, download the following bundles:

  • MiKTeX Portable – MiKTeX downloads as a self-extracting executable, so once you’ve saved it locally, run the .exe and choose your thumbdrive as the destination. Make sure to specify a new directory for the files, for example: D:/MiKTeX
  • Texmaker USB – extract directly onto the root of your thumbdrive

When you’re done, you should have two subdirectories on your USB drive, one each for MiKTeX Portable and Texmaker USB. It might also be helpful to create a shortcut in your thumbdrive’s root directory to both MiKTeX and Texmaker to save yourself the hassle of needing to dig into each of those directories each time you use \LaTeX.

USB Drive
    |_____miktex-portable.cmd - Shortcut
    |_____Texmaker.exe - Shortcut

Start MiKTeX and right-click on the icon that appears in your tray. Click ‘Update MiKTeX’. In most cases, it’s ok to just use the default option of updating from the nearest location. Updating may take a while, so this might be a good time to grab a cup of coffee.

Since Asymptote decided to stop playing nice sometime around version 2.16, I recommend using PGF and TikZ for creating nice-looking 2D graphics. You can download the latest version from its Sourceforge repository:

Extract the Tikz files directly into your MiKTeX directory. A window will pop up with a warning. Click the checkbox for “Do this for all current items (2 found)” then click ‘Yes’. This will install the Tikz files in the appropriate directories of your MiKTeX structure.


Right-click the MiKTeX icon in your system tray again, but this time select ‘MiKTeX Package Manager.’ We need to install two packages so Tikz can run properly — pgf and xcolor. Use the ‘Name:’ field to filter down to pgf, select it, and install. Do the same for xcolor.


Since Texmaker now has a built-in viewer, installing a PDF reader like FoxitReader is no longer necessary. If you would still prefer an external viewer, I recommend grabbing a copy of the FoxIt reader from PortableApps.com. You can install it in its own directory on your thumbdrive, then update the path to it in Texmaker’s configuration options (described below).

You can also install the R Project statistical package. (I may detail how to do this in a later article). If you do so, your file structure will look like this:

USB Drive
    |_____miktex-portable.cmd - Shortcut
    |_____Texmaker.exe - Shortcut

Now we need to configure Texmaker so it knows where to find our custom installation. Launch Texmaker, then click on Options -> Configure Texmaker. The Commands screen should pop up by default. We’re going to modify most of these fields so that Texmaker can process your .tex files while still being able to run from a USB stick on any Windows computer. (Since my build uses neither Asymptote nor Ghostscript/GSView, I have left those paths set to their defaults.)


LaTeX: "../MiKTeX/miktex/bin/latex.exe" -interaction=nonstopmode %.tex
PdfLaTeX: "../MiKTeX/miktex/bin/pdflatex.exe" -interaction=nonstopmode %.tex
XeLaTeX: "../MiKTeX/miktex/bin/xelatex.exe" -interaction=nonstopmode %.tex
LuaLaTeX: "../MiKTeX/miktex/bin/lualatex.exe" -interaction=nonstopmode %.tex
Latexmk: "../MiKTeX/miktex/bin/latexmk.exe" -e "$pdflatex=q/pdflatex -interaction=nonstopmode/" -pdf %.tex
Bib(la)tex: "../MiKTeX/miktex/bin/bibtex.exe" %
Makeindex: "../MiKTeX/miktex/bin/makeindex.exe" %.idx
dvips: "../MiKTeX/miktex/bin/dvips.exe" -o %.ps %.dvi
Dvipdfm: "../MiKTeX/miktex/bin/dvipdfm.exe" %.dvi
ps2pdf: "../MiKTeX/miktex/bin/ps2pdf.exe" %.ps
metapost: "../MiKTeX/bin/mpost.exe" --interaction nonstopmode
Asymptote: "C:/Program Files/Asymptote/asy.exe" %.asy
ghostscript: "C:/Program Files/gs/gs9.07/bin/gswin32c.exe"
R Sweave: "../R/bin/R.exe" CMD Sweave %.Rnw
Dvi Viewer: "../MiKTeX/miktex/bin/yap.exe" -1 -s @%.tex %.dvi
PS Viewer: "C:/Program Files/Ghostgum/gsview/gsview32.exe" %.ps
Pdf Viewer: Set this to use the Built-in Viewer (optional: Click the Embed checkbox)

Set your QuickBuild to run PdfLaTeX + View PDF. Once you make these changes, your portable LaTeX setup should be all configured and ready to work on any USB stick.

Inverse Search

With the addition of Texmaker’s built-in viewer, configuring Inverse Search is no longer necessary. If you still need to do this for any external viewer you might be using, refer to the link in the resource section below.

Additional resources:
GSview 4.9 and Ghostscript 8.60 Portable
“Forward/Inverse search” with Texmaker

Portable Apps

I’d like to introduce, for those who haven’t already seen it, a way to take some of your favorite applications with you wherever you go. “PortableApps”:http://portableapps.com/ sports a numbers of applications that you can save onto your flash drive and use on any computer. In my case I work in an office where I have no administrator rights whatsoever on my computer, and so I have been deprived of my Firefox browser since I started working here in mid-December. PortableApps provides the solution to this problem with “Portable Firefox”:http://portableapps.com/apps/internet/browsers/portable_firefox, allowing me to run Firefox because it doesn’t actually install on my computer so it doesn’t need to muck with the registry settings or network restrictions. I simply opened the .zip file, extraced the folders to my desktop, and voila! Instant Firefox! And when I get Internet access at home again, all I have to do is save the Portable Firefox folders to CD and take it with me to keep any changes I make to my configuration.

I also have “Portable Thunderbird”:http://portableapps.com/apps/internet/email/portable_thunderbird for keeping up with my RSS feeds and “Portable GAIM”:http://portableapps.com/apps/internet/chat/portable_gaim in the event that I want to load it for a moment when I get some free time and see who’s online.

I don’t have a flash drive but finding this site makes me now wish I had one. Props to a buddy of mine who dropped in last night for pointing me toward this!