I've defined a new command with \newcommand.
I would like that new command to show up in the auto-complete list.
Feature Suggestions ⇒ Add self-defined commands to the auto-complete list
-
- Posts: 25
- Joined: Tue Sep 16, 2008 6:05 am
-
- Posts: 27
- Joined: Wed Jan 17, 2007 12:35 pm
Add self-defined commands to the auto-complete list
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"):
In the same file you have quite a lot of examples of LaTeX commands as well. From what I remember the sign "
" stands for new line.
I hope this helps and solves this problem
It is stored in XML format. This is for example what I have added for AMSMath's align environment (it autocompletes upon typing "align"):
Code: Select all
<lxEnvironment name="align"
expafter="}
\label{eq:}
\end{align}"
expbefore="\begin{"/>
I hope this helps and solves this problem
-
- Posts: 25
- Joined: Tue Sep 16, 2008 6:05 am
Re: Add self-defined commands to the auto-complete list
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
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

Re: Add self-defined commands to the auto-complete list
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!
Thanks!
-
- Posts: 27
- Joined: Wed Jan 17, 2007 12:35 pm
Re: Add self-defined commands to the auto-complete list
@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.
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.
-
- Posts: 1
- Joined: Tue Mar 24, 2009 4:52 pm
Re: Add self-defined commands to the auto-complete list
I dont know if there's anyone still reading this thread, but I have the answer!
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.
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
- (622 Bytes) Downloaded 1997 times
-
- Posts: 1
- Joined: Mon May 04, 2009 11:07 am
Add self-defined commands to the auto-complete list
I did successfully as wellYes, 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.

pret auto
Re: Add self-defined commands to the auto-complete list
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).
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).