I'm trying to run latex on remote host from the local host with tramp. But it seems that it cannot find the file. To be more specific:


  1. start emacs on localhost:
  2. /ssh:user@remotehost:/tmp/test.tex
  3. compile latex on remote host using C-c C-c
  4. error cannot find the file test.tex " ! I can't find file `test.tex'."

so I guess it's trying to find /ssh:user@remotehost:/tmp/test.tex but somehow cannot find it. May be it should look for /tmp/test.tex

I've tried knitr as well and found that it tries to execute /ssh:user@remotehost:foobar.rnw".

I think it should use the /ssh command since the program is running locally but I can't grasp what's happening.

Any help?

Update 2 Works fine when using emacs -Q. See comment below. will keep you posted once I have found what's wrong in the .emacs.

Update 3 The problem does not lies in the .emacs file though. I commented out everything in the .emacs and still got the same issue. I'll continue the investigation. But we are getting there.

Update 4 As suggested in the comments below firing emacs with the -Q option works find. I've got good results even with emacs -q.

Launching emacs -q is supposed to prevent loading the .emacs and the default.el files at startup. I place (setq inhibit-default-init 1) in my .emacs file and commented the rest of the commands. Therefore only the command (setq inhibit-default-init 1) is active in my .emacs file.

I launch emacs without any options and load tramp by hand (require 'tramp) and tried latex again but still no success.

I must be missing something that the -q option does not load but I can't figure it out right now.

  • What syntax did you try specifically? I suspect it could not find your file on the remote. It should probably be something like: /ssh:user@remotehost:~foobar.rnw assuming the file is in your home directory. If your username is the same on the remote, that can be omitted. – InHarmsWay Oct 20 '15 at 12:48
  • yes you are right. I've modified the question. – DJJ Oct 20 '15 at 13:54
  • I'm sorry, but I cannot follow what you have tried to call. Could you pls give the exact key sequence you have applied to Emacs? It is also important which is your current buffer, it must be one having default-directory pointing to the remote host. – Michael Albinus Oct 21 '15 at 8:05
  • I've updated the question hoping that I'm precise enough. Please let me know if i can provide more details – DJJ Oct 21 '15 at 8:36
  • 1
    For me, it works. If I apply C-c C-c, I am asked for the command. pdflatex is the default, I hit RET in order to confirm. According to the traces, it is called then remotely lke this: pdflatex \\nonstopmode\\input test.tex. Please try to perform this starting with emacs -Q, maybe you have some settings in your .emacs which confuse Tramp. – Michael Albinus Oct 21 '15 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.