Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get rid of some font effects

107 views
Skip to first unread message

Michaël Grünewald

unread,
Oct 1, 2007, 1:43:00 PM10/1/07
to
Hi all,

I find some font attributes very annoying and I would like to turn
them globally off. More precisely I would like to allow only colour
change and bold face, and disallow any other stuff, like size change
or underline. Is there any way to do this?

In the same vein, is there any way to globally disallow vertical
shifting of text? Being very specific, tex-mode shifts superscript and
subscript material vertically, and I find this inadequate. Is there
any clean way to turn this off? I have found this in tex-mode.el:

(defun tex-font-lock-suscript (pos)
(unless (or (memq (get-text-property pos 'face)
'(font-lock-constant-face font-lock-builtin-face
font-lock-comment-face tex-verbatim))
;; Check for backslash quoting
(let ((odd nil)
(pos pos))
(while (eq (char-before pos) ?\\)
(setq pos (1- pos) odd (not odd)))
odd))
(if (eq (char-after pos) ?_)
'(face subscript display (raise -0.3))
'(face superscript display (raise +0.3)))))

(defun tex-font-lock-match-suscript (limit)
"Match subscript and superscript patterns up to LIMIT."
(when (re-search-forward "[_^] *\\([^\n\\{}]\\|\
\\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t)
(when (match-end 3)
(let ((beg (match-beginning 3))
(end (save-restriction
(narrow-to-region (point-min) limit)
(condition-case nil (scan-lists (point) 1 1) (error nil)))))
(store-match-data (if end
(list (match-beginning 0) end beg end)
(list beg beg beg beg)))))
t))

I guess I can patch these functions in my dot.elisp file, but I would
not call this `clean'.

At a last resort, emacs -nw is a viable solution, anyway...
--
Thanks in advance for any help,
best wishes,
Michaël

Stefan Monnier

unread,
Oct 10, 2007, 12:18:53 PM10/10/07
to
> In the same vein, is there any way to globally disallow vertical
> shifting of text? Being very specific, tex-mode shifts superscript and
> subscript material vertically, and I find this inadequate. Is there
> any clean way to turn this off? I have found this in tex-mode.el:

You can play with font-lock-maximum-decoration (the super/subscript in
latex-mode are only enabled with the very top decoration level).


Stefan

Michaël Grünewald

unread,
Oct 14, 2007, 5:05:47 PM10/14/07
to
Stefan Monnier <mon...@iro.umontreal.ca> writes:

Thank you for the tip. Meanwhile, I have used this *ugly* thing:

(require 'tex-mode)


(defun tex-font-lock-suscript (pos)
(unless (or (memq (get-text-property pos 'face)
'(font-lock-constant-face font-lock-builtin-face
font-lock-comment-face tex-verbatim))
;; Check for backslash quoting
(let ((odd nil)
(pos pos))
(while (eq (char-before pos) ?\\)
(setq pos (1- pos) odd (not odd)))
odd))
(if (eq (char-after pos) ?_)

'(face subscript display (raise -0.0))
'(face superscript display (raise +0.0)))))

(see the nullified raise parameters?)

I am very happy to remove that from my dot.emacs file. Thank you
again!
--
Best wishes,
Michaël

Stefan Monnier

unread,
Oct 17, 2007, 2:12:38 PM10/17/07
to
>>> In the same vein, is there any way to globally disallow vertical
>>> shifting of text? Being very specific, tex-mode shifts superscript and
>>> subscript material vertically, and I find this inadequate. Is there
>>> any clean way to turn this off? I have found this in tex-mode.el:
>>
>> You can play with font-lock-maximum-decoration (the super/subscript in
>> latex-mode are only enabled with the very top decoration level).

> Thank you for the tip. Meanwhile, I have used this *ugly* thing:

> (require 'tex-mode)
> (defun tex-font-lock-suscript (pos)
> (unless (or (memq (get-text-property pos 'face)
> '(font-lock-constant-face font-lock-builtin-face
> font-lock-comment-face tex-verbatim))
> ;; Check for backslash quoting
> (let ((odd nil)
> (pos pos))
> (while (eq (char-before pos) ?\\)
> (setq pos (1- pos) odd (not odd)))
> odd))
> (if (eq (char-after pos) ?_)
> '(face subscript display (raise -0.0))
> '(face superscript display (raise +0.0)))))

You could also just remove the " display (raise -0.0)" parts.
In Emacs-CVS (and maybe in Emacs-22.2 as well), you can just configure
tex-font-script-display instead.


Stefan

Michaël Grünewald

unread,
Nov 10, 2007, 1:56:58 AM11/10/07
to
Stefan Monnier <mon...@iro.umontreal.ca> writes:

> You could also just remove the " display (raise -0.0)" parts.
> In Emacs-CVS (and maybe in Emacs-22.2 as well), you can just configure
> tex-font-script-display instead.

Thanks for the tip; I did not find `tex-font-script-display' in
customize-variable.
--
Best regards,
Michaël

paul.m...@gmail.com

unread,
Mar 16, 2012, 4:44:25 PM3/16/12
to
It's actually even easier. Just set font-latex-fontify-script to nil.
0 new messages