4 ms·
Author hasn’t tried to highlight TeX. Which is good for their mental health, I suppose, as it’s generally impossible to fully highlight TeX without interpreting
by murkt 2y ago
Author hasn’t tried to highlight TeX. Which is good for their mental health, I suppose, as it’s generally impossible to fully highlight TeX without interpreting it.
Even parsing is not enough, as it’s possible to redefine what each character does. You can make it do things like “and now K means { and C means }”.
Yes, you can find papers on arXiv that use this god-forsaken feature.
- jart 2y agoI wrote https://github.com/Mozilla-Ocho/llamafile/blob/main/llamafile/highlight_tex.cpp https://github.com/Mozilla-Ocho/llamafile/blob/main/llamafil... and it does a reasonable job highlighting without breaking for all the .tex files I could find on my hard drive. My goal is to hopefully cover 99.9% of real world usage, since that'll likely cover everything an LLM might output. Esoteric syntax also usually isn't a problem, so long as it doesn't cause strings and comments to extend forever, eclipsing the rest of the source code in a file.
- murkt 2y agoYes, when goal isn’t to support 100% of all the weird stuff, then it’s orders of magnitude easier!
- nathell 2y agoSame with Common Lisp (you can redefine the read table), although that’s likely abused less often on arXiv.
- bobbylarrybobby 2y agoI couldn't believe it when I learned that \makeatletter does not “make (something) at a letter (character)” but rather “treats the '@' character as a letter when parsing”.