Kilecolored parameters in user command (\newcommand)

Information and discussion about Kile, an integrated LaTeX environment for Linux KDE
Post Reply
jphv
Posts: 5
Joined: Wed Aug 12, 2009 8:22 pm

colored parameters in user command (\newcommand)

Post by jphv »

Hello, I don't know how to make this that I help me when I use Kile:

The parameter inside {} get blue in:
\ref{fig:somelabel}

If I create a new command, when I use it, Kile don't highlight the parameter. Example:
%New command
\newcommand{\verfig}[1]{(\mbox{Fig. \ref{#1}})}

%Use
\verfig{fig:somelabel}

But I want...
\verfig{fig:somelabel}

If I could get the same behavior like \ref{} my references would be easiest to find it in the whole text.


I've search and didn't find something like this in the forum.
Thanks for you time.
Last edited by jphv on Thu Aug 13, 2009 1:28 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: colored parameters in user command (\newcommand)

Post by frabjous »

I've never tried this, but there are some instructions here:

http://www.latex-community.org/forum/vi ... f=20&t=206

(The syntax color-highlighting settings for Kile are based on the editor on which Kile is based, Kate... and you need to edit its rules.)
jphv
Posts: 5
Joined: Wed Aug 12, 2009 8:22 pm

colored parameters in user command (\newcommand)

Post by jphv »

frabjous wrote:I've never tried this, but there are some instructions here:

http://www.latex-community.org/forum/vi ... f=20&t=206

(The syntax color-highlighting settings for Kile are based on the editor on which Kile is based, Kate... and you need to edit its rules.)

Yes! Thanks! 8-)
I don't know why didn't find that post when did my search...

At this moment I'm working in a proyect under Ubuntu, so the configuration file latex.xml is at /usr/share/apps/katepart/syntax/

It was necessary only one change.

Original line:
<RegExpr String="\\(label|pageref|ref|vpageref|vref|cite)(?=[^a-zA-Z])" attribute="Structure" context="Label"/>

Line updated:
<RegExpr String="\\(label|pageref|ref|vpageref|vref|cite|verfig)(?=[^a-zA-Z])" attribute="Structure" context="Label"/>


Thank you again frabjous!!!
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: colored parameters in user command (\newcommand)

Post by frabjous »

No problem. And thanks for posting the details of your example. It'll make it that much easier if I ever decide to fiddle with my own settings.
Post Reply