latex comment highlighting

Ken Pierce
2007-06-18
2013-09-18
  • Ken Pierce

    Ken Pierce - 2007-06-18

    Hi there,

    I'm a big fan of npp, but it doesn't seem to highlight comment lines in LaTeX (%). There's no option in the 'Styler Configuration' under TeX for COMMENT LINE. Is there a way to fix this?

    Cheers,
    Ken Pierce.

     
    • Nobody/Anonymous

      My big problem is that most of the highlighting for .tex files turns off when you open a second file in another language (e.g. Matlab, C, etc).  I have to close and re-open notepad++ to get the highlighting back again.  Notepad++ would make a great LaTeX editor, but bugs with the highlighting seriously limit its usefulness.

       
      • Don HO

        Don HO - 2007-06-24

        It'll be fixed in v4.2.

        Don

         
    • MJG

      MJG - 2007-06-18

      You may be able to edit langs.xml and enhance the TeX section to look like one of the other languages.  The version I have already has % as a comment character, but nothing else.  (This might be because I didn't install support for it at installation time.)

      Make backups first!  --Joel

       
    • Ken Pierce

      Ken Pierce - 2007-06-19

      Thanks for the reply Joel,

      I'm not sure what npp is doing internally, but it recognises any \foo as a command and gets braces right, but % is displayed as a symbol and doesn't seem to make the line into a comment. I added the line...

          <WordsStyle name="COMMENT LINE" styleID="6" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />

      ...to stylers.xml with no joy. I'm not sure how styleID works, I just made it the next number within the "tex" element. Has anyone else had a similar problem (even with another language)?

      Cheers,
      Ken.

       
  • Dubrovsky

    Dubrovsky - 2011-02-01

    Definitely the same problem in version 5.8.6. I've also modified "stylers.xml" in "C:\Documents and Settings\&lt;User>\Application Data\Notepad++\"

            <LexerType name="tex" desc="TeX" ext="">
                <WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="F9FED6" fontName="Courier New" fontStyle="0" fontSize="12" />
                <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="" />
                <WordsStyle name="COMMENT" styleID="6" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
            </LexerType>
    

    "%" sign is prescribed in "langs.xml". No result. It is vexing.

     
  • fallino

    fallino - 2013-09-18

    Against any logics, It works by changing DEFAULT color which affects only comments (here in green 008000).
    SYMBOL color affects the % symbol and TEXT color affects the uncommented text.

            <LexerType name="tex" desc="TeX" ext="">
                <WordsStyle name="DEFAULT" styleID="0" fgColor="008000" 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="008000" 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="" />
            </LexerType>
    

    PS : Be sure you modify the right "langs.xml", the one which is taken into account by Notepad++

     
    Last edit: fallino 2013-09-18

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks