> Message: 1 > Date: Wed, 18 Nov 2015 19:05:04 +0100 > From: AW <[email protected]> > To: [email protected] > Subject: [AUCTeX] Setup for new PDF-Tools > Message-ID: <[email protected]> > 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: > https://github.com/politza/pdf-tools/issues/128 > > 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 (https://github.com/politza/pdf-tools/issues/ 128) 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 th/pdf-view-revert-buffer-maybe 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 #'th/pdf-view-revert-buffer-maybe) 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 understanding. 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, Alexander _______________________________________________ auctex mailing list [email protected] https://lists.gnu.org/mailman/listinfo/auctex
