auctex-devel
[Top][All Lists]
Advanced

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

[AUCTeX-devel] TeX-fold Additional macros


From: Masayuki Ataka
Subject: [AUCTeX-devel] TeX-fold Additional macros
Date: Wed, 17 Jan 2007 19:57:20 +0900 (JST)

Hi,

I wrote a patch to add more macros to fold.
My patch is consist of 3 parts.

1. Additional macros (display text ... TeX command)
 - [f] ... \marginpar
 - [r] ... \eqref
 - [i] ... \glossary

2. macros for text
 - (C) ... \copyright
 - (R) ... \textregistered
 - TM  ... \texttrademark

3. macros for math symbols
 greek letters and math symbols are displaied by utf chars
 using the relations of symbols and commands in LaTeX-math-default.

If no objection, I'll get this in CVS trunk.
Comments and discussions are welcom!

regards,
---
email: address@hidden
Name:: Masayuki Ataka // (Japan)

--- tex-fold.el 29 12 2006 22:40:19 +0900       1.54
+++ tex-fold.el 17  1 2007 19:46:03 +0900       
@@ -68,12 +68,40 @@
              (const :tag "Comments" comment))
   :group 'TeX-fold)
 
+(defvar TeX-fold-macro-spec-text-list
+  '(("(C)" ("copyright"))
+    ("(R)" ("textregistered"))
+    ("TM"  ("texttrademark")))
+  "List of display strings and text macros to fold.")
+
+(defvar TeX-fold-macro-spec-utf-math-list nil
+  "List of display strings and math macros to fold.")
+(unless TeX-fold-macro-spec-utf-math-list
+  (setq TeX-fold-macro-spec-utf-math-list
+       (delete nil
+               (mapcar (lambda (elt)
+                         (let ((tex-token (nth 1 elt))
+                               (submenu   (nth 2 elt))
+                               (unicode   (nth 3 elt))
+                               uchar noargp)
+                           (when (integerp unicode) (setq uchar (decode-char 
'ucs unicode)))
+                           (when (listp submenu) (setq submenu (nth 1 
submenu)))
+                           (setq noargp
+                                 (not (string-match
+                                       (concat "^" (regexp-opt '("Constructs" 
"Accents")))
+                                       submenu)))
+                           (when (and (stringp tex-token) (integerp uchar) 
noargp)
+                             `(,(char-to-string uchar) (,tex-token)))))
+                       `((nil "to" "" 8594)
+                         (nil "gets" "" 8592)
+                         ,@LaTeX-math-default)))))
+
 (defcustom TeX-fold-macro-spec-list
-  '(("[f]" ("footnote"))
+  `(("[f]" ("footnote" "marginpar"))
     ("[c]" ("cite"))
     ("[l]" ("label"))
-    ("[r]" ("ref" "pageref"))
-    ("[i]" ("index"))
+    ("[r]" ("ref" "pageref" "eqref"))
+    ("[i]" ("index" "glossary"))
     ("*" ("item"))
     ("..." ("dots"))
     (1 ("part" "chapter" "section" "subsection" "subsubsection"
@@ -81,7 +109,9 @@
        "part*" "chapter*" "section*" "subsection*" "subsubsection*"
        "paragraph*" "subparagraph*"
        "emph" "textit" "textsl" "textmd" "textrm" "textsf" "texttt"
-       "textbf" "textsc" "textup")))
+       "textbf" "textsc" "textup"))
+    ,@TeX-fold-macro-spec-text-list
+    ,@TeX-fold-macro-spec-utf-math-list)
   "List of display strings and macros to fold."
   :type '(repeat (group (choice (string :tag "Display String")
                                (integer :tag "Number of argument" :value 1))




reply via email to

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