Note: this article is for Windows platforms 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 seems to be 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.
First of all, you need to create an empty folder somewhere. I called mine LaTeX Portable. 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)
- Foxit Reader Portable – extract into LaTeX Portable
When you’re done, you should have three subdirectories in your LaTeX Portable folder, one each for MiKTeX Portable, Texmaker USB, and Foxit Reader Portable.
LaTeX Portable
|_____FoxitReaderPortable
|_____miktex-portable
|_____texmakerwin32usb
Then, go to http://pages.cs.wisc.edu/~ghost/ and download the latest versions of Ghostscript and GSView (8.64 and 4.9, respectively, at the time of this writing). Both of these files are self-extracting executable archives. Save them to your computer. Rather than running the .exe files, use a program like 7-zip to extract their contents to your LaTeX Portable directory. Again, you’ll need to create a new directory for each of these archives to extract the files into. When you’re done, your folder structure should look something like this:
LaTeX Portable
|_____FoxitReaderPortable
|_____ghostscript
|_____GSView
|_____miktex-portable
|_____texmakerwin32usb
Inside your ghostscript directory, you’ll see:
ghostscript
|_____gs864w32
|_____gs8.64
|_____filelist.txt
|_____setupgs.exe
|_____uninstgs.exe
Copy the gs8.64 directory into your GSView directory, then delete the ghostscript directory. Your LaTeX Portable folder structure should now look like:
LaTeX Portable
|_____FoxitReaderPortable
|_____GSView
|_____gs8.64
|_____gsview
|_____pstotext
|_____miktex-portable
|_____texmakerwin32usb
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-portable/miktex/bin/latex.exe" --src -interaction=nonstopmode %.tex %0 "%N%T" dvips: "../miktex-portable/miktex/bin/dvips.exe" -o %.ps %.dvi Bibtex: "../miktex-portable/miktex/bin/bibtex.exe" % Makeindex: "../miktex-portable/miktex/bin/makeindex.exe" %.idx Dvi Viewer: "../miktex-portable/miktex/bin/yap.exe" -1 -s @%.tex %.dvi PS Viewer: "../GSView/GSviewPortable.exe" %.ps PdfLaTeX: "../miktex-portable/miktex/bin/pdflatex.exe" -interaction=nonstopmode %.tex Dvipdfm: "../miktex-portable/miktex/bin/dvipdfm.exe" %.dvi ps2pdf: "../miktex-portable/miktex/bin/ps2pdf.exe" %.ps Pdf Viewer: "../FoxitReaderPortable/FoxitReaderPortable.exe" %.pdf metapost: "../miktex-portable/miktex/bin/mpost.exe" --interaction nonstopmode ghostscript: "../GSView/gs8.64/bin/gswin32c.exe"
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
To set up Yap to run inverse search, it’s important to run it as an administrator (Right-click -> ‘Run as Administrator’) so that it will be able to permanently save your setting. Go to View -> Options -> Inverse DVI Search. Click ‘New’. Type
Texmaker
in Name and
"%f" -line %l
where it says to specify the program arguments. YAP doesn’t support relative paths, so you’ll have to point YAP at the absolute path to Texmaker. Once you’ve completed all three of these steps, click ‘Ok’ and Texmaker will be displayed in the list. Select Texmaker, click Apply, and Ok. You should now be able to conduct both Forward and Inverse search.
Additional resources:
GSview 4.9 and Ghostscript 8.60 Portable
“Forward/Inverse search” with Texmaker


Were you able to make to get inverse dvi search from Yap back to TeXMaker to work?
I've never tried, but I'll look into it over the weekend and see what I can figure out.
My recent post 235 – Viral Anarchy
Alan, I've updated this post with the information you asked about. Hope it helps.
My recent post 235 – Viral Anarchy
Jim, thanks for going to the trouble of making such a detailed explanation. It helped a lot!! I think your web page editor may have automatically converted the upright quotation symbol that is needed in the command line arguments into slanted quotation symbols. Also, the double dash was converted into the long dash. So, copying and pasting doesn't work. I was not able to get the inverse search with Texmaker to work with either my regular hard drive install or with the USB install. I'm pretty sure I followed the instructions. Apparently other people have had that problem too. However, inverse search did work when I modified your instructions for TexmakerX. I spent a few hours experimenting with various configurations. It didn't even occur to me that Yap needed to be run in administrator mode. I discovered through trial and error, that occasionally,Yap can be given a relative path name and then inverse searching will work for a while, until something changes. I think the problem has to do with telling Yap how to set its current directory, but I didn't find an option for that. Also, I hadn't previous installed ghostscript, Ghostview, or a PDF viewer on my USB LaTeX distribution. Using 7-zip to extract the files from the executable files was a good idea! Since both forward and inverse search are really important to me when I'm editing LaTeX files, I also tried out your suggestions with the Sumatra PDF viewer. The forward and inverse searching from Texmaker and TexmakerX to Sumatra seems to work, except I was getting multiple instances of both the text editor and viewer. I'm getting closer to having a full fledged completely functional LaTeX environment on a USB memory stick with functional forward/inverse search for both dvi and pdf files. I have to say your post about USB LaTeX inspired me to do a lot of experimenting this weekend.
Thanks for the heads-up on the formatting issue, Alan. I didn't even think about that. I converted those commands to preformatted text to preserve the format.
As for the inverse search, it took me quite a bit of experimenting to figure out as much as I did, and even then it wasn't as smooth as I'd like to see. I had the same problem with the multiple instances that you mentioned and have, as yet, to find a way to correct that. If you come up with something, please let me know.
Setting this portable version of LaTeX up has been something of a first for me, so I'm not surprised there's still a few kinks to work out. I'll update this post as I come up with anything new.
My recent post 235 – Viral Anarchy
I've noticed that ps2pdf does not work because ps2pdf in ghostscript uses bat files for processing, most likely due to PATH not being what it should. I suggest using a bat file to start texmaker which temporarily changes PATH to include miktex-portable/miktex/bin, and restore on exit, such that the ps2pdf utilities do not run into issues. This also simplifies the texmaker path settings. The path variable change will only effect the command line instance that it is changed in, and not system wide.
The other suggestion I have is to use sumatrapdf with the -reuse-instance command line option, to reuse the same window for the pdf, instead of opening a new one. I haven't tried doing forward and inverse search with sumatrapdf.
Thanks for the suggestions. I'll definitely take a look into them and see what I can figure out.
My recent post 236 – Crux
Hi, when I download and unpack the ghostscript 8.64 .tar-archive there's no directory "gs864w32" and therefore no "gs8.64" and stuff either. Anyone knows what's up with this…?
You should have downloaded the executable file. The file structure in the other archives is different.
My recent post 240 – Pure
Problem solved. Careful reading really for the better! ;-)
[...] [...]
How to compile Metapost whit Texmaker?. Thanks