Function: LaTeX-section-section

LaTeX-section-section is a byte-compiled function defined in latex.el.

Signature

(LaTeX-section-section)

Documentation

Hook to insert LaTeX section command into the file.

Insert this hook into LaTeX-section-hook after those hooks that set the LaTeX-name, LaTeX-title, and LaTeX-toc variables, but before those hooks that assume that the section is already inserted.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun LaTeX-section-section ()
  "Hook to insert LaTeX section command into the file.
Insert this hook into `LaTeX-section-hook' after those hooks that
set the `LaTeX-name', `LaTeX-title', and `LaTeX-toc' variables,
but before those hooks that assume that the section is already
inserted."
  ;; insert a new line if the current line and the previous line are
  ;; not empty (except for whitespace), with one exception: do not
  ;; insert a new line if the previous (or current, sigh) line starts
  ;; an environment (i.e., starts with `[optional whitespace]\begin')
  (unless (save-excursion
            (re-search-backward
             (concat "^\\s-*\n\\s-*\\=\\|^\\s-*" (regexp-quote TeX-esc)
                     "begin")
             (line-beginning-position 0) t))
    (LaTeX-newline))
  (insert TeX-esc LaTeX-name)
  (cond ((null LaTeX-toc))
        ((zerop (length LaTeX-toc))
         (insert LaTeX-optop)
         (set-marker LaTeX-done-mark (point))
         (insert LaTeX-optcl))
        (t
         (insert LaTeX-optop LaTeX-toc LaTeX-optcl)))
  (insert TeX-grop)
  (if (zerop (length LaTeX-title))
      (set-marker LaTeX-done-mark (point)))
  (insert LaTeX-title TeX-grcl)
  (LaTeX-newline)
  ;; If RefTeX is available, tell it that we've just made a new section
  (and (fboundp 'reftex-notice-new-section)
       (reftex-notice-new-section)))