blefloch / latex-unravel

Watching TeX digest tokens
24 stars 1 forks source link

Make use of color capabilities of the terminal #3

Closed blefloch closed 5 years ago

blefloch commented 9 years ago

On my terminal, running

pdftex -8bit '\message{normal\pdfunescapehex{1B5B}1;9;34mFANCY\pdfunescapehex{1B5B}mnormal}'

Gives me "normalFANCYnormal" with "FANCY" written in bold blue font and crossed through. It would sometimes be very useful to have colors distinguishing category codes of tokens, or underlining different macro parameters, etc.

blefloch commented 9 years ago

This probably interacts badly with line-wrapping. It could be done in a post-processing step, or by doubling the line-length and replacing each character by two characters, the first indicating the style.

blefloch commented 5 years ago

Thinking some more, this is really hard. On the one hand it can only work in some terminals and engines (e.g. pdfTeX and XeTeX need to be called with the -8bit flag). On the other hand, the current architecture of unravel doesn't allow to have independently a display version and a real version of the input, previous tokens, and output.

Probably not worth it.