I use Mathjax for math equations within an html document. Mathjax uses Latex commands within the document to add equations. I would like to assign a color to Latex commands such as \begin and \end. I think this involves building a new syntax and scope and assigning a color to that scope. However, I haven’t figured out the steps in order to do that. Can someone help.
Color highlight latex commands within html file
If you just want to highlight latex within HTML content it is as easy as creating a Packages/User/HTML (MathJax).sublime-syntax with the following content.
%YAML 1.2
---
name: HTML (MathJax)
scope: text.html.mathjax
file_extensions:
- html
- htm
- shtml
- xhtml
contexts:
main:
- include: scope:text.tex.latex
- include: scope:text.html.basic
That worked. Both HTML and LaTex commands are highlighted. One small problem is that my html file icons have disappeared.
You can override the normal HTML file by renaming top-level scope to text.html.basic
.
Unfortunatelly A File Icon can’t override normal file_type_markup
which is bound to text.html
due to a shortcomming (https://github.com/sublimehq/sublime_text/issues/4107)
I’ve been trying to get brackethighlighter to work in an html file with syntax HTML (MathJax). I added “HTML (MathJax)” to the list of syntaxes under “mode”: “html” in bh_tag.sublime-settings. It still doesn’t highlight or match html tags. Any suggestions would be appreciated.
[Problem Solved] See solution
Is it possible to use two syntaxes/themes at the same time?