2

For some reason I cannot view PDF files in doc-view-mode.

Supposedly if I open a PDF file in Emacs, it should automatically open in the doc-view major mode. If it can't be opened in doc-view, then there will at least be some error message.

But for me, opening a PDF file opens it in fundamental mode. If I use M-x doc-view-mode then the mode-line shows (fundamental docview) which indicates that the docview minor mode is used, as I understand it.

That minor mode claims I can use C-c C-c to view the document, but that does nothing, and leaves me in the "editor mode." I've checked the *Messages* buffer, and there are no error messages. Here is a screenshot: A screenshot of the setup

Here's what I'm working with:

  • Emacs 27.1
  • macOS 11.2.3 (Big Sur)
  • auctex 13.0.4
  • latex-preview-pane-20181008.1822

The only discussion I've managed to find about this is specifically for Windows, such as here.

1 Answer 1

1

M-x find-library RET doc-view tells us:

Requirements:

doc-view.el requires GNU Emacs 22.1 or newer. You also need Ghostscript, dvipdf (comes with Ghostscript) or dvipdfm (comes with teTeX or TeXLive) and pdftotext, which comes with xpdf (http://www.foolabs.com/xpdf/) or poppler (http://poppler.freedesktop.org/).

So check that you have those dependencies installed.

If they are installed, check that Emacs can see them -- C-hv exec-path is the list of directories where Emacs will look for executables on the local machine.


You may wish to take a look at https://github.com/vedang/pdf-tools as well. There are some notes about OSX in the readme, so it might work for you if you follow those instructions. If you can get it working, it's much, much nicer than doc-view.

3
  • Sadly I can't use pdf-tools, as latex-preview-pane only uses doc-view. I've installed ghostscript using homebrew, and pdflatex --version at command line tells me that I have TeX Live 2021 and it's compiled with xpdf version 4.03. So it seems like I have all the dependencies installed, and still the same issue persists.
    – Thain
    Apr 11, 2021 at 13:44
  • Can Emacs see them? Check that the executables are available in one of the C-h v exec-path directories. I've updated the answer to mention this point.
    – phils
    Apr 11, 2021 at 23:28
  • @Thain, as I read code at github.com/jsinglet/latex-preview-pane/blob/master/… It can be easily updated to support pdf-tools. You can raise a issue to the author. Or you can learn Lisp and maintain this package by yourself.
    – chen bin
    May 12, 2021 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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