Hi R-users, Since it has been already asked for several times, I would like to share my solution that I have gathered from several sources on internet for portable R+Emacs+MikTeX. This may also help some future R-users. My best, Ozan Installing R, MikTeX, Emacs (+auctex+aspell) on USB Useful information from: - http://at-aka.blogspot.com/2006/06/portable-emacs-22050-on-usb.html - https://stat.ethz.ch/pipermail/r-help/2010-February/228068.html 1. download portable miktex to the USB drive and rename it to "miktex_portable" so that the path to MikTeX executables is like G:/miktex_portable/miktex/bin where G is USB derive letter. 2. export emacs / auctex / ess on the usb drive: - extract emacs in the USB drive, in my case its name is emacs-23.2 on the USB drive. - extract auctex in the emacs directory (i.e. emacs-23.2) - extract ess in the emacs-23.2/site-lisp/ directory. a. Edit G:/emacs-23.2/site-lisp/site-start.el so that it contains (defvar usb-drive-letter (substring data-directory 0 3)) (defvar usb-home-dir (concat usb-drive-letter "home/")) (setenv "HOME" usb-home-dir) (setenv "PATH" (concat usb-drive-letter "miktex_portable/miktex/bin;" (getenv "PATH"))) b. Create a directory called "home" in the USB drive a put your ".emacs" file in it. It should contain the following lines: (defvar usb-site-lisp-dir (expand-file-name "site-lisp" usb-home-dir)) (setq load-path (cons usb-site-lisp-dir load-path)) (let ((dir (delete nil (mapcar (lambda (f) (unless (string-match "\\.elc?\\'" f) f)) (cddr (directory-files usb-site-lisp-dir t)))))) (setq load-path (append dir load-path))) ;;portable emacs will know about portable R (setq inferior-R-program-name (concat usb-home-dir "../R/R-2.11.1/bin/Rterm.exe")) ;; no command history needed, no need to save workplace at the end of R session (setq-default inferior-R-args "--no-restore-history --no-save ") ;; needed for ESS (require 'ess-site) (require 'tex-mik) (require 'tex-site) 3. for spell checking I use aspell+eng+fr disctionaries downloaded from web. The trick is to install them in "aspell" directory in the home directory created for emacs. Then i have the followings in my .emacs: ;; set exec path for spell checking (setq exec-path (append exec-path (list (concat usb-home-dir "aspell/bin")))) (setq ispell-program-name "aspell") ;; for spell checking while typing: turn on flyspell (setq text-mode-hook '(lambda() (flyspell-mode t) )) ;;flyspell uses "-l" with ispell for faster region checking. The equivalent aspell command is "list": (setq ispell-list-command "list") ;;The problem with using aspell with flyspell is that in its default mode, it it a lot slower than ispell. ;;To speed up, though this reduces somewhat the quality of its suggestions, try: (setq ispell-extra-args '("--sug-mode=ultra")) (require 'ispell) 4. install R: the trick is to install on a local drive such C: and not directly USB derive! When I installed directly on USB it did not worked. In my case, I installed R-2.11.1 in C so that I have C:/R/R-2.11.1/bin. Then, copy-paste the whole directory to the USB derive. Note also that I have a separate folder (mylibR) for non-default, custom packages in G:/R/mylibR. Finally edit G:/R/R-2.11.1/etc/Rprofile.site in the USB derive so that it contains # set a site library .Library.site <- file.path(chartr("\\", "/", R.home()),"..", "mylibR") #check that Rprofile.site is executed by R #cat("Hello from Rprofile.site\n") ### to make Portable-R see MikTeX .First<-function(){ .libPaths(.Library.site) require(Hmisc) miktexpath <- replace.substring.wild(R.home(),"R*","miktex_portable/miktex/bin") miktexpath <- chartr("\\", "/", miktexpath) PathNew <- paste(Sys.getenv("PATH"),";",miktexpath,sep="") Sys.setenv("PATH"=PathNew) } [[alternative HTML version deleted]]