I installed MikTex Portable on a USB drive, along with Texmaker. These are configured properly (TexMaker uses MikTex to compile LaTeX documents to PDF's). Now, I'm trying to install Asymptote as well, but I keep getting errors like:

! LaTeX Error: File `asymptote.sty' not found.Type X to quit or <RETURN> to proceed,or enter new name. (Default extension: sty)Enter file name:! Emergency stop.<read > \begin

I followed the instructions from the Art of Problem Solving Wiki, including refreshing the file database, but MikTex doesn't find the files. If I put the asymptote.sty and asycolors.sty in the same directory as my tex file, it doesn't return an error (although asymptote generates no output).

How can I integrate Asymptote with MikTex portable so I can use both from my USB drive?

  • Your error message looks like the asymptote package isn't installed properly. It is not part of MiKTeX, so you'll have to install the package manually. I don't quite know how to do this because the package doesn't seem to follow the standard TeX Directory Structure (TDS). Generally, tex.stackexchange.com/q/2063/4012 might be a start.
    – doncherry
    Apr 6, 2012 at 9:13
  • I must concur with doncherry. Actually a test install worked here!
    – Speravir
    Apr 7, 2012 at 0:12
  • @doncherry: What I’ve forgotten: In the linked wiki is a description, how the package installation should be done.
    – Speravir
    Apr 7, 2012 at 16:31

1 Answer 1


This is not really an answer (the only possible answer gave doncherry in the comments: It seems, that you do not have properly installed the asymptote style files). But it will be too long for a comment, so read this one here:

I want strongly discourage you to follow the instructions of the wiki linked by you: It is a very bad idea to put additional packages into the MiKTeX root trees, cf. Purpose of local texmf trees. Instead you should use the official opportunity to create an own (local) TeXMF tree.

For that do the following:

  1. Start MiKTeX portable by execution of the included miktex-portable.cmd.

  2. Do a right mouse click on the traybar icon, that appeared and choose “MiKTeX Options”.

  3. Choose there the tab “Roots” and add your local TEXMF tree. It will be saved as relative path in the <miktex-portable>\miktex\config\miktexstartup.ini. Your local TEXMF tree must not be a subfolder of <miktex-portable>. Last click on “OK” for saving changes.

  4. Your local TeXMF tree must, as doncherry already mentioned, be TDS compliant. Let’s say you’ve created a folder X:\localtexmf (with X: as your current removable drive) then create the subfolder tree X:\localtexmf\tex\latex\asymptote\ and copy all sty files from the original Asymptote folder into the subfolder asymptote.

  5. Now the important part, that you seem to have forgotten: Open again the “MiKTeX Options”. On tab “General” you have to update the file name database: click on “Refresh FNDB”.

Just for convenience I suggest also to add an own start batch script:

First make an save copy of the original miktex-portable.cmd. Then open this file with a text editor and change it in the following way:

@echo off

set ASYPATH=%MOBILDRIVE%\<path-to-asymptote-executables>    set PATH=%ASYPATH%;%PATH%


Change the path to the Asymptote executables according to your settings (don’t delete the part %MOBILDRIVE%\). Then you can (and should!) use the command line prompt, that you get with right click on the traybar icon. (Hint: type there echo %path% – the beginning should read similar to <miktex-portable>\miktex/bin;<asymptote-path>).

See also Using Asymptote with MiKTeX, though this is not adapted to portable use.

This is in parts a copy of myself: Setting TEXMFHOME variable when using Miktex portable.

Not the answer you're looking for? Browse other questions tagged or ask your own question.