The comment style in TEX language

  • Richard

    Richard - 2011-03-22

    Hi all,

    I'm trying to change the comment line style in TEX language in NPP.

    The comment line begins with a "%" sign in TEX and the default style for TEX only changes the first "%" into some color format and leaves everything else as default text (no color).

    I also notice that when I use CPP language in NPP, as long as I type in "//" for comment, the whole line will change into green color and that, is exactly what I need in a TEX language.

    Could anyone tell me how to do that? I mean, change the whole comment line color in TEX leaded by a "%".

    Thank you very much.


  • cchris

    cchris - 2011-03-23

    By default, the TeX lexer does not process comments.
    Using a macro or scripting language of your choice (with the matching plugin), send Scintilla the SCI_SETPROPERTY message, setting the "lexer.tex.comment.process" property to 1 (true).

    Guess I'll write a wiki page on all those properties in lexers and how to set it in various ways, as more than a few posts here involve them.


  • Richard

    Richard - 2011-03-26

    Hi CChris,

    Thank you for your reply. However, I don't understand scripting language very well. Can I do this in NppEexc by adding some command lines? If yes, what is the code? Or, is there any way that I can achieve this just by change some files in the NPP install folder? Thank you.

  • Georg Stillfried


    Change the stylers.xml file in c:\Users\<user>\AppData\Roaming\Notepad++\ (as described by fallino on

    Change the property "fgcolor" of the "DEFAULT" style (I changed it to grey---808080):

            <LexerType name="tex" desc="TeX" ext="">
                <WordsStyle name="DEFAULT" styleID="0" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
                <WordsStyle name="SPECIAL" styleID="1" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
                <WordsStyle name="GROUP" styleID="2" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
                <WordsStyle name="SYMBOL" styleID="3" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
                <WordsStyle name="COMMAND" styleID="4" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
                <WordsStyle name="TEXT" styleID="5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />

    Worked for me on Windows 7, NPP v6.4.5.