auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-devel] Re: Fontifying of titles...


From: Reiner Steib
Subject: [AUCTeX-devel] Re: Fontifying of titles...
Date: Thu, 07 Apr 2005 23:14:59 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

On Mon, Apr 04 2005, Ralf Angeli wrote:

> * David Kastrup (2005-04-04) writes:
>> If we get really mad, this could look something like
>>
>> \section{                SECTION TITLE                   }
>>
>> namely centering the beast.

I don't think this would be an improvement.

> I am very satisfied with the current appearance and don't think that
> the suggestions will improve it in any way and I am strongly against
> changing it.

I'm using `height' for `font-latex-fontify-script', but in some
situations, I don't like the appearance:

- When the number of characters in the line (macro plus title) is
  close to my window width.  I.e. with `color', it would fit, but with
  `height' it is wrapped.

- Similar for longish section titles: Two such big lines are too
  heavy.

- When using the optional argument of \section, the result is quite bad:

--8<---------------cut here---------------start------------->8---
\section[Ein nicht ganz so extrem langer Name]{Aber hier kommt der doch etwas
  lang geratene Titel den man nicht kürzen kann}

\section[Ein nicht ganz so extrem langer Name]%
{Aber hier kommt der doch etwas lang geratene Titel den man nicht kürzen kann}
--8<---------------cut here---------------end--------------->8---

  The second example isn't fontified correctly.

- The factor 1.2 seems to be appropriate for `Info-title-*-face', but
  for `font-latex-title-*-face', a smaller factor (say 1.05-1.1) would
  be better.  At least `font-latex-title-1-face' (for \part or
  \chapter) are too large, especially because often another \chapter
  or \section line follows.

Here is a patch that allows `font-latex-title-fontify' to be a number
which is used instead as the scaling factor instead of the default
value (now: 1.2; my suggestion: 1.05-1.1).  Even with 1.05, the titles
stand out enough too make it recognizable easily, I think.

--- font-latex.el       04 Apr 2005 20:06:11 +0200      5.104
+++ font-latex.el       07 Apr 2005 23:11:40 +0200      
@@ -118,6 +118,17 @@
               (regexp-opt (mapcar 'car font-latex-quote-list) t)))
   :group 'font-latex)
 
+(defcustom font-latex-title-fontify 'height
+  "Whether to fontify LaTeX titles with varying height faces or a color face.
+
+If it is a number, use varying height faces scaled with this number.
+Setting this variable does not take effect unless you call
+\\[font-lock-fontify-buffer]."
+  :type '(choice (const height)
+                (number :tag "Scale factor")
+                 (const color))
+  :group 'font-latex)
+
 ;; The definitions of the title faces were originally taken from
 ;; info.el (Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 97, 98, 99,
 ;; 2000, 2001 Free Software Foundation, Inc.) and adapted to the needs
@@ -152,11 +163,12 @@
                              (number-to-string num) ".")
                     :group 'font-latex-highlighting-faces)))
        (eval `(defface ,face-name
-                '((t (:height 1.2 :inherit ,(intern
-                                             (concat
-                                              "font-latex-title-"
-                                              (number-to-string (1+ num))
-                                              "-face")))))
+                '((t (:height ,(if (numberp font-latex-title-fontify)
+                                   font-latex-title-fontify
+                                 1.1)
+                      :inherit ,(intern (concat "font-latex-title-"
+                                                (number-to-string (1+ num))
+                                                "-face")))))
                 ,(concat "Face for LaTeX titles at level "
                          (number-to-string num) ".")
                 :group 'font-latex-highlighting-faces))))))
@@ -185,12 +197,6 @@
   "Face for LaTeX titles at level 4."
   :group 'font-latex-highlighting-faces)
 
-(defcustom font-latex-title-fontify 'height
-  "Whether to fontify LaTeX titles with varying height faces or a color face."
-  :type '(choice (const height)
-                 (const color))
-  :group 'font-latex)
-
 
 ;;; Keywords
 
@@ -349,9 +355,9 @@
         `(,(intern (concat prefix name))
           (0 'font-lock-keyword-face append t)
           (1 'font-lock-variable-name-face append t)
-          (2 (if (eq font-latex-title-fontify 'height)
-                 ',face
-               'font-lock-type-face)
+          (2 (if (eq font-latex-title-fontify 'color)
+                 'font-lock-type-face
+               ',face)
              append t)))
        ((eq type 'noarg)
         `(,(intern (concat prefix name))
Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]