OpTeX for VSCode
This extension provides support in VSCode for OpTeX. A LuaTeX format based on Plain TeX macros and on OPmac macros. Look at OpTeX project webpage for more info.
This extension aims to make writing OpTeX documents and packages as least as comfortable as writing LaTeX ones, if not better.
If you are writing an OpTeX package with
If not, or you write simple
This extension currently provides:
Syntax highlighting is implemented with a custom TextMate grammar file. Meaning the grammar should be in theory easily adaptable for other editors. (In practice though, working with TextMate Grammar is terrible.)
I have written my grammar from scratch to be as clear and concise as possible. Sometimes the highlighting might seem blunt and inconsistent. Please do not hesitate to leave feedback and report issues in the github repository.
TeX Math highlighting is directly imported from vscode's own grammar for TeX, which is published under MIT license. OpTeX does not make many changes to TeX default math.
Apart from fixing the basic TeX highlighting to include all macros from OpTeX (which might start with and include
⚠️ Note: This extension only provides scopes for syntax highlighting. Actual colors depend purely on your VSCode theme. Please keep in mind not all themes distinguish between the scopes used here. For example, in many themes, internal OpTeX macros appear the same as all other macros.
There are currently 7 smart snippets that could help accelerate your work. The most used blocks are defined:
All snippets use vscode options for jumping your cursor to the parameters for customization.
For easier and usable editing, both the grammar and snippets are written in yaml. Before usage, these files must be converted to json. I used npm js-yaml module, as recommended by vscode guide.
Releases are being documented in the changelog.
Please leave an issue for any feature requests that you would utilize and find yourself missing! Write even if they are written above as that both tells me what to focus on and gives me motivation to implement these features at all.