0

After installing the required dependencies with homebrew, I was able to compile pdf-tools . But I cannot make it work (I cannot see the pdf on emacs after compiling)

I would like to know if somebody can post its .emacs config to make pdf-tools work since I have not been able to make it happen. I have tried several options, like the following (copy from somebody else):

(load "pdf-tools") ;;
(setq output-pdf "PDF Tools") ;;          
(pdf-tools-install)                                                   
(setq TeX-view-program-selection '((output-dvi "Okular")              
                                   (output-pdf "PDF Tools") ;;        
                                   ))

Or also

;; Use pdf-tools to open PDF files
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
      TeX-source-correlate-start-server t)

;; Update PDF buffers after successful LaTeX runs
(add-hook 'TeX-after-TeX-LaTeX-command-finished-hook
           #'TeX-revert-document-buffer)

But, after compiling a tex file (with C-c C-c with Auctex) and trying to see the pdf with the same command (and selecting View), I always get the error

Unknown PDF Tools viewer. Check the Tex-view-program-selection variable

I am sure I am missing a key config for making pdf-tools available or known to auctex/emacs, but cannot figure it out. Could you please post your config to get an inspiration from it? I have already checked install-pdf-tools-on-emacs-macosx, how-to-let-auctex-open-pdf-with-pdf-tools and how-to-use-pdf-tools-pdf-view-mode-in-emacs without success.

Thanks in advance.

Edit: Making already visited links more explicit.

  • Does the following link resolve your issue?: How to let AUCTeX open PDF with pdf-tools: emacs.stackexchange.com/a/19475/2287 – lawlist Mar 20 '16 at 18:33
  • Hi, that is the second link I put in my question and still it does not work and shows me the same error. – iluvatar Mar 20 '16 at 18:36
  • Ah, I'm sorry, I don't usually click on something that says "this". My bad . . . please disregard then. – lawlist Mar 20 '16 at 18:38
  • Do not worry. I have edited the question to make links more clear. – iluvatar Mar 20 '16 at 18:40
  • What version of AUCTeX do you have? Support for PDF Tools has been introduced in 11.89. – giordano Jun 10 '16 at 7:34
0

The problem is that you need to add "PDF Tools" to the list of available PDF Tools. This must happen automagically for some people (or there would be more complaints about this on stackexchange!), but apparently not for you or me.

Here is my config:

(pdf-tools-install) ;; start server
(load "pdf-tools") ;; not clear if this is needed.

;; add "PDF Tools" to the list of possible PDF tools
(unless (assoc "PDF Tools" TeX-view-program-list
  (add-to-list 'TeX-view-program-list
           '("PDF Tools" TeX-pdf-tools-sync-view)))
(add-to-list 'TeX-view-program-selection
          '(output-pdf "PDF Tools"))

(setq TeX-view-program-selection '((output-pdf "PDF Tools")))

;; Update PDF buffers after successful LaTeX runs
(add-hook 'TeX-after-TeX-LaTeX-command-finished-hook
         'TeX-revert-document-buffer)
  • The "magic" to make PDF Tools appear is to upgrade to AUCTeX 11.89 and don't fiddle with TeX-view-program-list-builtin. The variable intended to be customized by the users is TeX-view-program-list. – giordano Jun 10 '16 at 7:35
  • "builtin" was a type-o. Thanks for fixing that. Merely updated to auctex 11.89 alone is not enough, unfortunately. – hartshoj Jun 10 '16 at 11:50
  • Do you mean that in AUCTeX 11.89 you don't have the "PDF Tools" entry for TeX-view-program-list-builtin? – giordano Jun 10 '16 at 12:58
  • I have updated AUCTex from 11.89.1 to 11.89.4, also installed the latest version for pdf-tools, and it is working correctly. – iluvatar Jun 11 '16 at 18:22
  • I have AUCTex 11.89.4. TeX-view-program-list-builtin does not include "PDF Tools". – hartshoj Jun 12 '16 at 23:12
0

Assuming your auctex is up-to-date and that you followed the instructions for installing the package, including the M-x package-install-file RET pdf-tools-${VERSION}.tar RET step, all you should need is

;; Initialize the package (this should autoload it too)
(pdf-tools-install)
;; Select PDF Tools as your viewer for PDF files
(setcdr (assq 'output-pdf TeX-view-program-selection) '("PDF Tools"))
;; If you want synctex support, this should be sufficient assuming 
;; you are using LaTeX-mode
(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)
0

I answered this here: Install Pdf-Tools on Emacs MacOSX

You'll also find this helpful for application/mode/package specific tweaks: How to use pdf-tools (pdf-view-mode) in 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.