Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Let say I created the following command in my latex document

\newcommand{\red}[1]{
  \textcolor{red}{#1}
}

When working with the LaTeX editor Kile, the autocompletion gives me something like

\red{x} %[Proposed by Kile (autocompletion)] 

But instead of 'x', I would like Kile propose to me something like

\red{text} %[Proposed by Kile (autocompletion)]

That could be useful when I have to deal with commands requiring a bunch of arguments. For instance, if I created a command using \newcommand requiring 8 arguments, the autocompletion of kile will propose to me something like :

\mycommand{x}{x}{x}{x}{x}{x}{x}{x} %[Proposed by Kile (autocompletion)]

...but after some times, you do not know who is who! So it would be nice to define 'argument names' so that the autocompletion propose to me something like :

\mycommand{date}{name}{stuff1}{stuff2}{age}{address}{city}{whateveritis} %[Proposed by Kile (autocompletion)]

To summarize, I would like to change this :

http://i.stack.imgur.com/oIJss.png

to this :

http://i.stack.imgur.com/9eXMg.png

share|improve this question
    
Welcome to TeX.sx! –  Andrew Swann Nov 2 '12 at 10:52
    
I'm afraid I don't understand what this has to do with auto-completion. As defined by you, the command \red takes a single argument -- be it a single letter ("x") or a longer string ("text") -- while the command \mycommand would appear to take eight separate arguments. TeX's syntax rules determine what constitutes a separate argument. –  Mico Nov 2 '12 at 11:07
    
Thank you Mico for your comments.I may have not well explained what I'm really looking for. I enhance my question accordingly. Let me know if it makes more sense. –  Palimpseste Nov 2 '12 at 11:40
    
I think that your question is not clear and I can't figure out what the problem is –  karathan Nov 2 '12 at 11:42
    
I put the word "kile" in the title as I think it's necessary to make that clear right from the start. –  Loop Space Nov 2 '12 at 12:02

1 Answer 1

This can be achieved by creating a custom auto completion file. Such a file has the extension cwl and (on my systom) has to be saved under ~/.kde4/share/apps/kile/completion/tex. The # is a comment char in such a file. In such a file you write the commands with the text you want to appear in the arguments.

# custom auto-completion file
#

\mycommand{date}{name}{stuff1}{stuff2}{age}{address}{city}{whateveritis}

After a restart of kile it can be activated through Settings -> Configure Kile -> Kile/Complete -> Add (or similar, it's German on my system).

img: adding the file

After that it works like a standard auto completion:

img: the auto completion

share|improve this answer
    
Thank you! The Path is Settings -> Configure Kile -> Kile/Complete -> Add.. and it works fine –  Palimpseste Nov 2 '12 at 13:55
    
@Palimpseste Glad it works! If my answer helped you you might want to consider upvoting/accepting it. –  cgnieder Nov 2 '12 at 14:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.