Recent Changes - Search:



Modifying TeX Mode Electrics

FAQ.ModifyingTexModeElectrics History

Hide minor edits - Show changes to markup

January 23, 2006, at 03:23 PM by -
Added lines 1-94:

(:title Modifying TeX Mode Electrics:)

An Alpha user asked on one of the AlphaTclMailingLists?:

    > I would like some method to replace \su with \subseteq and \ri with \rightarrow.
    > The "Electric Corrections" package doesn't allow me to do this.

You have run into a bug with the "Electric Corrections" package distributed with Alpha 8.0.x. We'll try to fix this before the final release, but there are no guarantees.

    > Is there any way to facilitate math symbology without trying to remember
    > lots of keyboard shortcuts or wade through the LaTeX menu?  Thanks.

Yes. Alpha has several different 'electric' features that can help with these tasks, and there is quite a bit of built-in support for TeX mode electrics. First off, you should read the FAQ.ElectricsPrimer. Assuming you have done so, and assuming that defining a new global 'completion' or 'expansion' isn't enough for your purposes, continue reading for more information on

  • Modifying TeX Mode Electric Expansions
  • Modifying TeX Mode Electric Completions

Modifying TeX Mode Electric Expansions

If you want to see the full set of electric expansions that have been defined for TeX mode, open the file [$HOME]/Tcl/Completions/TeXcmds.tcl and scroll down to the "cmd acronym pairs" section.

You could place a copy of this in your Smarter Source folder and remove some of the pairs you don't want, such as

    ra     returnaddress

so that you are offered fewer choices when you "expand." See the ModifyingWithSmarterSourceFiles? page for more information. If you intend to modify a lot of AlphaTcl files, this is a useful way to do so.

Modifying TeX Mode Electric Completions

There is another AlphaTcl file named TeXCompletions.tcl''" which contains a series of procedures which are used for more complicated electric completions. For example. TeX::Completion::Env allows you to complete this (where "|" indicates the current cursor position)


resulting in

    \begin{*environment name}
    \end{*end environment}

and then you can complete this

    \end{*end environment}

resulting in something like


These procedures vary in degree of convolution (er, sophistication) -- edit them at your own risk. You will, however, find out the procedure name for some of the simpler electric completion routines that you can also modify, such as

    set TeXbodies(align)           "\[TeX::align\]"
    set TeXbodies(align*)          "\[TeX::align*\]"
    set TeXbodies(alignat)         "\[TeX::alignat\]"
    set TeXbodies(bmatrix)         "\[TeX::matrix\]"
    set TeXbodies(eqnarray)        "\[TeX::eqnarray\]"
    set TeXbodies(eqnarray*)       "\[TeX::eqnarray*\]"

Just Command-Double-Click on the name of the procedure to open the file containing its definition.


Page last modified on January 23, 2006, at 03:23 PM
Hosted on Logo