Some TeX Developments

Coding in the TeX world

Background colouring in TeXworks

with 4 comments

The current experimental builds of TeXworks now include the ability to alter the background colour of text, as well as the foreground. At the moment, you can’t do this in an additive fashion (varying the two independently). However, it does make it easy to have something a bit nicer than the default bright red for comments. I’ve altered my syntax-patterns.txt file for LaTeX to read

[LaTeX]
# special characters
darkred		N	[$#^_{}&]

# LaTeX environments
darkgreen	N	\\(?:begin|end)\s*\{[^}]*\}

# LaTeX packages
darkblue	N	\\usepackage\s*(?:\[[^]]*\]\s*)?\{[^}]*\}

# control sequences
blue		N	\\(?:[A-Za-z@]+|.)

# comments
black/lightgrey			Y	%.*

You’ll see that the last line includes two colours, so I get black on light grey for comments.

Written by Joseph Wright

November 13th, 2009 at 8:34 am

Posted in TeXworks

4 Responses to 'Background colouring in TeXworks'

Subscribe to comments with RSS or TrackBack to 'Background colouring in TeXworks'.

  1. Hi, thanks for the post that’s very helpful.
    But there is one thing I don’t understand. What do the Letters N or Y mean? Couldn’t find anything in the wiki.

    david

    13 Nov 09 at 12:22 pm

  2. Hi, thanks for the post that’s very helpful.
    But there is one thing I don’t understand. What do the Letters N or Y mean? Couldn’t find anything in the wiki. I am asking because I would like to add something for “TODO” or “FIXME”.

    david

    13 Nov 09 at 12:24 pm

  3. Hello David,

    This is a flag for spell-checking. So it’s turned on for comments (which will mainly be text), but off for command names and so on.

    Joseph

    Joseph Wright

    13 Nov 09 at 12:30 pm

  4. At your hint, I made an extension of this file for emphasizing tasks. Perhaps it helps.

    Just add two lines before the comments line:

    # tasks
    red Y %TODO:.*

    Mathias

    13 Nov 09 at 4:31 pm

Leave a Reply