[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 890163e 26/57: Bring back multi-level script fon
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 890163e 26/57: Bring back multi-level script font-locking |
Date: |
Wed, 11 Jan 2017 18:01:39 +0000 (UTC) |
branch: externals/auctex
commit 890163e3bd40b7f2ca6007050b0db31cddfde378
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>
Bring back multi-level script font-locking
* doc/auctex.texi (Fontification of math): Add documentation.
* font-latex.el (font-latex-script-display): Increase default raise level to
0.5.
(font-latex-superscript-face,font-latex-subscript-face): Let scripts be a
bit
larger (:height 0.85 instead of 0.8).
(font-latex--get-script-props): New function for incrementing/decrementing
raise display property values.
(font-latex-script): Use it.
---
doc/auctex.texi | 8 ++++----
font-latex.el | 27 ++++++++++++++++++++-------
2 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/doc/auctex.texi b/doc/auctex.texi
index e371899..52ecf3d 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -2197,13 +2197,13 @@ If non-nil, fontify subscript and superscript strings.
Concretely, this
means that the scripts are raised or lowered.
Another possiblity is setting this variable to the symbol
address@hidden In this case, in a formula @code{x^y^z}, y is
-raised above x, and z is raised above y. With many script levels, the
-text might become too small to be readable.
address@hidden In this case, in a formula @address@hidden@}}, @i{y} is
+raised above @i{x}, and @i{z} is raised above @i{y}. With many script
+levels, the text might become too small to be readable.
Lastly, you can set this variable to @code{invisible} whose behavior is
like @code{multi-level}, and in addition the super-/subscript characters
address@hidden and @code{_} are not displayed.
address@hidden and @i{_} are not displayed.
Note that this feature is not available on XEmacs, for which
it is disabled per default. In GNU Emacs raising and lowering is not
diff --git a/font-latex.el b/font-latex.el
index 896c6af..a5b501f 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -861,7 +861,10 @@ are equally raised over x.
If this variable is set to the symbol `multi-level', then y is
raised above x, and z is raised above y. With many script
-levels, the text might become too small to be readable.
+levels, the text might become too small to be readable. (The
+factors for text shrinking are defined in the faces
+`font-latex-superscript-face' and `font-latex-subscript-face' and
+the raise/lower factor in `font-latex-script-display'.)
If this variable is set to the symbol `invisible', then the
effect is essentially like `multi-level' but additionally the
@@ -875,7 +878,7 @@ script operators ^ and _ are not displayed."
(or (TeX-booleanp val)
(memq val '(multi-level invisible)))))
-(defcustom font-latex-script-display '((raise -0.3) . (raise 0.3))
+(defcustom font-latex-script-display '((raise -0.5) . (raise 0.5))
"Display specification for subscript and superscript content.
The car is used for subscript, the cdr is used for superscripts."
:group 'font-latex
@@ -1118,12 +1121,12 @@ have changed."
:group 'font-latex-highlighting-faces)
(defface font-latex-superscript-face
- '((t (:height 0.8)))
+ '((t (:height 0.85)))
"Face used for superscripts."
:group 'font-latex-highlighting-faces)
(defface font-latex-subscript-face
- '((t (:height 0.8)))
+ '((t (:height 0.85)))
"Face used for subscripts."
:group 'font-latex-highlighting-faces)
@@ -1951,6 +1954,15 @@ END marks boundaries for searching for quotation ends."
(setq pos (1- pos) odd (not odd)))
odd))))))
+(defun font-latex--get-script-props (script-type old-raise)
+ (let* ((props (copy-list (case script-type
+ (:super (cdr font-latex-script-display))
+ (:sub (car font-latex-script-display)))))
+ (new-raise (plist-get props 'raise)))
+ (if old-raise
+ (plist-put props 'raise (+ old-raise new-raise))
+ props)))
+
;; Copy and adaption of `tex-font-lock-suscript' from tex-mode.el in
;; GNU Emacs on 2004-07-07.
(defun font-latex-script (pos)
@@ -1972,15 +1984,16 @@ END marks boundaries for searching for quotation ends."
;; `font-lock-extra-managed-props' was introduced and serves here
;; for feature checking. XEmacs (CVS and 21.4.15) currently
;; (2004-08-18) does not support this feature.
- (let ((extra-props-flag (boundp 'font-lock-extra-managed-props)))
+ (let* ((extra-props-flag (boundp 'font-lock-extra-managed-props))
+ (old-raise (plist-get (get-text-property pos 'display) 'raise)))
(if (eq (char-after pos) ?_)
(if extra-props-flag
`(face font-latex-subscript-face display
- ,(car font-latex-script-display))
+ ,(font-latex--get-script-props :sub old-raise))
'font-latex-subscript-face)
(if extra-props-flag
`(face font-latex-superscript-face display
- ,(cdr font-latex-script-display))
+ ,(font-latex--get-script-props :super old-raise))
'font-latex-superscript-face)))))
;;; docTeX
- [elpa] externals/auctex a55b66d 07/57: Improve inserting arguments of \captionof macro, (continued)
- [elpa] externals/auctex a55b66d 07/57: Improve inserting arguments of \captionof macro, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex ac02ed2 02/57: Extend test for new column counting code with style files loaded, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex bef4873 22/57: Set `reftex-set-cite-format' to biblatex or natbib, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex c3a21f2 04/57: Print only first line of the message in error overview, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 48d397c 17/57: Add starred version of \citeauthor and \Citeauthor, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 89ea0e4 19/57: Fix name of macros \lcnamecref and \lcnamecrefs, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex bb390fe 18/57: Add fontification for varioref's referencing macros, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 8186490 06/57: Fix documentation of TeX-arg-file, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 01da194 23/57: ; * style/titletoc.el ("titletoc"): Use `TeX-arg-length'., Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 1addc62 30/57: Use RefTeX for multiple citations in biblatex, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 890163e 26/57: Bring back multi-level script font-locking,
Tassilo Horn <=
- [elpa] externals/auctex 5ddbd04 12/57: Add new style/titleps.el, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 225bade 14/57: Add new style/titletoc.el, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 343ca9c 36/57: Fix script unfontification bug, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 501b0de 47/57: Use RefTeX for multiple references in cleveref, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex bfc7e90 16/57: Fix fontification for natbib compat macros, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 1de2359 13/57: Add new style/titlesec.el, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex ccec850 24/57: Remove multi-level/invisible feature of font-latex-fontify-script, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 4c42f7a 25/57: Revert "Remove multi-level/invisible feature of font-latex-fontify-script", Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 4747c24 29/57: Simple docfix, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 69fc320 27/57: Add a newline only if \label is inserted, Tassilo Horn, 2017/01/11