Configuring portable TeXstudio to use MiKTeX portable

I have a running version completely self contained on a usb clib (the same one I set my students up with). I have to be at a meeting but the part you need is the configuration as below. Note the relative paths.

enter image description here

Now for more details:

I recommend that you use a new (fast) usb clip (4Gb min) for the portable installation of MikTeX. I also recommend that you do not put any data on the clip, but use another clip for data. (This will make backing up the data clip significantly easier. It also runs a little faster.

  1. From http://www.miktex.org/ download and install MikTex Portable at the root level of the clip into a folder (mine is named MikTeXPortable)
  2. From http://pages.cs.wisc.edu/~ghost/ download the recent Ghostscript and GSview.

    a) Because both of these installations want to make a registry entry you need to first install both programs to the hard drive of the computer you are using.

    b) After they are installed you need to go to Program Files on the computer and copy the two folders (Ghostgum and gs) to the root of the usb Clip. [Note: If you do not want those programs on the computer then uninstall them properly with the Windows tools.]

  3. From http://texstudio.sourceforge.net/ download the TeXStudio USB(.zip) file. Then unpack it onto the usb clip at the root level.

    a) Make a shortcut to TeXStudio.exe at the root of the clip.

    b) Now save the code at the end of this answer into a file named texstudio.ini saved into the TeXstudio folder.

  4. Asymptote if desired is installed in a similar fashion.

  5. You can install R if you turn off the registry entry, icons, and shortcuts will install very nicely portable. a) If you want to run Sweave then make a user command with the following: "../Portable-R/R-2.14.0/bin/R.exe" CMD Sweave %.Rnw

  6. IMPORTANT: You need to check each of the software packages to verify the versions referenced in the options/commands matches the actual installed version.

  7. Now you will need a portable pdf reader. I use Foxit but Sumatra also works well.

  8. When you open TeXStudio you should find the options-commands as in the image.


[General]
IniMode=true

