## LaTeX forum ⇒ Feature Suggestions ⇒ Add self-defined commands to the auto-complete list

Suggestions and discussions for new TeXnicCenter features
Hans Nieuwenhuis
Posts: 25
Joined: Tue Sep 16, 2008 6:05 am

### Add self-defined commands to the auto-complete list

I've defined a new command with \newcommand.
I would like that new command to show up in the auto-complete list.

rockstar1707
Posts: 27
Joined: Wed Jan 17, 2007 12:35 pm
The information for autocomplete is stored in a file "../TexnicCenter/packages/TeX.xml"

It is stored in XML format. This is for example what I have added for AMSMath's align environment (it autocompletes upon typing "align"):

<lxEnvironment name="align" 			expafter="}&#xA;	&#xA;	\label{eq:}&#xA;\end{align}" 			expbefore="\begin{"/>

In the same file you have quite a lot of examples of LaTeX commands as well. From what I remember the sign "&#xA" stands for new line.

I hope this helps and solves this problem

Hans Nieuwenhuis
Posts: 25
Joined: Tue Sep 16, 2008 6:05 am
Thanks Rockstar1707! It works!

Of course, I will probably lose my changes to that file if I install a new version of TeXnicCenter....so it would be nice if there is a 'user-file' (for 1 user? for all users? Both?) to which we can add these kinds of commands....maybe even via a GUI

dba
Posts: 3
Joined: Tue Oct 14, 2008 11:27 pm
This doesn't answer your question, but I have one on a related topic: how do I make the auto-complete actually complete a command?

Thanks!

rockstar1707
Posts: 27
Joined: Wed Jan 17, 2007 12:35 pm
@Hans Nieuwenhuis

Yes, I agree with this. These files should maybe rather somewhere to "Documents and Settings" folder. However, for now I always make a backup of these files on installation directory, and when I install new version I simply copy those files from backup. It works ok.

@dba
I believe you're searching for a command CTRL+SPACE. But you have to know, what when you want to "autocomplete" the environment, you have to write "equ", and than press CTRL+SPACE. Rather than typing "\begin{equ" and pressing CTRL+SPACE. Once you get used to this, you realize that this is really good.

shkristensen
Posts: 1
Joined: Tue Mar 24, 2009 4:52 pm

You just create your own file with the extention "xml" in the folder (C:\Program Files\TeXnicCenter\packages" in my case). TXC scans the folder for xml-files and will use all autocompletions in the program.

I have attached afile that adds fixme autocompletion to TXC.
Attachments
Fixme.xml
Autocompletion for the fixme package

rainbow2009
Posts: 1
Joined: Mon May 04, 2009 11:07 am
Yes, I agree with this. These files should maybe rather somewhere to "Documents and Settings" folder. However, for now I always make a backup of these files on installation directory, and when I install new version I simply copy those files from backup. It works ok.

I did successfully as well
pret auto

barreto
Posts: 2
Joined: Sun Aug 02, 2009 10:33 pm
Comparing the two proposed solutions:
a) replace the original TeX.xml file at each TXC installation
b) creating a new file (for example My_Tex.xml) with my own commands
I liked the second best and tried it.

However, one should notice that the commands cannot have the same name as in TeX.xml. For example, if Tex.xml has
<lxEnvironment name="figure"
then your command should not be named figure. This created me the following problem, if I change it in My_Tex.xml to
<lxEnvironment name="myfigure"
I end up with a:
\begin{myfigure}[htbp]
...
\end{figure}
because TXC cannot delete that I typed myfigure, and it only creates text before and after what I typed.

So, my conclusion at this moment is that the best is solution a).