i am using Auctex under emacs 24.3.1 on mac. I am making master .tex file and many what i call it child .tex files. Run Latex and Run bibtex commands are working nicely from either the master file or from child files but i can not view the output except from the master file. I would appreciate very much your answer(s). Thanks in advance. Ayman

  • 2
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Did you set TeX-master appropriately in the child file? (I would set it as a file-local variable.) – Sean Allred Mar 9 '14 at 20:18

Add the following at the very end of each of your 'child' files:

% Local Variables:
% TeX-master: "./my-master-file.tex"
% End:

If you already have a Local Variables block, just add the appropriate line.

Close and re-open your file; this should set the variable. (You can also call M-x normal-mode if you don't want to close the file.)

  • 1
    To reload a file there is M-x revert-buffer and I would add the suggestion to insert (setq TeX-auto-save t) (setq TeX-parse-self t) (setq-default TeX-master nil) in the .emacs file. – giordano Mar 9 '14 at 20:30

I believe i found out what the problem was. It is the configuration of skim and latexmk in the .emacs file. the perfect setting that is really works is as following

;; Skim's displayline is used for forward search (from .tex to .pdf)
;; option -b highlights the current line
;; option -g opens Skim in the background
;; option -o open Skim in the foreground with full application focus.

'(LaTeX-command "latex -synctex=1")
(require 'tex-site)
(add-hook 'TeX-mode-hook
    (lambda ()
        (add-to-list 'TeX-output-view-style
            '("^pdf$" "."
              "/Applications/Skim.app/Contents/SharedSupport/displayline -b %n %o %b")))

(setq TeX-PDF-mode t)

(setq TeX-source-correlate-mode t)

(setq TeX-source-correlate-method 'synctex)
(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)

;; make latexmk available via C-c C-c
;; Note: SyncTeX is setup via ~/.latexmkrc (see below)
(add-hook 'LaTeX-mode-hook (lambda ()
    '("latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
      :help "Run latexmk on file")
(add-hook 'TeX-mode-hook '(lambda () (setq TeX-command-default "latexmk")))

;; use Skim as default pdf viewer
;; Skim's displayline is used for forward search (from .tex to .pdf)
;; option -b highlights the current line; option -g opens Skim in the background  
(setq TeX-view-program-selection '((output-pdf "PDF Viewer")))
(setq TeX-view-program-list
     '(("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b")))

(server-start); start emacs in server mode so that skim can talk to it

(add-hook 'LaTeX-mode-hook
          (lambda () (local-set-key (kbd "<S-s-mouse-1>") #'TeX-view))

and of course, in the skim you have to do Preferences>Sync>Check for file changes and Preset>Emacs

Your Answer

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

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