[texmaker]
ToolBar\CentralVisible=true
StructureView\ShowLinenumbers=false
StructureView\Indentation=-1
Files\New%20File%20Encoding=UTF-8
Files\Auto%20Detect%20Encoding%20Of%20Loaded%20Files=true
Files\Max%20Recent%20Files=5
Files\Max%20Recent%20Projects=3
Files\Recent%20Files=M:/!Spring2012/m2800/taylor01.tex, M:/!Spring2012/m2800/taylor01.tes, M:/pauley/analysis.Rnw, M:/pauley/analysis.tex, T:/Math2800.s12/Math2800_S12_Roseberg/PJ/06/rms-pj06_scottroseberg.tex
Files\Recent%20Project%20Files=@Invalid()
Files\RestoreSession=false
Files\Session\Files=@Invalid()
Files\Session\curRows=@Invalid()
Files\Session\curCols=@Invalid()
Files\Session\firstLines=@Invalid()
Files\Session\CurrentFile=
Files\Session\MasterFile=
Files\Last%20Document=M:/!Spring2012/m2800/taylor01.tex
Files\Parse%20BibTeX=true
Files\Parse%20Master=true
Files\Autosave=0
Spell\DictionaryDir=L:/TeXstudio2.3/dictionaries
Spell\Language=<none>
Spell\Dic=L:/TeXstudio2.3/dictionaries/de_DE.dic
Thesaurus\Database=L:/TeXstudio2.3/dictionaries/th_en_US_v2.dat
User\ToolNames=Sweave
User\Tools=\"../Portable-R/R-2.14.0/bin/R.exe\" CMD Sweave %.Rnw
Editor\WordWrapMode=1
Editor\WrapLineWidth=80
Editor\Parentheses%20Matching=true
Editor\Parentheses%20Completion=true
Editor\Line%20Number%20Multiples=1
Editor\Cursor%20Surrounding%20Lines=5
Editor\Auto%20Indent=true
Editor\Weak%20Indent=true
Editor\Indent%20with%20Spaces=false
Editor\Folding=true
Editor\Show%20Line%20State=true
Editor\Show%20Cursor%20State=true
Editor\Real-Time%20Spellchecking=true
Editor\Check%20Spelling=true
Editor\Check%20Citations=true
Editor\Check%20References=true
Editor\Check%20Syntax=true
Editor\Show%20Whitespace=true
Editor\TabStop=4
Editor\ToolTip%20Help=true
Editor\ToolTip%20Preview=true
Editor\Replace%20Quotes=0
Editor\Display%20Modifytime=true
Editor\Close%20Search%20Replace%20Together=false
Editor\Use%20Line%20For%20Search=true
Editor\Search%20Only%20In%20Selection=true
Editor\Auto%20Replace%20Commands=true
Editor\Font%20Family=Courier New
Editor\Font%20Size=12
Editor\Esc%20for%20closing%20log=false
Editor\Mouse%20Wheel%20Zoom=true
Editor\Hack%20Auto%20Choose=true
Editor\Hack%20Disable%20Fixed%20Pitch=false
Editor\Hack%20Disable%20Width%20Cache=false
Editor\Hack%20Disable%20Line%20Cache=false
Editor\Hack%20Disable%20Accent%20Workaround=false
Editor\Hack%20Render%20Mode=0
Editor\Completion=true
Editor\Completion%20Case%20Sensitive=2
Editor\Completion%20Complete%20Common%20Prefix=true
Editor\Completion%20EOW%20Completes=true
Editor\Completion%20Enable%20Tooltip%20Help=true
Editor\Completion%20Use%20Placeholders=true
Editor\Completion%20Prefered%20Tab=0
Editor\Completion%20Tab%20Relative%20Font%20Size%20Percent=100
Dialogs\Last%20Hard%20Wrap%20Column=80
Dialogs\Last%20Hard%20Wrap%20Smart%20Scope%20Selection=false
Dialogs\Last%20Hard%20Wrap%20Join%20Lines=false
Tools\SingleViewerInstance=false
Tools\Show%20Log%20After%20Compiling=true
Tools\Show%20Stdout=1
Tools\Automatic%20Rerun%20Times=5
Tools\Auto%20Checkin%20after%20Save=false
Tools\SVN%20Undo=false
Tools\SVN%20KeywordSubstitution=false
Tools\SVN%20Search%20Path%20Depth=2
GUI\Style=false
GUI\Texmaker%20Palette=false
GUI\Use%20System%20Theme=true
X11\Font%20Family=MS Shell Dlg 2
X11\Font%20Size=8
X11\Style=
Interface\Config%20Show%20Advanced%20Options=false
Interface\Config%20Riddled=false
LogView\Tabbed=true
Interface\New%20Left%20Panel%20Layout=true
Interface\Language=
Preview\Mode=4
Preview\Auto%20Preview=1
Preview\Auto%20Preview%20Delay=300
Geometries\PdfViewerLeft=315
Geometries\PdfViewerTop=9
Geometries\PdfViewerWidth=1280
Geometries\PdfViewerHeight=997
Geometries\PdfViewerState="@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x2\0\0\0\0\0\0\0x\0\0\x3H\xfc\x2\0\0\0\x3\xfb\0\0\0\xe\0o\0u\0t\0l\0i\0n\0\x65\x1\0\0\0<\0\0\x3H\0\0\0\x61\0\xff\xff\xff\xfb\0\0\0\xe\0p\0\x64\0\x66\0i\0n\0\x66\0o\0\0\0\0\0\xff\xff\xff\xff\0\0\0\x61\0\xff\xff\xff\xfb\0\0\0\xe\0o\0u\0t\0l\0i\0n\0\x65\0\0\0\0\0\xff\xff\xff\xff\0\0\0\x61\0\xff\xff\xff\0\0\0\x3\0\0\x5\0\0\0\0;\xfc\x1\0\0\0\x3\xfb\0\0\0\f\0S\0\x65\0\x61\0r\0\x63\0h\x1\0\0\0\0\0\0\x5\0\0\0\x1\x87\0\xff\xff\xff\xfb\0\0\0\n\0\x66\0o\0n\0t\0s\0\0\0\0\0\xff\xff\xff\xff\0\0\0L\0\xff\xff\xff\xfb\0\0\0\n\0\x63\0l\0o\0\x63\0k\0\0\0\0\0\xff\xff\xff\xff\0\0\0L\0\xff\xff\xff\0\0\x4\x81\0\0\x3H\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\x2\0\0\0\x1\0\0\0\xe\0t\0o\0o\0l\0\x42\0\x61\0r\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)"
Preview\DPI=96
Preview\Scale%20Option=1
Preview\Scale=100
Preview\Magnifier%20Size=300
Preview\Magnifier%20Shape=1
Preview\Magnifier%20Border=false
Preview\Sync%20File%20Mask=*.tex
Tools\User%20Class=@Invalid()
Tools\User%20Paper=@Invalid()
Tools\User%20Encoding=@Invalid()
Tools\User%20Options=@Invalid()
Quick\Class=article
Quick\Typeface=10pt
Quick\Papersize=letterpaper
Quick\Encoding=latin1
Quick\AMS=true
Quick\MakeIndex=false
Quick\Author=
Quick\Geometry%20Page%20Width=0
Quick\Geometry%20Page%20Height=0
Quick\Geometry%20Margin%20Left=0
Quick\Geometry%20Margin%20Right=0
Quick\Geometry%20Margin%20Top=0
Quick\Geometry%20Margin%20Bottom=0
Quick\Geometry%20Page%20Width%20Unit=cm
Quick\Geometry%20Page%20Height%20Unit=cm
Quick\Geometry%20Margin%20Left%20Unit=cm
Quick\Geometry%20Margin%20Right%20Unit=cm
Quick\Geometry%20Margin%20Top%20Unit=cm
Quick\Geometry%20Margin%20Bottom%20Unit=cm
Quick\Geometry%20Page%20Width%20Enabled=false
Quick\Geometry%20Page%20Height%20Enabled=false
Quick\Geometry%20Margin%20Left%20Enabled=false
Quick\Geometry%20Margin%20Right%20Enabled=false
Quick\Geometry%20Margin%20Top%20Enabled=false
Quick\Geometry%20Margin%20Bottom%20Enabled=false
Tools\Latex="\"../MikTexPortable/miktex/bin/latex.exe\" -src -interaction=nonstopmode %.tex"
Tools\Dvips=\"../MikTexPortable/miktex/bin/dvips\" -o %.ps %.dvi
Tools\Ps2pdf=\"../MikTexPortable/miktex/bin/ps2pdf\" %.ps
Tools\Makeindex=\"../MikTexPortable/miktex/bin/makeindex\" %.idx
Tools\Bibtex=\"../MikTexPortable/miktex/bin/bibtex\" %
Tools\Pdflatex="\"../MikTexPortable/miktex/bin/pdflatex\" -synctex=1 -interaction=nonstopmode %.tex"
Tools\Dvipdf=\"../MikTexPortable/miktex/bin/dvipdf\" %.dvi
Tools\Dvipng=\"../MikTexPortable/miktex/bin/dvipng\" -T tight -D 120 %.dvi
Tools\Metapost="\"../MikTexPortable/miktex/bin/mpost\" -interaction=nonstopmode ?me)"
Tools\Dvi=\"../MikTexPortable/miktex/bin/\\miktex\\bin\\yap.exe\" -1 -s @?c:ame \"?am.dvi\"
Tools\Ps=\"../Ghostgum/gsview/gvwgs32.exe\" %.ps
Tools\Pdf=\"../FoxitReaderPortable-4-3/FoxitReaderPortable.exe\" %.pdf
Tools\Ghostscript=\"../gs/gs8.71/bin/gswin32c.exe\" \"?am.ps\"
Tools\Asy=\"../Asymptote/asy.exe\" ?m*.asy
Tools\Userquick="latex -interaction=nonstopmode %.tex|bibtex %.aux|latex -interaction=nonstopmode %.tex|latex -interaction=nonstopmode %.tex|xdvi %.dvi"
Tools\Precompile=
Tools\SVN="svn                 "
Tools\SVNADMIN="svnadmin                 "
Tools\Quick%20Mode=1
Tools\Dvi2Png%20Mode=0
Files\Save%20Files%20Before%20Compiling=2
Preview\Remove%20Beamer%20Class=true
Preview\Precompile%20Preamble=true
Files\Default%20File%20Filter=All files (*)
User\Templates=@Invalid()
Search\Find%20History=@Invalid()
Search\Case%20Sensitive=true
Search\Whole%20Words=false
Search\Regular%20Expression=false
Search\Highlight=true
Search\Cursor=true
Search\Selection=false
Search\Ask%20before%20Replace=false
Search\Escape%20Sequence=false
Search\Replace%20History=@Invalid()
Preview\GridX=1
Preview\GridY=1
Preview\Single%20Page%20Step=true
Preview\Continuous=true
Preview\Scrolling%20Follows%20Cursor=false
Preview\Cursor%20Follows%20Scrolling=false
Preview\Sync%20Multiple%20Views=true
Editor\Completion%20Files=latex-document.cwl, latex-mathsymbols.cwl, tex.cwl, texmakerx.cwl
qttwp\userwidth=700
qttwp\compil=1
qttwp\tocdepth=2
qttwp\startindex=1
qttwp\navigation=1
qttwp\noindex=false
qttwp\title=
qttwp\address=
qttwp\browser=\"C:/Program Files/Internet Explorer/IEXPLORE.EXE\"
qttwp\contentname=\\contentsname
qttwp\align=center
qttwp\lastdir=C:/Documents and Settings/SCHUMACR
qttwp\dviopt=" -Ppk -V"
InsertGraphics\includeOptions="width=\\textwidth"
InsertGraphics\center=true
InsertGraphics\useFigure=true
InsertGraphics\captionBelow=true
InsertGraphics\placement=htbp
InsertGraphics\spanTwoCols=false
Tools\After%20BibTeX%20Change=tmx://latex && tmx://bibtex && tmx://latex
User\New%20Key%20Replacements%20Created=true
User\Tags=%%, " %%"
User\TagNames=Key replacement: % before word, Key replacement: % after word
User\TagAbbrevs=, 
User\TagTriggers="(?<=\\s|^)%", "(?<=\\S)%"
keysetting\size=0
changedLatexMenus=@Variant(\0\0\0\b\0\0\0\0)
CustomToolBar=@Invalid()
FileToolBar=@Invalid()
EditToolBar=@Invalid()
ToolsToolBar=@Invalid()
MathToolBar=@Invalid()
FormatToolBar=@Invalid()
TableToolBar=@Invalid()
DiffToolBar=@Invalid()
CentralToolBar=@Invalid()
customIcons=@Variant(\0\0\0\b\0\0\0\0)
customHighlighting=@Variant(\0\0\0\b\0\0\0\0)
customCommands=@Invalid()
MainWindowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x2\0\0\0\0\0\0\x1\x1b\0\0\x3\x95\xfc\x2\0\0\0\x1\xfb\0\0\0\x12\0l\0\x65\0\x66\0t\0P\0\x61\0n\0\x65\0l\x1\0\0\0\x35\0\0\x3\x95\0\0\0\x61\0\xff\xff\xff\0\0\0\x3\0\0\x3\x35\0\0\0|\xfc\x1\0\0\0\x1\xfb\0\0\0\x14\0O\0u\0t\0p\0u\0t\0V\0i\0\x65\0w\x1\0\0\x1\"\0\0\x3\x35\0\0\0\x81\0\xff\xff\xff\0\0\x3\x35\0\0\x3\x12\0\0\0\x1\0\0\0\x2\0\0\0\x1\0\0\0\x2\xfc\0\0\0\x1\0\0\0\x2\0\0\0\b\0\0\0\f\0\x43\0u\0s\0t\0o\0m\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\b\0\x46\0i\0l\0\x65\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\b\0\x45\0\x64\0i\0t\x1\0\0\0\x84\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\n\0T\0o\0o\0l\0s\x1\0\0\x1%\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\b\0M\0\x61\0t\0h\x1\0\0\x2^\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\f\0\x46\0o\0r\0m\0\x61\0t\x1\0\0\x3H\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\n\0T\0\x61\0\x62\0l\0\x65\x1\0\0\x3\xdf\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\b\0\x44\0i\0\x66\0\x66\x1\0\0\x4\x1b\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
MainWindowFullssscreenState=@ByteArray()
MainWindow\Maximized=false
MainWindow\FullScreen=false
Geometries\MainwindowWidth=1111
Geometries\MainwindowHeight=1001
Geometries\MainwindowX=50
Geometries\MainwindowY=5
Symbols\Quantity=@Variant(\0\0\0\b\0\0\0\0)
Symbols\Favorite%20IDs=@Invalid()
Symbols\hiddenlists=
StructureView\SingleDocMode=false
Editor%20Key%20Mapping\0=20483

