1

For example, the following in math.xml makes possible autocompletion for the equation envirionment

<lxEnvironment name="equation" 
        parameters="1" 
        desc="Math environment"
        icon="math.bmp"
        index="10"
        expafter="}&#xA;&#xA;\label{eq:}&#xA;\end{equation}" 
        expbefore="\begin{"/>

so that when I type equ and hit Ctrl+Space, the following is autocompleted

\begin{equation}

\label{eq:}
\end{equation}

I want to ensure that after the autocompletion, the cursor stops at a given place, say, after eq:. Right now, it stops at the empty line. I was not able to change the behavior by playing with the parameters in the Xml code. I am using TeXnicCenter 2.02.

I vaguely remember it is possible to achieve this effect in TeXnicCenter 1, forgot how to do it.

1

Well, the general rule for the syntax for lxEnvironment seems to be the following:

  1. the content of variable expbefore is printed (results in \begin{)
  2. the name of the environment, here equation, is added. Now we have: \begin{equation
  3. the content of variable expafter is added, with &#xA; changed to a newline.
  4. At last it seems that the cursor is set to the (first?) blank line or more simple after the closing } of \begin{equation}.

The given complete code:

    <lxEnvironment name="equation" 
        parameters="1" 
        desc="Math environment"
        icon="math.bmp"
        index="10"
        expafter="}&#xA;&#xA;\label{eq:}&#xA;\end{equation}" 
        expbefore="\begin{"/>

You can test this by changing the content of expbefore for example to expbefore="\begin{equation}&#xA;&#xA;\label{eq:" and expafter to expafter="}&#xA;\end{equation}". Then you get equation inserted after ...eg: and the cursor stays at the beginning of the blank line. I think that is hardcoded in the code of TeXnicCenter. To get that changed please contact the support of TeXnicCenter, located on the homepage of TeXnicCenter

For an easy testing you can for example create an file mycommand.xls like this:

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<lxCollection version="1" xmlns:txclxp="http://schemas.ToolsCenter.org/TeXnicCenter/LaTeXCommands.xsd">
    <lxPackage name="username" 
        path="" 
        desc="My commands" 
    >
  <lxEnvironment name="testerle" 
            parameters="0" 
            desc="Math environment"
            icon="math.bmp"
            index="10"
            expafter="}&#xA;\end{equation}" 
            expbefore="\begin{equation}&#xA;&#xA;\label{eq:"/>
    </lxPackage>
</lxCollection>
<!-- $Id$ -->
<!-- 
    $Log: username.xml,v $
    First version 2016/09/26 21:00:00 username
    no message

-->

and copy it to the system path where Windows installed your TeXnicCenter, for example C:\Program Files\TeXnicCenter\Packages (64bit version).

After a restart of TeXnicCenter (close all TeXnicCenter windows, open then a new one) you can test the now loaded new environment testerle (to avoid problems with the real needed and installed equation) ...

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.