Note: this article was last updated on June 24, 2012, for users of Windows 7 only.
After a lot of trial-and-error — not to mention a wee bit of teeth gnashing, hair pulling, and weeping uncontrollably — I have finally managed to get Texmaker USB configured work with MiKTeX Portable. Since there is a relative dearth of information on this particular setup on the Web, I thought I’d detail the setup for anyone else trying to get these two programs to communicate. It’s a bit of work to set up, but the bonus is that it doesn’t require any batch files to run and each module can be updated independently. Also, in my opinion, it’s always good to know how your portable LaTeX setup is built, in the event you need to troubleshoot something down the road (and you will).
First of all, you need an empty USB drive. Then, download the following programs:
- MiKTeX Portable – extract into the new folder you just made
- Texmaker USB – extract into LaTeX Portable/miktex-portable/ (you’ll need to create a new directory for MiKTeX Portable)
When you’re done, you should have two subdirectories on your USB drive, one each for MiKTeX Portable and Texmaker USB.
USB Drive |_____MiKTeX |_____texmakerwin32usb
Then, go to http://pages.cs.wisc.edu/~ghost/ and download the latest version GSView (5.0 at the time of this writing). This file is a self-extracting executable archive. Save it to your computer. Rather than running the .exe file, use a program like 7-zip to extract the contents to your LaTeX Portable directory. Again, you’ll need to create a new directory for the archive to extract the files into. When you’re done, your folder structure should look something like this:
USB Drive |_____GSView |_____MiKTeX |_____texmakerwin32usb
For Ghostscript, I recommend going to the PortableApps website and installing The PortableApps.com Platform to your USB drive. Once you’ve done that, launch the platform and open the menu. Click on ‘Apps,’ then ‘Get More Apps.’ Under ‘Utilities’ locate Ghostscript, select the checkbox, and click ‘Next.’ The PortableApps.com Platform will automatically install Ghostscript to your USB drive (under PortableApps/CommonFiles). This will make it easy to update as future updates are released.
Your LaTeX Portable folder structure should now look like:
USB Drive |_____GSView |_____gsview |_____pstotext |_____MiKTeX |_____texmakerwin32usb |_____PortableApps |_____CommonFiles |_____GhostScript
Finally, download the latest version of Asymptote.
At least as of version 2.16, Asymptote no longer functions properly using this method to install to a USB drive. I have had no luck finding a workaround (or at least, there’s no easy solution that doesn’t involve messing with drive letters or manually changing configuration options every time you plug the USB drive in to a computer). Instead, I recommend installing the TikZ and PGF package to MiKTeK and using TikZ for graphics, instead of Asymptote. You’ll have to learn a new language for building graphics, but the benefit is that you can compile everything in one go. I’ll leave the instructions for Asymptote here for the time being, in the event that something changes or someone is masochistic enough to insist on trying to make it work from a USB drive.
Save the executable and use 7-zip to extract the files to an Asymptote directory on your USB Drive. Your file structure should now look like this:
USB Drive |_____Aysmptote |_____GSView |_____gsview |_____pstotext |_____MiKTeX |_____PortableApps |_____CommonFiles |_____GhostScript |_____texmakerwin32usb
Since Texmaker now has a built-in viewer, installing a PDF reader like FoxitReader is no longer necessary. If, however, you still want to use an external viewer, use the PortableApps.com Platform to install Foxit Reader the same way you installed Ghostscript. Then configure your Texmaker settings to use an External Viewer with the following path:
Pdf Viewer "../PortableApps/FoxitReaderPortable/FoxitReaderPortable.exe" %.pdf
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 |_____Aysmptote |_____GSView |_____gsview |_____pstotext |_____MiKTeX |_____PortableApps |_____CommonFiles |_____GhostScript |_____R |_____texmakerwin32usb
The step below will show you how to configure your settings to make use of R’s Sweave utility.
The next step is to configure Texmaker to access the MiKTeX Portable and Ghostscript/GSView files. 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.
LaTeX: "../MiKTeX/miktex/bin/latex.exe" -interaction=nonstopmode %.tex dvips: "../MiKTeX/miktex/bin/dvips.exe" -o %.ps %.dvi Bib(la)tex: "../MiKTeX/miktex/bin/bibtex.exe" % Makeindex: "../MiKTeX/miktex/bin/makeindex.exe" %.idx Dvi Viewer: "../MiKTeX/miktex/bin/yap.exe" -1 -s @%.tex %.dvi PS Viewer: "../GSView/GSviewPortable.exe" %.ps PdfLaTeX: "../MiKTeX/miktex/bin/pdflatex.exe" -interaction=nonstopmode -synctex=1 %.tex Dvipdfm: "../MiKTeX/miktex/bin/dvipdfm.exe" %.dvi ps2pdf: "../MiKTeX/miktex/bin/ps2pdf.exe" %.ps Pdf Viewer: Set this to use the Built-in Viewer (optional: Click the Embed checkbox) metapost: "../MiKTeX/bin/mpost.exe" --interaction nonstopmode ghostscript: "../PortableApps/CommonFiles/Ghostscript/bin/gswin32c.exe" Asymptote: "../Asymptote/asy.exe" %.asy Latexmk: "../MiKTeX/miktex/bin/latexmk.exe" -e "$pdflatex=q/pdflatex -interaction=nonstopmode/" -pdf %.tex R Sweave: "../R/bin/R.exe" CMD Sweave %.Rnw
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.
With the addition of Texmaker’s built-in viewer, configuring Inverse Search is no longer necessary. If you still need to do this, reference the link in the resource section below.
Update: This article has been updated to reflect my latest build method and software updates. Due to the influx of spambots, I’ve had to close the comments here, so if you have any questions, tips, or pointers for a better portable LaTeX installation, feel free to email me with your thoughts.