3

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:

Update

  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.

13
  • 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, 2015 at 12:48
  • yes you are right. I've modified the question.
    – DJJ
    Oct 20, 2015 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. Oct 21, 2015 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, 2015 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. Oct 21, 2015 at 14:05

1 Answer 1

1

I had the same issue: and I learned this patch from this mailing list:

https://lists.gnu.org/archive/html/auctex/2008-05/msg00007.html

The fix requires changing one line in the file tex-buf.el which I was able to find in .emacs.d/elpa/auctex-12.2.0/tex-buf.el, although the location of the file may depend on your particular set-up.

as you can see, the one function changed was: start-process to start-file-process

*** 577,584 ****
          (lambda (process name)
            (message (concat name ": done."))))
      (if TeX-process-asynchronous
!       (let ((process (start-process name buffer TeX-shell
!                                     TeX-shell-command-option command)))
          (if TeX-after-start-process-function
              (funcall TeX-after-start-process-function process))
          (TeX-command-mode-line process)
--- 577,584 ----
          (lambda (process name)
            (message (concat name ": done."))))
      (if TeX-process-asynchronous
!       (let ((process (start-file-process name buffer TeX-shell
!                                          TeX-shell-command-option command)))
          (if TeX-after-start-process-function
              (funcall TeX-after-start-process-function process))
          (TeX-command-mode-line process)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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