Results 1 to 6 of 6

Thread: Changing Kate syntax highlighting (Font & Colors schema)

  1. #1
    Join Date
    Mar 2009
    Beans
    232

    Changing Kate syntax highlighting (Font & Colors schema)

    I'm using a dark theme (Obsidian Coast) which is making things a pain to read using the default LaTeX syntax highlighting and color schema of Kate. I can edit the schema just fine, but that does not affect the colors of certain highlighting features, such as the color of expressions which fill in the ellipses of "\section{...}", which turn out black or "\begin{...}" which turn out dark blue.

    Is there any way to fine-tune the highlighting features of a particular kind of markup (LaTeX in my case)?

  2. #2
    Join Date
    Jan 2009
    Location
    Maryland, USA
    Beans
    242
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Changing Kate syntax highlighting (Font & Colors schema)

    You have to edit the kate's syntax highlighting. In Ubuntu the files are located at /usr/share/kde4/apps/katepart/syntax/. I don't know where they are in kubuntu. According to kate's website it should be located in $KDEDIR/share/apps/katepart/syntax, If $KDEDIR is empty just run...
    Code:
    kde-config --prefix
    You should open a file called latex.xml in the directory. For example if you want to change the color of begin, look at line ~8 you should see...
    Code:
     <RegExpr String="\\begin(?=[^a-zA-Z])" attribute="Structure" context="FindEnvironment" beginRegion="block" />
    You'll notice that the attribute="Structure". Near the bottom (~line 428 ) of the file you should see an itemData whose name="Structure"...
    Code:
    <itemData name="Structure" defStyleNum="dsNormal" color="#F00000" selColor="#80FFD0" bold="0" italic="0"/>
    ...and notice the color="#F00000". Change the color's value to whatever you want to.

  3. #3
    Join Date
    Mar 2009
    Beans
    232

    Re: Changing Kate syntax highlighting (Font & Colors schema)

    Thanks very much. The folder location is the same (usr/share/...) in Kubuntu. (The location ~/.kde/share/apps/katepart exists but is empty.) Now it's just a matter of editing the latex.xml and replacing all dark colors with something appropriate.

    Thanks again!

  4. #4
    Join Date
    Jun 2005
    Location
    Framingham, MA
    Beans
    190
    Distro
    Kubuntu Development Release

    Re: Changing Kate syntax highlighting (Font & Colors schema)

    Quote Originally Posted by nortexoid View Post
    Thanks very much. The folder location is the same (usr/share/...) in Kubuntu. (The location ~/.kde/share/apps/katepart exists but is empty.) Now it's just a matter of editing the latex.xml and replacing all dark colors with something appropriate.

    Thanks again!
    I think you can copy the latex.xml to the ~/.kde/share/apps/katepart directory and edit it there, and kate will use that version. That way you don't need to edit the system version and don't need sudo to do it.
    (Intel Core i7 860, 2x2GB, Gigabyte GA-P55-UD3L, Radeon HD 4550, Audigy2 ZS Platinum, Sonata) + Asus V6J + Lenovo IdeaPad U330
    YOU can make Kubuntu Lucid a solid distro | My Blog

  5. #5
    Join Date
    Mar 2009
    Beans
    232

    Re: Changing Kate syntax highlighting (Font & Colors schema)

    Quote Originally Posted by GameManK View Post
    I think you can copy the latex.xml to the ~/.kde/share/apps/katepart directory and edit it there, and kate will use that version. That way you don't need to edit the system version and don't need sudo to do it.
    That worked like a charm. I placed a copy of /usr/share/kde4/apps/katepart/syntax/latex.xml in ~/.kde/share/apps/katepart/syntax/ and then edited it exactly as I wanted.

    Thanks again.

  6. #6
    Join Date
    Mar 2009
    Beans
    232

    Re: Changing Kate syntax highlighting (Font & Colors schema)

    Quote Originally Posted by rCXer View Post
    You have to edit the kate's syntax highlighting. In Ubuntu the files are located at /usr/share/kde4/apps/katepart/syntax/. I don't know where they are in kubuntu. According to kate's website it should be located in $KDEDIR/share/apps/katepart/syntax, If $KDEDIR is empty just run...
    Code:
    kde-config --prefix
    You should open a file called latex.xml in the directory. For example if you want to change the color of begin, look at line ~8 you should see...
    Code:
     <RegExpr String="\\begin(?=[^a-zA-Z])" attribute="Structure" context="FindEnvironment" beginRegion="block" />
    You'll notice that the attribute="Structure". Near the bottom (~line 428 ) of the file you should see an itemData whose name="Structure"...
    Code:
    <itemData name="Structure" defStyleNum="dsNormal" color="#F00000" selColor="#80FFD0" bold="0" italic="0"/>
    ...and notice the color="#F00000". Change the color's value to whatever you want to.
    So actually that didn't quite work. The problem is that the the the stuff in certain command options is very dark blue or black. E.g. in \begin{proof}, 'proof' is dark blue. And in \section{Introduction}, 'Introduction' is black. There doesn't seem to be anything in the default latex.xml file that allows one to change this. Is there something under <itemDatas> I can add to adjust those colors?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •