开发者

Emacs uses dvi2tty instead of evince to open dvi

开发者 https://www.devze.com 2023-01-04 14:29 出处:网络
I started to use emacs for LateX editing again. Back in the days, it was configured automatically that C-c C-f would open the corresponding *.dvi file with evince. With the latest version of开发者_开发

I started to use emacs for LateX editing again. Back in the days, it was configured automatically that C-c C-f would open the corresponding *.dvi file with evince. With the latest version of开发者_开发知识库 emacs, it does not do the same. Is there a way to open the doc with evince? (I am sure there is a way. It is emacs afterall).

Thanks!


I use this code with auctex-mode:

;; use evince for dvi and pdf viewer
;; evince-dvi backend should be installed
(setq TeX-view-program-selection
      '((output-dvi "DVI Viewer")
        (output-pdf "PDF Viewer")
        (output-html "Google Chrome")))
(setq TeX-view-program-list
      '(("DVI Viewer" "evince %o")
        ("PDF Viewer" "evince %o")
        ("Google Chrome" "google-chrome %o")))

You didn't mention if you're using auctex-mode or the old latex-mode that comes bundled with Emacs.


Depending on whether you are using AUCTeX or emacs' default LaTeX mode there are different configuration options to set this. I would suggest you have a look at them with customize-browse since the config strings can be pretty dense.

With AUCTeX

Browse to Emacs > Wp > Tex > AUCTeX > Tex Command > TeX View > TeX View Program Selection. Change the output-dvi viewer.

Plain LaTeX mode Browser to Emacs > Wp > Tex > Tex View > Tex Dvi View Command.

Also, instead of directly hardcoding evince I would suggest putting xdg-open there and configuring your preferred dvi-viewer in your desktop environment. Then you need to worry about only one place to configure this in the future.


I had the same problem even with the correct settings for view commands. I had started the Emacs daemon from a shell inside screen. I then connected to the server with emacsclient using an X window. AucTeX checks two settings to see if you're using a window system and both are nil or undefined (the $DISPLAY variable and (window-system)) inside screen where I started the server.

So in my case, starting the Emacs daemon from a shell running in an X window solved the problem.

I guess it would help if AucTeX checked the variables for each Emacs frame separately because it shouldn't matter where the server was started but what kind of client (tty or X) you use AucTeX in.

0

精彩评论

暂无评论...
验证码 换一张
取 消