TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use such a function for compiling LaTeX in emacs (AUCTeX) taken from here (accepted answer by Jouni K. Seppänen):

(defun run-latexmkk ()
  (let ((TeX-save-query nil)
        (TeX-process-asynchronous nil)
        (master-file (TeX-master-file)))
    (TeX-save-document "")
    (TeX-run-TeX "latexmk" "latexmk" master-file)
    (if (plist-get TeX-error-report-switches (intern master-file))
        (TeX-next-error t)
      (minibuffer-message "latexmk done"))))

It works really well but today I observed some problem when I compile a multifile document.

I have some master.tex and \input{chap1.tex} in it. When I use run-latexmk while editing chap1.tex (master file is properly set in chap1.tex) then I get a message

TeX-run-TeX: Wrong type argument: stringp, nil.

Output pdf/dvi file seems to be good but I am curious why I get this message.

I tried changing the line (TeX-run-TeX "latexmk" "latexmk" master-file) in many ways but without success.

Of course when I compile singlefile document then all works good without any messages.

What should I change to get rid of this warning?

Edit: When I toggle-debug-on-error as @Thomas suggested in his comment I get this message

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  TeX-synchronous-sentinel("latexmk" "../MSc" 12)
  TeX-run-TeX("latexmk" "latexmk" "../MSc")
  (let ((TeX-save-query nil) (TeX-process-asynchronous nil) (master-file ...)) (TeX-save-document "") (TeX-run-TeX "latexmk" "latexmk" master-file) (if (plist-get TeX-error-report-switches ...) (TeX-next-error t) (minibuffer-message "latexmk done")))
  call-interactively(run-latexmkk nil nil)

Edit 2: To clarify, if my document compile without errors (TeX errors) then I get nice output file (and this annoying message). But when my document has some TeX errors then I get only Wrong type argument message. It is then pretty unusable.


migration rejected from stackoverflow.com Jul 5 '14 at 21:45

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as unclear what you're asking by cfr, Stefan Kottwitz Jul 5 '14 at 21:45

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Could you please type M-x toggle-debug-on-error before running the command to get a stack trace that you could post along with your question. – Thomas May 2 '12 at 4:28
@Thomas: Thanks for your reply! I have added requested info to my question. Any ideas? – xen May 2 '12 at 13:08
@chen: is your master file really called 'MSc.tex'? If not, TeX-synchronous-sentinel will effectively call (set-buffer nil), explaining your error message – Hans Lub May 11 '12 at 13:24
@Hans: yes, it is really called MSc.tex. – xen May 11 '12 at 14:14
you may want to check this topic. – masu Oct 20 '13 at 20:04