# 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
|_____texmakerwin32usb
|_____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
|_____R
|_____texmakerwin32usb
|_____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.