latex - emacs AUCTeX macros fontification -


i started using excellent package xargs provides \newcommandx. shares syntax similar default \newcommand. font-lock reflect this. did

(custom-set-variables  '(font-latex-user-keyword-classes    (quote (("cx" ("newcommandx" "*|{\\[[{")         (:family "font-lock-type-face") command))))) 

but fontifies command name itself, not body (\newcommand fontifies body 'font-lock-function-name-face, in case bold). want \newcommandx fontify body 'font-lock-function-name-face.

to summarize question: how make fontification \newcommandx same \newcommand (i.e. bold body in case)?

here example can modify suit needs. see lines 280 436 of font-latex.el within auctex-11.86 complete list of predefined keywords. following examples used add additional keywords, and/or define own coloration contents of wavy / square brackets.

;; \effect{[font-lock-function-name-face]} (setq font-latex-match-function-keywords     '(         ("newcommandx" "*|{\\[[{")     )  )   ;; \effect{[font-lock-constant-face]} (setq font-latex-match-reference-keywords     '(         ("fancypagestyle" "[{")         ("fancyhead" "[{")         ("fancyfoot" "[{")     )  )   ;; \effect{[font-lock-type-face]} (setq font-latex-match-textual-keywords     '(         ("parentext" "{")         ("hybridblockquote" "[{")         ("parskip" "")         ("footskip" "")     ) )   ;; \effect{[font-lock-variable-name-face]} (setq font-latex-match-variable-keywords     '(         ("newgeometry" "[{")         ("quotingsetup" "[{")         ("tabpositions" "[{")         ("rfoot" "")     ) )   ;; \font-latex-warning-face (setq font-latex-match-warning-keywords     '(         ("fixme" "{")      ) )   ;; affects inside wavy brackets (setq font-latex-user-keyword-classes           '(("my-warning-commands"                 (("fixme" "{"))                 (:foreground "purple" :background "yellow")                 command))) 

see also: http://www.gnu.org/software/auctex/manual/auctex/fontification-of-macros.html


i have chosen following method customize of special keywords:

(defvar lawlist-face-01 (make-face 'lawlist-face-01)) (set-face-background 'lawlist-face-01 "black") (set-face-foreground 'lawlist-face-01 "white") (set-face-bold-p 'lawlist-face-01 t) (set-face-italic-p 'lawlist-face-01 t) (set-face-underline-p 'lawlist-face-01 t) (set-face-underline 'lawlist-face-01 "yellow")  (defvar lawlist-face-02 (make-face 'lawlist-face-02)) (set-face-attribute 'lawlist-face-02 nil :background "gray" :foreground "red" :font "courier" :height 180 :bold t :underline "yellow" :italic t)  (font-lock-add-keywords 'latex-mode '( ("\\\\test01\\|insert\\|bugs\\|fixme\\|todo\\|and\\|or\\|not" 0 lawlist-face-01 prepend) ;; 0 = highlight ("\\\\test02\\|insert\\|document-name\\|\\\\begin{document}" 0 lawlist-face-02 prepend) ;; 0 = highlight ("\\test01{\\([^}]*\\)}" 1 lawlist-face-02 prepend) ;; 1 = colorize contents of wavy brackets )) 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -