[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] auctex Digest, Vol 129, Issue 18: Setup for new PDF-Tools

From: AW
Subject: Re: [AUCTeX] auctex Digest, Vol 129, Issue 18: Setup for new PDF-Tools
Date: Fri, 20 Nov 2015 10:59:59 +0100
User-agent: KMail/5.0.3 (Linux/4.3.0-1-default; KDE/5.15.0; x86_64; ; )

> Message: 1
> Date: Wed, 18 Nov 2015 19:05:04 +0100
> From: AW <address@hidden>
> To: address@hidden
> Subject: [AUCTeX] Setup for new PDF-Tools
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset="us-ascii"
> Hi!
> Somebody on the orgmode list mentioned PDF-Tools. I'm struggeling with the 
> setup to use it with AUCTeX. But it surely is very fast!
> Installation under openSuse Tumbleweed wasn't out of the box. In the end, I 
> installed with Elpa (or was it Melpa?). At the first run it tried to
> compile the source code, but doing it the wrong way for openSuse. So I
> downloaded the source code, compiled it and put the stuff to
> ~/.emacs.d/elpa/...
> But how to customise it for AUCTeX? I figured this out for my .emacs:
> 8= 8< 8= 8<8= 8< 8= 8< 8= 8< 8= 8<
> (eval-after-load 'org '(require 'org-pdfview))
> (add-to-list 'org-file-apps '("\\.pdf\\'" . org-pdfview-open))
> (add-to-list 'org-file-apps '("\\.pdf::\\([[:digit:]]+\\)\\'" . org-pdfview-
> open))
> (pdf-tools-install)
> (setq TeX-view-program-selection (quote (((output-dvi style-pstricks)
> "dvips  and gv") (output-dvi "xdvi") (output-pdf "PDF Tools") (output-html
> "xdg- open"))))
> (add-hook 'doc-view-mode-hook 'auto-revert-mode) 
> (setq revert-without-query (quote (".*.pdf")))
> (add-hook 'TeX-after-TeX-LaTeX-command-finished-hook 'TeX-revert-document-
> buffer)
> 8= 8< 8= 8<8= 8< 8= 8< 8= 8< 8= 8<
> The last line came from politza, who wrote PDF-Tools, see here: 
> OK, now the PDF is being updated, _if_ I start the compilation of my *.tex 
> file from AUCTeX, e.g. with C-c C-c.
> But if I use latexmk, the PDF is not updated. I usually start latexmk from 
> command line, independently from Emacs. 
> So:
> - if the lisp code in my .emacs can be improved, please tell me. Is "(load 
> "pdf-tools")" necessary?
> - how to get an updated PDF with PDF-Tools every time latexmk recompiles
> the  *.tex file?

I got help on the mentioned site (

The init file for latexmk for me as user comprises these lines:

$pdf_previewer="emacsclient -c -e '(find-file %S)'";
$pdflatex='pdflatex %O -interaction=nonstopmode --synctex=1 %S';
$pdf_update_method = 4;
$pdf_update_command = "emacsclient -e '(th/pdf-view-revert-buffer-maybe %S)'";

As you can see, the pdf_update_command uses elisp: the function 


Here is the definition, as well copied from the politza's github site:

(require 'subr-x)
(defun th/pdf-view-revert-buffer-maybe (file)
(when-let ((buf (find-buffer-visiting file)))
(with-current-buffer buf
(when (derived-mode-p 'pdf-view-mode)
(pdf-view-revert-buffer nil t)))))

(add-hook 'TeX-after-TeX-LaTeX-command-finished-hook

This won't work out of the box, at least under openSuse TW and its version of 
Emacs 24.5. I downloaded an updated subr-x from the emacs development and 
fortunately this did not lead to more errors, but resolved my issue.

However, as you can see, this all ist just try and error, without insight and 

Without a summary how to install and use PDF-Tools it won't be of much use, 
although it seems an improvement. 

Maybe someone on this list can summarise, how to customise Emacs for using 
PDF-Tools as a viewer for PDF with AUCTeX?Without all the nonsense I probably 
wrote into my .emacs?

Kind regards,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]