Function: TeX-arg-length
TeX-arg-length is a byte-compiled function defined in latex.el.
Signature
(TeX-arg-length OPTIONAL &optional PROMPT DEFAULT INITIAL-INPUT DEFINITION)
Documentation
Prompt for a LaTeX length.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
string. DEFAULT is passed to completing-read, which see. If
INITIAL-INPUT is non-nil, insert it in the minibuffer initially,
with point positioned at the end. If DEFINITION is non-nil, the
length is added to the list of defined length.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun TeX-arg-length (optional &optional prompt default initial-input
definition)
"Prompt for a LaTeX length.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
string. DEFAULT is passed to `completing-read', which see. If
INITIAL-INPUT is non-nil, insert it in the minibuffer initially,
with point positioned at the end. If DEFINITION is non-nil, the
length is added to the list of defined length."
(let ((length
(completing-read
(TeX-argument-prompt optional
;; Cater for the case when PROMPT and
;; DEFAULT are both given. Note that we
;; can't use `format-prompt' here:
(if (and prompt default)
(concat prompt " (default " default ")")
prompt)
(concat "Length"
(when (and default (not optional))
(concat " (default " default ")"))))
;; A valid length can be a macro or a length of the form
;; <value><dimension>. Input starting with a `\' can be
;; completed with length macros.
(mapcar (lambda (elt) (concat TeX-esc (car elt)))
(LaTeX-length-list))
;; Some macros takes as argument only a length macro (e.g.,
;; `\setlength' in its first argument, and `\newlength'), in
;; this case is convenient to set `\\' as initial input.
nil nil initial-input nil default)))
(if (and definition (not (zerop (length length))))
;; Strip leading TeX-esc from macro name
(LaTeX-add-lengths (substring length 1)))
(TeX-argument-insert length optional)))