[formats]
version=1.0

Updated Answer: Jan. 6, 2012

This tutorial is based on the external blog post Configuring Texmaker USB With MiKTeX Portable.

There are now some minor changes with the User Interface in Version 2.5.1 (Portable version 2.9.4250) from the older versions.

Setting Up TeXStudio with MiKTeX Portable 2.9.4250.

Now open your TeXStudio USB folder and look for the file texstudio.exe. Double click that to fire up your TeXStudio portable. Now, click on the following menu:

Options > Configure TeXStudio... > Commands

You should see something like this:

enter image description here

Notice that there are minor differences from the one in R. Schumacher's answer (older version). To set up the where TeXStudio portable will look for the drivers, click on the folder icon (colored blue in my case) and browse to the location of the appropriate driver in your USB device. But make sure to put .. before the outputted folder driver location.

You should see something like this now.

enter image description here

Here is a summary of what I have written in the Commands configuration.

LaTeX > "../MikTexPortable/miktex/bin/latex.exe" -src -interaction=nonstopmode %.tex
PdfLaTeX > "../MikTexPortable/miktex/bin/pdflatex.exe" -src -interaction=nonstopmode %.tex
XeLaTeX > "../MikTexPortable/miktex/bin/xelatex.exe" -src -interaction=nonstopmode %.tex
LuaLaTeX > "../MikTexPortable/miktex/bin/lualatex.exe" -src -interaction=nonstopmode %.tex
DviPs > "../MikTexPortable/miktex/bin/dvips" -o %.ps %.dvi
DviPng > "../MikTexPortable/miktex/bin/dvipng" -T tight -D 120 %.dvi
Ps2Pdf > "../MikTexPortable/miktex/bin/ps2pdf" %.ps
DviPdf > "../MikTexPortable/miktex/bin/dvipdfm" %.dvi
BibTeX > "../MikTexPortable/miktex/bin/bibtex" %.aux
BibTeX8 > "../MikTexPortable/miktex/bin/bibtex8" %.aux
Biber > "../MikTexPortable/miktex/bin/biber" %
Makeindex > "../MikTexPortable/miktex/bin/makeindex" %.idx
Texindy > "../MikTexPortable/miktex/bin/texindy"
Makeglossaries > "../MikTexPortable/miktex/bin/tmakeglossaries"
Metapost > "../MikTexPortable/miktex/bin/mpost" -interaction=nonstopmode ?me
Latexmk > "../MikTexPortable/miktex/bin/latexmk" -pdf -silent -pdflatex="pdflatex -synctex=1 %%O %%S" %

