1

Just started using Emacs for editing my .tex documents after a long time away. I am rusty.

I installed auctex and setup my environment nicely. Most things are working, but the fly in the ointment is this pesky preview-latex mode. I can't seem to switch this ugly mess off. I am using latex-preview-pane in the right panel, so am able to view the PDF. I just want to see the actual unformatted (except by me) text without any preview elements in the left panel. Right now, I have a LaTeXised form of \dagger showing up where my \cite strings should be, my superscripts are showing up as (ugly) superscripts in the text window, I{} showing up for \textit{}, triangles at \begin \end sequences, etc. I just need the plain text of my document back, no interpreted crap added.

I have tried to use the Emacs menu to switch this disgusting stuff off Preview>Remove previews>from document (also tried from buffer). It does not remove this junk.

How do I disable preview-latex?

My .emacs:

(package-initialize)
(prefer-coding-system 'utf-8)
(add-to-list 'load-path "~/Private/etc/emacsd/")
(pdf-tools-install)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'TeX-mode-hook 'zotelo-minor-mode)
(add-hook 'LaTeX-mode-hook 'latex-preview-pane-mode)
(add-hook 'LaTeX-mode-hook #'rainbow-delimiters-mode)
(add-hook 'LaTeX-mode-hook 'magic-latex-buffer)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(setq TeX-PDF-mode t)
(setq bibtex-completion-pdf-field "file")

;;Eliminates the necessity for the save command before compilation is completed
(setq TeX-save-query nil)

;;Function that combines two commands 1. revert pdfoutput buffer 2. pdf-outline
(defun my-TeX-revert-document-buffer (file)
  (TeX-revert-document-buffer file)
  (pdf-outline))

;; Add custom function to the TeX compilation hook
(add-hook 'TeX-after-compilation-finished-functions #'my-TeX-revert-document-buffer)
6
  • For someone who seems very annoyed by all this “disgusting stuff”, you seem to be including a lot of things in your .emacs. Did you try removing frivolous embellishment frobbers like this magic-latex-buffer, maybe? AFAICS, you are blaming preview-latex for things it has nothing to do with (that you added yourself!).
    – frougon
    Dec 20 '19 at 10:24
  • @frougon Thanks! Removing that did the trick for some of the mess. As I mentioned, I am rusty with emacs. I copied a recommended .emacs file online. I still have superscripts I can't seem to lose. Like $4^{\circ}$ shows up as a Latexised version with \circ in small and raised like a superscript would be. Is there any way to switch this junk completely off in auctex? Dec 20 '19 at 10:34
  • Try (setq font-latex-fontify-script nil). With a .emacs containing only (add-to-list 'load-path "/path/to/auctex") (require 'tex-site) (setq font-latex-fontify-script nil), this works. After changing the value, either restart Emacs or use M-x revert-buffer.
    – frougon
    Dec 20 '19 at 10:57
  • That worked. Thanks! I still have strangely increased font sizes for the section and subsection names, but I can live with that. Sigh. You just ask for nice syntax highlighting, and auctex hands you its own impressionistic understanding of LaTeX rendered as ASCII :) Dec 20 '19 at 11:00
  • Yeah, it does a bit too much sometimes (see for instance here, which should work but is not quite up-to-date with respect to my setup anymore). I haven't researched the chapter/section/etc. font... yet.
    – frougon
    Dec 20 '19 at 11:03
2

The “annoyances” mentioned in the question are not due to preview-latex. They can be fixed by:

  1. Not using (add-hook 'LaTeX-mode-hook 'magic-latex-buffer) (presumably responsible for the triangles, dagger, etc., see magic-latex-buffer);

  2. Adding (setq font-latex-fontify-script nil) to the Emacs initialization file (~/.emacs, ~/.emacs.el or ~/.emacs.d/init.el) in order to tell AUCTeX not to raise mathematical superscripts nor lower subscripts in the source code.

In order to see the result after changing the value of font-latex-fontify-script, you can:

  • either save your buffer and use M-x revert-buffer if you did a “live test” with M-: (setq font-latex-fontify-script nil)(there are probably other ways to trigger the refontification);

  • or restart Emacs if you did the change in your Emacs initialization file.

0

The original question was how to disable preview-latex. The simplest way is not to load preview-latex.el by for example commenting-out the second line of the recommended configuration:

 (load "auctex.el" nil t t)
 ;;(load "preview-latex.el" nil t t)

This works for me.

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.