Function: TeX-font

TeX-font is an interactive and byte-compiled function defined in tex.el.

Signature

(TeX-font REPLACE WHAT)

Documentation

Insert template for font change command.

If REPLACE is not nil, replace current font. WHAT determines the font to use, as specified by TeX-font-list.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-font (replace what)
  "Insert template for font change command.
If REPLACE is not nil, replace current font.  WHAT determines the font
to use, as specified by `TeX-font-list'."
  (interactive "*P\nc")
  (TeX-update-style)
  (let* ((entry (assoc what TeX-font-list))
         (in-math (texmathp))
         (before (nth 1 entry))
         (after (nth 2 entry)))
    (setq replace (or replace (eq t (nth 3 entry)) (eq t (nth 5 entry))))
    (if (and in-math (stringp (nth 3 entry)))
        (setq before (nth 3 entry)
              after (nth 4 entry)))
    (cond ((null entry)
           (let ((help (concat
                        "Font list:   "
                        "KEY        TEXTFONT           MATHFONT\n\n"
                        (mapconcat #'TeX-describe-font-entry
                                   TeX-font-list "\n"))))
             (with-output-to-temp-buffer "*Help*"
               (set-buffer "*Help*")
               (insert help))))
          (replace
           (funcall TeX-font-replace-function before after))
          ((TeX-active-mark)
           (save-excursion
             (cond ((> (mark) (point))
                    (insert before)
                    (goto-char (mark))
                    (insert after))
                   (t
                    (insert after)
                    (goto-char (mark))
                    (insert before)))))
          (t
           (insert before)
           (save-excursion
             (insert after))))))