Let say I created the following command in my latex document


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 :


to this :


  • 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. – Andrew Stacey Nov 2 '12 at 12:02

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


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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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