Hi, It would seem there is a bug in turn-on-org-cdlatex whenever _ or ^ is called. And perhaps others.
To reproduce: bash> emacs -q In *scratch* #+begin_src emacs-lisp ;; adjust the two following lines to your system (load-file "/usr/share/emacs/site-lisp/auctex/texmathp.el") (load-file "~/.emacs.d/elpa/cdlatex-4.0/cdlatex.el") (require 'cdlatex) (add-hook 'org-mode-hook 'turn-on-org-cdlatex) (switch-to-buffer "test.org") #+end_src Then M-x org-mode #+begin_src org * test insert `$' then `x' then `_' then `1', i.e. $x_1$ #+end_src I get the following backtrace Debugger entered--Lisp error: (void-variable last-command-char) (char-to-string last-command-char) (concat (char-to-string last-command-char) "{") (string= (buffer-substring (max (point-min) (- (point) 2)) (point)) (concat (char-to-string last-command-char) "{")) (if (string= (buffer-substring (max (point-min) (- (point) 2)) (point)) (concat (char-to-string last-command-char) "{")) (progn (backward-char 1) (insert last-command-char) (forward-char 1)) (insert last-command-char) (insert "{}") (forward-char -1)) (if (cdlatex-number-of-backslashes-is-odd) (insert last-command-char) (if (not (texmathp)) (cdlatex-dollar)) (if (string= (buffer-substring (max (point-min) (- (point) 2)) (point)) (concat (char-to-string last-command-char) "{")) (progn (backward-char 1) (insert last-command-char) (forward-char 1)) (insert last-command-char) (insert "{}") (forward-char -1))) cdlatex-sub-superscript() call-interactively(cdlatex-sub-superscript) org-cdlatex-underscore-caret(nil) call-interactively(org-cdlatex-underscore-caret nil nil) System: GNU Emacs 24.1.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.4) of 2012-08-02 on rasmus Org-mode version 7.8.11 (release_7.8.11-338-gecba55 @ /usr/share/emacs/site-lisp/org/) -- In theory, practice and theory are the same. In practice they are not