diff options
| author | Reiner Steib | 2007-07-09 19:14:48 +0000 |
|---|---|---|
| committer | Reiner Steib | 2007-07-09 19:14:48 +0000 |
| commit | 2b1567a532c70cf9bd729aa0b5b0a2f8121ca78e (patch) | |
| tree | d8cf110d3ad56fa8d73fe88fbbd276ef50ec9234 /lisp/textmodes | |
| parent | ccbbae2c439f132be89e4203cde8803da7beab25 (diff) | |
| download | emacs-2b1567a532c70cf9bd729aa0b5b0a2f8121ca78e.tar.gz emacs-2b1567a532c70cf9bd729aa0b5b0a2f8121ca78e.zip | |
(tex-fontify-script)
(tex-font-script-display): New variables to make display of
superscripts and subscripts customizable.
(tex-font-lock-suscript, tex-font-lock-match-suscript): Use them.
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 5757100468b..034caeee702 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -243,6 +243,21 @@ Normally set to either `plain-tex-mode' or `latex-mode'." | |||
| 243 | :options '("''" "\">" "\"'" ">>" "»") | 243 | :options '("''" "\">" "\"'" ">>" "»") |
| 244 | :group 'tex) | 244 | :group 'tex) |
| 245 | 245 | ||
| 246 | (defcustom tex-fontify-script t | ||
| 247 | "If non-nil, fontify subscript and superscript strings." | ||
| 248 | :type 'boolean | ||
| 249 | :group 'tex) | ||
| 250 | (put 'tex-fontify-script 'safe-local-variable 'booleanp) | ||
| 251 | |||
| 252 | (defcustom tex-font-script-display '(-0.3 . 0.3) | ||
| 253 | "Display specification for subscript and superscript content. | ||
| 254 | The car is used for subscript, the cdr is used for superscripts." | ||
| 255 | :group 'tex | ||
| 256 | :type '(cons (choice (float :tag "Subscript") | ||
| 257 | (const :tag "No lowering" nil)) | ||
| 258 | (choice (float :tag "Superscript") | ||
| 259 | (const :tag "No raising" nil)))) | ||
| 260 | |||
| 246 | (defvar tex-last-temp-file nil | 261 | (defvar tex-last-temp-file nil |
| 247 | "Latest temporary file generated by \\[tex-region] and \\[tex-buffer]. | 262 | "Latest temporary file generated by \\[tex-region] and \\[tex-buffer]. |
| 248 | Deleted when the \\[tex-region] or \\[tex-buffer] is next run, or when the | 263 | Deleted when the \\[tex-region] or \\[tex-buffer] is next run, or when the |
| @@ -593,13 +608,14 @@ An alternative value is \" . \", if you use a font with a narrow period." | |||
| 593 | (setq pos (1- pos) odd (not odd))) | 608 | (setq pos (1- pos) odd (not odd))) |
| 594 | odd)) | 609 | odd)) |
| 595 | (if (eq (char-after pos) ?_) | 610 | (if (eq (char-after pos) ?_) |
| 596 | '(face subscript display (raise -0.3)) | 611 | `(face subscript display (raise ,(car tex-font-script-display))) |
| 597 | '(face superscript display (raise +0.3))))) | 612 | `(face superscript display (raise ,(cdr tex-font-script-display)))))) |
| 598 | 613 | ||
| 599 | (defun tex-font-lock-match-suscript (limit) | 614 | (defun tex-font-lock-match-suscript (limit) |
| 600 | "Match subscript and superscript patterns up to LIMIT." | 615 | "Match subscript and superscript patterns up to LIMIT." |
| 601 | (when (re-search-forward "[_^] *\\([^\n\\{}]\\|\ | 616 | (when (and tex-fontify-script |
| 602 | \\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t) | 617 | (re-search-forward "[_^] *\\([^\n\\{}]\\|\ |
| 618 | \\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t)) | ||
| 603 | (when (match-end 3) | 619 | (when (match-end 3) |
| 604 | (let ((beg (match-beginning 3)) | 620 | (let ((beg (match-beginning 3)) |
| 605 | (end (save-restriction | 621 | (end (save-restriction |