GeneralTexnic Center auto complete figures WRONG

General information and discussion about TeXnicCenter
Post Reply
scales
Posts: 5
Joined: Tue Apr 10, 2007 3:36 pm

Texnic Center auto complete figures WRONG

Post by scales »

Hi,
i am somewhat new to latex, but i have noticed that the autocomplete for tables and figures is wrong. I believe that the caption should go before the label. anyone know how i can change this? meaning the autocomplete, not re-writing it?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
blackhawk60
Posts: 1
Joined: Tue Apr 17, 2007 10:58 am

Re: Texnic Center auto complete figures WRONG

Post by blackhawk60 »

Edit the file "%TeXnicCenter_path%\packages\TeX.xml"

Find the XML tag "lxEnvironment" with 'name="table"' and edit "expafter" just as you like.

In my case the "figure" looks like this:
---
<lxEnvironment name="figure"
parameters="1"
desc="Provides a figure environment"
icon="format.bmp"
index="9"
expafter="}
\centering
\includegraphics[width=]{}
\caption{}
\label{fig:}
\end{figure}"
expbefore="\begin{"/>
---
Things I've changed:
\centering (all my figures should be centered)
[width=] (too lazy to break my fingers each time on my German keyboard)
\label{fig:} (the "fig:" is new)
swapped \caption{} and \label{} (as you suggested)

While you are at it, change "itemization" to "itemize":
<lxEnvironment name="itemize"
parameters="0"
desc="Defines an environment for an itemization"
icon="format.bmp"
index="7"
expafter="}
\item
\end{itemize}"
expbefore="\begin{"/>

BTW: If your TeXnicCenter crashes with a strange message at startup, make sure your changes to the TeX.xml produce a valid XML file.

Make sure you restart TeXnicCenter to the changes.

Hope that helps,

Marcus
scales
Posts: 5
Joined: Tue Apr 10, 2007 3:36 pm

Re: Texnic Center auto complete figures WRONG

Post by scales »

absolutely fantastic! works great! funny, i was looking around on my own and found the same file and section, problem was that i did not see the "label" because it was on the same line as caption. i had quickly dismissed the file then. Anyway thanks a lot, now texniccenter is my favorite editor.
Post Reply