1

In org-mode, Latex previews are not loaded at startup when using #+STARTUP: latexpreview. I've also tried customizing org-startup-with-latex-preview with no effect. Only way to preview latex fragment is individually doing so by using C-c C-x C-l

As example I'm using the following org file:

#+STARTUP: showall indent latexpreview entitiespretty
* dfs
* df [2/2]                                                              :prb:
- [X] sdf
- [X] sac
* LaTeX embed:
** \gamma \alpha \beta \theta Caracteres especiales, renderizados con: C-c C-x \ Se hace permanente con #+STARTUP: entitiespretty
** Subscripts M_sun ( =M_sun= ) | Superscripts 2^2 ( =2^2= C-x 8 RET hex RET)
** $a ^2=b$ Previsualizar con =C-c C-x C-l= 
** Previsualizar con =C-c C-x C-l=
\begin{equation}
x=\sqrt{b}
\end{equation}      

Edit: Following tobias advice I checked with emacs -Q which seem to work, but now, I don't know what is it in my emacs init file that is making the previews to fail. Next is my init.el file:

(add-to-list 'load-path' "/home/khamsin/.emacs.d/cc-mode")
(add-to-list 'load-path' "/home/khamsin/.emacs.d/custom")

(setq ring-bell-function 'ignore)
(tool-bar-mode -1)
(menu-bar-mode -1)
(setq inhibit-startup-message t)

(require 'package)
(package-initialize)

;; Activate Solarized theme
(load-theme 'zenburn t)

;; Elpa repositories:
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t) ; Org-mode's repository

;; Acivate Line Numbers
(global-linum-mode 1)

;; Ativate indentation at RET
(global-set-key (kbd "RET") 'newline-and-indent)
;; (define-key c-mode-base-map (kbd "RET") 'newline-and-indent)

;;;;;;;;;; Org require and configuration ;;;;;;;;;;
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)

;; Shift select config
(setq org-support-shift-select t)

;; Org mode margin
(setq-default fill-column 80)
(add-hook 'org-mode-hook 'turn-on-auto-fill)

;; Autopair
(defun autopair-insert-opening ()
     (interactive)
     (when (autopair-pair-p)
       (setq autopair-action (list 'opening (autopair-find-pair) (point))))
     (autopair-fallback))


;; C Style identation
(setq c-default-style "bsd"
          c-basic-offset 4)
(setq-default c-basic-offset 4
                  tab-width 4
                  indent-tabs-mode t)
(add-hook 'c-mode-common-hook '(lambda () (c-toggle-auto-state 1)))

;; Set default font
(set-default-font "Ubuntu Mono-14")

(set-fontset-font "fontset-default"
                  'japanese-jisx0208
                  '("Source Han Sans JP" . "iso10646-1"))

;; Org LaTeX alignment
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(initial-frame-alist (quote ((fullscreen . maximized)))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
  • If you do C-h v org-startup-with-latex-preview RET, what does it say the value of that variable is? – elethan Dec 29 '15 at 22:06
  • @elethan org-startup-with-latex-preview is a variable defined in org.el'. Its value is t Original value was nil Local in buffer prb.org; global value is the same – Andrés Sánchez Dec 29 '15 at 22:08
  • 1
    Working for me with your org-text snippet, emacs -Q version 24.5.1, and orgmode 8.2.10. Only the buffer-local value of org-startup-with-latex-preview is true. Try again with emacs -Q ! This way your personal setup does not interfere. If this works your setup is the culprit. – Tobias Dec 30 '15 at 7:11
  • @Tobias it is working for me too using emacs -Q. I added my init.el file, because reviewing it, I can't find the culprit. Thanks. – Andrés Sánchez Dec 30 '15 at 10:15
  • 1
    Okay, it is time for bisection. First enclose all stuff in your .emacs file into (when nil ...stuff...) and try your thing with emacs (none of the options -q nor -Q). Afterwards shift the (when nil approximately into the middle of the file where it makes sense, e.g., before ;;;;;;;;;; Org require and configuration ;;;;;;;;;; if the error occurs in the second test shift (when nil back to approximately one quarter of the file. This way you should find the culprit quite fast. – Tobias Dec 30 '15 at 17:05
1

I experienced the exact same issue. The proposed "solution" using emacs -Q works (also in my case), because it loads a different version of org-mode, in which the bug with previewlatex does not yet exist. (compare M-x org-version if you start emacs with and without the -Q option).

So this problem is probably not related to the .emacs file. Its probably a bug in newer versions of org-mode (I'm using version 8.3.2).

1

Same issue. If you uninstall the elpa org (8.3.3), emacs will use the built in org (8.2.10). This solves the issue for me.

Note: I'd like to comment on BejaminSchiel's instead of posting an answer but I don't have enough reputation for that.

0

Had the same problem. Uninstalling the org-contrib package fixed this 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.