--- latex.el 30 Dec 2012 19:47:08 +0100 5.476 +++ latex.el 02 Jan 2013 13:02:43 +0100 @@ -764,7 +764,10 @@ (defun LaTeX-env-document (&optional ignore) "Create new LaTeX document. The compatibility argument IGNORE is ignored." - (TeX-insert-macro "documentclass") + (save-excursion + (unless (re-search-backward "^\\\\documentclass.*{" nil t) + (TeX-insert-macro "documentclass"))) (LaTeX-newline) (LaTeX-newline) (LaTeX-newline)