Default Color for User Defined Macros in Emacs
up vote
1
down vote
favorite
When writing tex documents, I often create and include a file that contains a number of user defined macros, e.g., newcommand{pstar}{ensuremath{mathcal{P}^star}}.
I'd like to set up emacs syntax highlighting so that every time I use one of my user defined macros, e.g., pstar, the macro is highlighted in a default color. How can I do this without having to specify a list of my macros up front (as in this answer)?
macros emacs auctex syntax-highlighting
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
up vote
1
down vote
favorite
When writing tex documents, I often create and include a file that contains a number of user defined macros, e.g., newcommand{pstar}{ensuremath{mathcal{P}^star}}.
I'd like to set up emacs syntax highlighting so that every time I use one of my user defined macros, e.g., pstar, the macro is highlighted in a default color. How can I do this without having to specify a list of my macros up front (as in this answer)?
macros emacs auctex syntax-highlighting
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
You are abusingensuremath. See When not to use ensuremath for math macro?
– Henri Menke
Aug 30 at 5:20
You will have to specify a list of macros. Otherwise you'd have to implement a LaTeX parser in Lisp which scans the whole document and anyincluded files for command definitions.
– Henri Menke
Aug 30 at 5:23
Thanks @HenriMenke. Before I started using auctex, I had the syntax highlighting I wanted (although, I didn't have a lot of other things I wanted). But, I'm actually not sure what tool was providing the highlight :). Perhaps it was the oh-my-zsh template I am using. Maybe there is another easy way to highlight expressions that start with a backslash in a default color when in latex mode (unless they are known keywords that already have a specific highlighting pattern).
– akobre01
Aug 30 at 13:16
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
When writing tex documents, I often create and include a file that contains a number of user defined macros, e.g., newcommand{pstar}{ensuremath{mathcal{P}^star}}.
I'd like to set up emacs syntax highlighting so that every time I use one of my user defined macros, e.g., pstar, the macro is highlighted in a default color. How can I do this without having to specify a list of my macros up front (as in this answer)?
macros emacs auctex syntax-highlighting
When writing tex documents, I often create and include a file that contains a number of user defined macros, e.g., newcommand{pstar}{ensuremath{mathcal{P}^star}}.
I'd like to set up emacs syntax highlighting so that every time I use one of my user defined macros, e.g., pstar, the macro is highlighted in a default color. How can I do this without having to specify a list of my macros up front (as in this answer)?
macros emacs auctex syntax-highlighting
macros emacs auctex syntax-highlighting
edited Aug 30 at 4:04
Stefan Pinnow
19.2k83175
19.2k83175
asked Aug 30 at 3:50
akobre01
1062
1062
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
You are abusingensuremath. See When not to use ensuremath for math macro?
– Henri Menke
Aug 30 at 5:20
You will have to specify a list of macros. Otherwise you'd have to implement a LaTeX parser in Lisp which scans the whole document and anyincluded files for command definitions.
– Henri Menke
Aug 30 at 5:23
Thanks @HenriMenke. Before I started using auctex, I had the syntax highlighting I wanted (although, I didn't have a lot of other things I wanted). But, I'm actually not sure what tool was providing the highlight :). Perhaps it was the oh-my-zsh template I am using. Maybe there is another easy way to highlight expressions that start with a backslash in a default color when in latex mode (unless they are known keywords that already have a specific highlighting pattern).
– akobre01
Aug 30 at 13:16
add a comment |
You are abusingensuremath. See When not to use ensuremath for math macro?
– Henri Menke
Aug 30 at 5:20
You will have to specify a list of macros. Otherwise you'd have to implement a LaTeX parser in Lisp which scans the whole document and anyincluded files for command definitions.
– Henri Menke
Aug 30 at 5:23
Thanks @HenriMenke. Before I started using auctex, I had the syntax highlighting I wanted (although, I didn't have a lot of other things I wanted). But, I'm actually not sure what tool was providing the highlight :). Perhaps it was the oh-my-zsh template I am using. Maybe there is another easy way to highlight expressions that start with a backslash in a default color when in latex mode (unless they are known keywords that already have a specific highlighting pattern).
– akobre01
Aug 30 at 13:16
You are abusing
ensuremath. See When not to use ensuremath for math macro?– Henri Menke
Aug 30 at 5:20
You are abusing
ensuremath. See When not to use ensuremath for math macro?– Henri Menke
Aug 30 at 5:20
You will have to specify a list of macros. Otherwise you'd have to implement a LaTeX parser in Lisp which scans the whole document and any
included files for command definitions.– Henri Menke
Aug 30 at 5:23
You will have to specify a list of macros. Otherwise you'd have to implement a LaTeX parser in Lisp which scans the whole document and any
included files for command definitions.– Henri Menke
Aug 30 at 5:23
Thanks @HenriMenke. Before I started using auctex, I had the syntax highlighting I wanted (although, I didn't have a lot of other things I wanted). But, I'm actually not sure what tool was providing the highlight :). Perhaps it was the oh-my-zsh template I am using. Maybe there is another easy way to highlight expressions that start with a backslash in a default color when in latex mode (unless they are known keywords that already have a specific highlighting pattern).
– akobre01
Aug 30 at 13:16
Thanks @HenriMenke. Before I started using auctex, I had the syntax highlighting I wanted (although, I didn't have a lot of other things I wanted). But, I'm actually not sure what tool was providing the highlight :). Perhaps it was the oh-my-zsh template I am using. Maybe there is another easy way to highlight expressions that start with a backslash in a default color when in latex mode (unless they are known keywords that already have a specific highlighting pattern).
– akobre01
Aug 30 at 13:16
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
It is possible to do what you're asking for, but I'm not recommending it. Hence, I show 2 solutions:
Not recommended solution
I presume you're not byte-compiling your init file. Put this function somewhere in your init file:
(defun LaTeX-fontify-parsed-macros ()
"Add fontification support for parsed macros by AUCTeX."
(let ((TeX-grop-string (string-to-char TeX-grop))
macs macname args)
;; Process elements from `LaTeX-auto-optional' which look like
;; ("PSTAR" "1" "x")
(dolist (mac LaTeX-auto-optional)
(setq macname (car mac)
args (string-to-number (cadr mac)))
(push (list macname (concat LaTeX-optop
(make-string (1- args)
TeX-grop-string)))
macs))
;; Process elements from `LaTeX-auto-arguments' which look like
;; ("PStar" "1")
(dolist (mac LaTeX-auto-arguments)
(setq macname (car mac)
args (string-to-number (cadr mac)))
(push (list macname (make-string args TeX-grop-string))
macs))
;; Process only string elements from `TeX-auto-symbol' and ignore
;; lists inside the list
(dolist (mac TeX-auto-symbol)
(unless (listp mac)
(push (list mac "") macs)))
;; Fontify the macros:
(when (and macs
(featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords macs
'textual)) ))
Now in your .tex file, add this line to your file local variables at the end of the file:
%%% eval: (add-hook 'TeX-update-style-hook #'LaTeX-fontify-parsed-macros t)
It should look like this:
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% eval: (add-hook 'TeX-update-style-hook #'LaTeX-fontify-parsed-macros t)
%%% End:
Now hit C-c C-n, and you should get proper fontification for your macros.
Recommended solution
Move your definitions into a separate package, say mymathmacros.sty which looks like this:
ProvidesPackage{mymathmacros}
newcommand{pstar}{ensuremath{mathcal{P}^star}}
newcommand{Pstar}{ensuremath{mathcal{P}^star}}
newcommand{PStar}[1]{ensuremath{mathcal{P}^star}}
newcommand{PSTar}[1][x]{ensuremath{mathcal{P}^star}}
newcommand{PSTAR}[3][x]{ensuremath{mathcal{P}^star}}
endinput
Customize the variable TeX-style-private to a directory of your choice, e.g. with a line like this in your init file:
(setq TeX-style-private (expand-file-name "~/.emacs.d/my-auctex-styles/"))
Save this piece of code in that directory as mymathmacros.el:
(TeX-add-style-hook
"mymathmacros"
(lambda ()
;; Macros:
(TeX-add-symbols
'("pstar" 0)
'("Pstar" 0)
'("PStar" 1)
'("PSTar" [ "argument" ] 1)
'("PSTAR" [ "argument" ] 2))
;; Fontification:
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-lock-add-keywords '(("pstar" "")
("Pstar" "")
("PStar" "{")
("PSTar" "[{")
("PSTAR" "[{{"))
'textual)))
LaTeX-dialect)
Restart your Emacs, add the line usepackage{mymathmacros} to your .tex file and hit C-c C-n, if necessary.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
It is possible to do what you're asking for, but I'm not recommending it. Hence, I show 2 solutions:
Not recommended solution
I presume you're not byte-compiling your init file. Put this function somewhere in your init file:
(defun LaTeX-fontify-parsed-macros ()
"Add fontification support for parsed macros by AUCTeX."
(let ((TeX-grop-string (string-to-char TeX-grop))
macs macname args)
;; Process elements from `LaTeX-auto-optional' which look like
;; ("PSTAR" "1" "x")
(dolist (mac LaTeX-auto-optional)
(setq macname (car mac)
args (string-to-number (cadr mac)))
(push (list macname (concat LaTeX-optop
(make-string (1- args)
TeX-grop-string)))
macs))
;; Process elements from `LaTeX-auto-arguments' which look like
;; ("PStar" "1")
(dolist (mac LaTeX-auto-arguments)
(setq macname (car mac)
args (string-to-number (cadr mac)))
(push (list macname (make-string args TeX-grop-string))
macs))
;; Process only string elements from `TeX-auto-symbol' and ignore
;; lists inside the list
(dolist (mac TeX-auto-symbol)
(unless (listp mac)
(push (list mac "") macs)))
;; Fontify the macros:
(when (and macs
(featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords macs
'textual)) ))
Now in your .tex file, add this line to your file local variables at the end of the file:
%%% eval: (add-hook 'TeX-update-style-hook #'LaTeX-fontify-parsed-macros t)
It should look like this:
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% eval: (add-hook 'TeX-update-style-hook #'LaTeX-fontify-parsed-macros t)
%%% End:
Now hit C-c C-n, and you should get proper fontification for your macros.
Recommended solution
Move your definitions into a separate package, say mymathmacros.sty which looks like this:
ProvidesPackage{mymathmacros}
newcommand{pstar}{ensuremath{mathcal{P}^star}}
newcommand{Pstar}{ensuremath{mathcal{P}^star}}
newcommand{PStar}[1]{ensuremath{mathcal{P}^star}}
newcommand{PSTar}[1][x]{ensuremath{mathcal{P}^star}}
newcommand{PSTAR}[3][x]{ensuremath{mathcal{P}^star}}
endinput
Customize the variable TeX-style-private to a directory of your choice, e.g. with a line like this in your init file:
(setq TeX-style-private (expand-file-name "~/.emacs.d/my-auctex-styles/"))
Save this piece of code in that directory as mymathmacros.el:
(TeX-add-style-hook
"mymathmacros"
(lambda ()
;; Macros:
(TeX-add-symbols
'("pstar" 0)
'("Pstar" 0)
'("PStar" 1)
'("PSTar" [ "argument" ] 1)
'("PSTAR" [ "argument" ] 2))
;; Fontification:
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-lock-add-keywords '(("pstar" "")
("Pstar" "")
("PStar" "{")
("PSTar" "[{")
("PSTAR" "[{{"))
'textual)))
LaTeX-dialect)
Restart your Emacs, add the line usepackage{mymathmacros} to your .tex file and hit C-c C-n, if necessary.
add a comment |
up vote
0
down vote
It is possible to do what you're asking for, but I'm not recommending it. Hence, I show 2 solutions:
Not recommended solution
I presume you're not byte-compiling your init file. Put this function somewhere in your init file:
(defun LaTeX-fontify-parsed-macros ()
"Add fontification support for parsed macros by AUCTeX."
(let ((TeX-grop-string (string-to-char TeX-grop))
macs macname args)
;; Process elements from `LaTeX-auto-optional' which look like
;; ("PSTAR" "1" "x")
(dolist (mac LaTeX-auto-optional)
(setq macname (car mac)
args (string-to-number (cadr mac)))
(push (list macname (concat LaTeX-optop
(make-string (1- args)
TeX-grop-string)))
macs))
;; Process elements from `LaTeX-auto-arguments' which look like
;; ("PStar" "1")
(dolist (mac LaTeX-auto-arguments)
(setq macname (car mac)
args (string-to-number (cadr mac)))
(push (list macname (make-string args TeX-grop-string))
macs))
;; Process only string elements from `TeX-auto-symbol' and ignore
;; lists inside the list
(dolist (mac TeX-auto-symbol)
(unless (listp mac)
(push (list mac "") macs)))
;; Fontify the macros:
(when (and macs
(featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords macs
'textual)) ))
Now in your .tex file, add this line to your file local variables at the end of the file:
%%% eval: (add-hook 'TeX-update-style-hook #'LaTeX-fontify-parsed-macros t)
It should look like this:
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% eval: (add-hook 'TeX-update-style-hook #'LaTeX-fontify-parsed-macros t)
%%% End:
Now hit C-c C-n, and you should get proper fontification for your macros.
Recommended solution
Move your definitions into a separate package, say mymathmacros.sty which looks like this:
ProvidesPackage{mymathmacros}
newcommand{pstar}{ensuremath{mathcal{P}^star}}
newcommand{Pstar}{ensuremath{mathcal{P}^star}}
newcommand{PStar}[1]{ensuremath{mathcal{P}^star}}
newcommand{PSTar}[1][x]{ensuremath{mathcal{P}^star}}
newcommand{PSTAR}[3][x]{ensuremath{mathcal{P}^star}}
endinput
Customize the variable TeX-style-private to a directory of your choice, e.g. with a line like this in your init file:
(setq TeX-style-private (expand-file-name "~/.emacs.d/my-auctex-styles/"))
Save this piece of code in that directory as mymathmacros.el:
(TeX-add-style-hook
"mymathmacros"
(lambda ()
;; Macros:
(TeX-add-symbols
'("pstar" 0)
'("Pstar" 0)
'("PStar" 1)
'("PSTar" [ "argument" ] 1)
'("PSTAR" [ "argument" ] 2))
;; Fontification:
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-lock-add-keywords '(("pstar" "")
("Pstar" "")
("PStar" "{")
("PSTar" "[{")
("PSTAR" "[{{"))
'textual)))
LaTeX-dialect)
Restart your Emacs, add the line usepackage{mymathmacros} to your .tex file and hit C-c C-n, if necessary.
add a comment |
up vote
0
down vote
up vote
0
down vote
It is possible to do what you're asking for, but I'm not recommending it. Hence, I show 2 solutions:
Not recommended solution
I presume you're not byte-compiling your init file. Put this function somewhere in your init file:
(defun LaTeX-fontify-parsed-macros ()
"Add fontification support for parsed macros by AUCTeX."
(let ((TeX-grop-string (string-to-char TeX-grop))
macs macname args)
;; Process elements from `LaTeX-auto-optional' which look like
;; ("PSTAR" "1" "x")
(dolist (mac LaTeX-auto-optional)
(setq macname (car mac)
args (string-to-number (cadr mac)))
(push (list macname (concat LaTeX-optop
(make-string (1- args)
TeX-grop-string)))
macs))
;; Process elements from `LaTeX-auto-arguments' which look like
;; ("PStar" "1")
(dolist (mac LaTeX-auto-arguments)
(setq macname (car mac)
args (string-to-number (cadr mac)))
(push (list macname (make-string args TeX-grop-string))
macs))
;; Process only string elements from `TeX-auto-symbol' and ignore
;; lists inside the list
(dolist (mac TeX-auto-symbol)
(unless (listp mac)
(push (list mac "") macs)))
;; Fontify the macros:
(when (and macs
(featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords macs
'textual)) ))
Now in your .tex file, add this line to your file local variables at the end of the file:
%%% eval: (add-hook 'TeX-update-style-hook #'LaTeX-fontify-parsed-macros t)
It should look like this:
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% eval: (add-hook 'TeX-update-style-hook #'LaTeX-fontify-parsed-macros t)
%%% End:
Now hit C-c C-n, and you should get proper fontification for your macros.
Recommended solution
Move your definitions into a separate package, say mymathmacros.sty which looks like this:
ProvidesPackage{mymathmacros}
newcommand{pstar}{ensuremath{mathcal{P}^star}}
newcommand{Pstar}{ensuremath{mathcal{P}^star}}
newcommand{PStar}[1]{ensuremath{mathcal{P}^star}}
newcommand{PSTar}[1][x]{ensuremath{mathcal{P}^star}}
newcommand{PSTAR}[3][x]{ensuremath{mathcal{P}^star}}
endinput
Customize the variable TeX-style-private to a directory of your choice, e.g. with a line like this in your init file:
(setq TeX-style-private (expand-file-name "~/.emacs.d/my-auctex-styles/"))
Save this piece of code in that directory as mymathmacros.el:
(TeX-add-style-hook
"mymathmacros"
(lambda ()
;; Macros:
(TeX-add-symbols
'("pstar" 0)
'("Pstar" 0)
'("PStar" 1)
'("PSTar" [ "argument" ] 1)
'("PSTAR" [ "argument" ] 2))
;; Fontification:
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-lock-add-keywords '(("pstar" "")
("Pstar" "")
("PStar" "{")
("PSTar" "[{")
("PSTAR" "[{{"))
'textual)))
LaTeX-dialect)
Restart your Emacs, add the line usepackage{mymathmacros} to your .tex file and hit C-c C-n, if necessary.
It is possible to do what you're asking for, but I'm not recommending it. Hence, I show 2 solutions:
Not recommended solution
I presume you're not byte-compiling your init file. Put this function somewhere in your init file:
(defun LaTeX-fontify-parsed-macros ()
"Add fontification support for parsed macros by AUCTeX."
(let ((TeX-grop-string (string-to-char TeX-grop))
macs macname args)
;; Process elements from `LaTeX-auto-optional' which look like
;; ("PSTAR" "1" "x")
(dolist (mac LaTeX-auto-optional)
(setq macname (car mac)
args (string-to-number (cadr mac)))
(push (list macname (concat LaTeX-optop
(make-string (1- args)
TeX-grop-string)))
macs))
;; Process elements from `LaTeX-auto-arguments' which look like
;; ("PStar" "1")
(dolist (mac LaTeX-auto-arguments)
(setq macname (car mac)
args (string-to-number (cadr mac)))
(push (list macname (make-string args TeX-grop-string))
macs))
;; Process only string elements from `TeX-auto-symbol' and ignore
;; lists inside the list
(dolist (mac TeX-auto-symbol)
(unless (listp mac)
(push (list mac "") macs)))
;; Fontify the macros:
(when (and macs
(featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords macs
'textual)) ))
Now in your .tex file, add this line to your file local variables at the end of the file:
%%% eval: (add-hook 'TeX-update-style-hook #'LaTeX-fontify-parsed-macros t)
It should look like this:
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% eval: (add-hook 'TeX-update-style-hook #'LaTeX-fontify-parsed-macros t)
%%% End:
Now hit C-c C-n, and you should get proper fontification for your macros.
Recommended solution
Move your definitions into a separate package, say mymathmacros.sty which looks like this:
ProvidesPackage{mymathmacros}
newcommand{pstar}{ensuremath{mathcal{P}^star}}
newcommand{Pstar}{ensuremath{mathcal{P}^star}}
newcommand{PStar}[1]{ensuremath{mathcal{P}^star}}
newcommand{PSTar}[1][x]{ensuremath{mathcal{P}^star}}
newcommand{PSTAR}[3][x]{ensuremath{mathcal{P}^star}}
endinput
Customize the variable TeX-style-private to a directory of your choice, e.g. with a line like this in your init file:
(setq TeX-style-private (expand-file-name "~/.emacs.d/my-auctex-styles/"))
Save this piece of code in that directory as mymathmacros.el:
(TeX-add-style-hook
"mymathmacros"
(lambda ()
;; Macros:
(TeX-add-symbols
'("pstar" 0)
'("Pstar" 0)
'("PStar" 1)
'("PSTar" [ "argument" ] 1)
'("PSTAR" [ "argument" ] 2))
;; Fontification:
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-lock-add-keywords '(("pstar" "")
("Pstar" "")
("PStar" "{")
("PSTar" "[{")
("PSTAR" "[{{"))
'textual)))
LaTeX-dialect)
Restart your Emacs, add the line usepackage{mymathmacros} to your .tex file and hit C-c C-n, if necessary.
answered Sep 12 at 19:31
Arash Esbati
5,1781824
5,1781824
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f448439%2fdefault-color-for-user-defined-macros-in-emacs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You are abusing
ensuremath. See When not to use ensuremath for math macro?– Henri Menke
Aug 30 at 5:20
You will have to specify a list of macros. Otherwise you'd have to implement a LaTeX parser in Lisp which scans the whole document and any
included files for command definitions.– Henri Menke
Aug 30 at 5:23
Thanks @HenriMenke. Before I started using auctex, I had the syntax highlighting I wanted (although, I didn't have a lot of other things I wanted). But, I'm actually not sure what tool was providing the highlight :). Perhaps it was the oh-my-zsh template I am using. Maybe there is another easy way to highlight expressions that start with a backslash in a default color when in latex mode (unless they are known keywords that already have a specific highlighting pattern).
– akobre01
Aug 30 at 13:16