Viewer

Note that I have not done anything with the viewers yet.

PDF

TeXStudio has a built-in PDF Viewer. To configure, click

Options > Configure TeXStudio... > Build > PDF Viewer > Internal PDF Viewer (Windowed)

There is also an Embedded version for the Internal PDF Viewer.

DVI Viewer

Follow R. Schumacher's post.

PS Viewers

You can follow the second step of R. Schumacher's answer. Alternatively, you can use the procedure in Configuring Texmaker USB With MiKTeX Portable. Here is the summary: Download and install portableapps into your USB device then fire up the program 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).

Your USB file structure should now look like:

USB Drive
    |_____GSView
        |_____gsview % from R. Schumacher's answer
    |_____MikTexPortable
    |_____TeXStudio
    |_____PortableApps
        |_____CommonFiles
            |_____GhostScript

Then do click

Options > Configure TeXStudio... > Commands

and in PS Viewer browse to the location of gswin32/gswin64 in your USB folder.


I am not sure in which version this feature was introduced, but TeXstudio now allows entering an additional search path for commands. The benefit of this is that it will also allow TeXstudio to find "texdoc.exe", allowing the user to access package documentations from within TeXstudio.

This solution does not apply to DVI, PS and external PDF viewers as well as Aymptote and Ghostscript. Refer to the excellent answers above to solve those issues.

In

Options > Configure TeXStudio...

activate "Show Extended Options". Then go to

Options > Configure TeXStudio... > Build

and, in the bottom of the page, edit the line "Commands ($PATH)" to include the relative path to the directory that includes the executables (ie pdflatex.exe).

For my folder structure, that would be

../MiKTeXPortable/texmfs/install/miktex/bin/

The "Build" settings including the added relative path.

You can then simply use the default commands, for example in the case of pdflatex:

  • pdflatex.exe -synctex=1 -interaction=nonstopmode %.tex

This is especially useful if you have already configured a permanent system on your home computer and intend to use the portable MiKTeX edition on a work machine. Simply copy the "texstudio.ini" file from the appropriate AppData folder into the directory on your USB-stick where "texstudio.exe" is located and add the path to keep all your precious settings.