1
  • Operating system: Ubuntu 14.04
  • Emacs version: GNU Emacs 25.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8) of 2015-03-12 onlcy01-03
  • AUCTeX version: AUCTeX-version is a variable defined in `tex-site.el'. Its value is "2015-03-08"

Here is a screenshot of what I mean:

enter image description here

The tab button cause the first line after \[ to -2 indent and then \] to do another -2 indent. It was causing this behavior with the cases environment as well, but I was able to stop it by adding ("cases" LaTeX-indent-tabular) to '(LaTeX-indent-environment-list. I tried adding ("displaymath" current-indentation) but this didn't solve the problem.

;; Start server and set directory
(setq server-socket-dir (format "/tmp/emacs1000"))
;; Not sure if (useruid) does anything or the difference between
;; (server-start) and '(server-mode t) in custom
;(setq server-socket-dir (format "/tmp/emacs1000" (user-uid)))
;(server-start)

;; Package initialize
(package-initialize)

;; Package list M-x package-list-packages
(require 'package)
(add-to-list 'package-archives 
         '("marmelade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives 
         '("melpa" . "http://melpa.milkbox.net/packages/"))
(add-to-list 'package-archives 
         '("elpa" . "http://tromey.com/elpa/"))

;; AucTex & RefTeX
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/")
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTex t)
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(setq TeX-save-query nil)

;; Copy and paste between Emac   instances     
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)

;; Disablin autosave                                                           
(setq auto-save-default nil)

;; Adjusting tab distance
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)

;; Enable Line Numbering
(setq line-number-mode t)
(setq column-number-mode t)

;; Set the fill column
(setq default-fill-column 80)

;; Turn on Auto Fill mode automatically in all modes
;; Auto-fill-mode the the automatic wrapping of lines and insertion of
;; newlines when the cursor goes over the column limit.
;; This should actually turn on auto-fill-mode by default in all major
;; modes. The other way to do this is to turn on the fill for specific modes
;; via hooks.  
(setq auto-fill-mode 1)

;;  Turn on visual line mode
(global-visual-line-mode t)

;; Prevent Emacs from making backup files
(setq make-backup-files nil)

;; Cleverref setup
(eval-after-load
    "latex"
  '(TeX-add-style-hook
    "cleveref"
    (lambda ()
      (if (boundp 'reftex-ref-style-alist)
      (add-to-list
       'reftex-ref-style-alist
       '("Cleveref" "cleveref"
         (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
      (add-to-list 'reftex-ref-style-default-list "Cleveref")
      (TeX-add-symbols
       '("cref" TeX-arg-ref)
       '("Cref" TeX-arg-ref)
       '("cpageref" TeX-arg-ref)
       '("Cpageref" TeX-arg-ref)))))

;; Latexmk setup
(defun run-latexmk ()
  (interactive)
  (let ((TeX-save-query nil)
        (TeX-process-asynchronous nil)
        (master-file (TeX-master-file)))
    (TeX-save-document "")
    (TeX-run-TeX "latexmk"
         (TeX-command-expand "latexmk -pdf %s" 'TeX-master-file)
                 master-file))
  (if (plist-get TeX-error-report-switches (intern master-file))
      (TeX-next-error t)
    (progn
      (demolish-tex-help)
      (minibuffer-message "latexmk: done."))))

(add-hook 'LaTeX-mode-hook 
      (lambda ()
        (push 
         '("Latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
           :help "Run Latexmk on file")
         TeX-command-list)))

;; Set okular to open with C-c C-v view option 
(setq TeX-view-program-list
      '(("Okular" "okular --unique %u")))
(setq TeX-view-program-selection '((output-pdf "Okular")))

;; Paren checking
(load "paren")
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)

;; Adaptive wrap
;(require 'adaptive-wrap)

(when (fboundp 'adaptive-wrap-prefix-mode)
  (defun my-activate-adaptive-wrap-prefix-mode ()
    "Toggle `visual-line-mode' and `adaptive-wrap-prefix-mode' simultaneously."
    (if visual-line-mode
        (adaptive-wrap-prefix-mode 1)
      (adaptive-wrap-prefix-mode -1)))
  (add-hook 'visual-line-mode-hook 'my-activate-adaptive-wrap-prefix-mode))

(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.
 '(LaTeX-indent-environment-list
   (quote
    (("verbatim" current-indentation)
     ("verbatim*" current-indentation)
     ("tabular" LaTeX-indent-tabular)
     ("tabular*" LaTeX-indent-tabular)
     ("align" LaTeX-indent-tabular)
     ("align*" LaTeX-indent-tabular)
     ("array" LaTeX-indent-tabular)
     ("eqnarray" LaTeX-indent-tabular)
     ("eqnarray*" LaTeX-indent-tabular)
     ("displaymath" current-indentation)
     ("equation")
     ("equation*")
     ("picture")
     ("tabbing")
     ("table")
     ("table*")
     ("cases" LaTeX-indent-tabular))))
 '(TeX-PDF-mode t)
 '(TeX-newline-function (quote newline-and-indent))
 '(TeX-show-compilation t)
 '(TeX-source-correlate-method (quote synctex))
 '(TeX-source-correlate-mode t)
 '(TeX-view-program-list (quote (("Okular" "okular -unique %o#src:%n%b"))))
 '(TeX-view-program-selection (quote ((output-pdf "Okular"))))
 '(compilation-auto-jump-to-first-error t)
 '(inhibit-startup-screen t)
 '(ispell-lazy-highlight nil)
 '(package-selected-packages (quote (rainbow-delimiters adaptive-wrap auto-indent-mode)))
 '(server-mode t))
(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.
 )

Additionally, synctex has stopped working as well. I have in my ~\.latexmkrc

$pdflatex = 'pdflatex --shell-escape -interaction=nonstopmode -file-line-error -synctex=1' %O %S;

so I am not quite sure with what has cause synctex to stop working. All these problems started to occur when I setup emacs, AUCTeX, and Latexmk on a different laptop. I used the same configuration settings but they only work properly on the other computer.

2
  • It's the effect of a recent addition to AUCTeX, this has also been reported here debbugs.gnu.org/cgi/bugreport.cgi?bug=20227 I'll have a look in the following days.
    – giordano
    Mar 30, 2015 at 5:41
  • @giordano okay so it wasn't just me. Thanks. I am glad to see you answer questions here as well.
    – dustin
    Mar 30, 2015 at 13:24

1 Answer 1

1

The problem with indentation of \[...\] should have been fixed with this commit: http://git.savannah.gnu.org/gitweb/?p=auctex.git;a=commitdiff;h=c2f6e9c4ad208ebddadd42a0314a59503399d00f You can apply the patch locally or wait for the AUCTeX package in GNU Elpa to be updated.

5
  • So a simple git clone/pull should do it then?
    – dustin
    Mar 30, 2015 at 14:26
  • If you use AUCTeX git version yes of course, I thought you used the Elpa package but perhaps I'm wrong ;-)
    – giordano
    Mar 30, 2015 at 14:27
  • I use git. I just applied it. I will restart emacs and see what happens.
    – dustin
    Mar 30, 2015 at 14:28
  • It worked. Do you have any insight on my question about synctex?
    – dustin
    Mar 30, 2015 at 14:29
  • Not for the time being, sorry, but I suggest you to ask as a separate question.
    – giordano
    Mar 30, 2015 at 14:35

Your Answer

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

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