[OS X TeX] Completions in Alpha (was: Moving to OS X finally)

Joachim Kock jkock at start.no
Sat Oct 2 00:16:57 CEST 2004


Hello,

Herb asked some questions about completions in Alpha's TeX mode.
I guess they are related also to the ongoing effort to improve the
completions mechanisms in the Cocoa tex frontends, so let me briefly
describe some of Alpha's completion schemes (as far as I understand 
them).

> Are there completions to generate environments? 

Yes, plenty --- in fact I would say there are too many different
ways to do this, and that this may be confusing.

First of all there are some direct keyboard shortcuts for many common
environments, e.g. Ctrl-F6 for align*.  For the few environments you
use all the time this is of course the quickest.  If your favourite
environment does not have a preassigned shortcut, you can just assign
your own binding through the menu item "Assign menu bindings" (in
the TeX menu).

There is also a menu item (with shortcut Shift-Cmd-E) to insert any
environment (you choose from a list).  (This one is found in the
Environment submenu of the Math submenu of the TeX menu.  (As far
as I know, the whole of LaTeX is in the menus, organised in the same
way as Lamport's LaTeX book.))

All environments and other templates are of course inserted with
tab stops everywhere you are expected to fill something in.

However, you'll soon find it more useful to use completion mechanisms.
There are many possibilities.  In general, whenever you think that
Alpha should be able to figure out what you want, you can hit the
completion key (if there are various possible completions, you can
cycle through them by repeatedly pressing the completion key).  For
example you can write 

\beg

and then press <complete>.  This will insert

\begin{|}
\end{@}
@

where | denotes the cursor position, and the @ symbols are actually
bullets which are the tab stop markers.  With the cursor in this
position you can type "ali" and hit <complete> again, which should
give you

\begin{align}
  | &@ 
  \label{@} \\
  @ &@ 
  \label{@}
\end{align}
@

And then you jump to next tab stop with <tab>.

There is also a slightly smarter way, using so-called electric
contractions, which is just a short-hand for the begin construct:
type 

b'ali

and hit <complete> --- that will give you directly the template
above (without the need of first completing the begin struct).


> is it easy to extend/change the list of environments? If so, how? 

Yes it is very easy.  Let us take electric contractions as an example 
(a new environment defined this way will also be available for the other
completions mechanisms, but it will not be visible in the menu).  If you
type

b'myown

and hit <complete>, and if Alpha has never seen such an environment
before, you will be presented with a dialogue asking you to define
the body template of this environment.  Then you have to write the
whole she-bang, with bullets for the template stops.  Next time you
invoke it, it will be known and expands automatically.

The above mechanism is specific to TeX completions.  There are also
various non-tex-specific completions mechanisms (including word
completion and filename completion).  For other sorts of template
completion see the manual.

> Do you have to re-write some tcl commands and re-compile?

Alpha never *requires* you to code anything in Tcl (and since Tcl
is interpreted not compiled, there is never need for compilation).
In the above example all you have to do is to write the latex code.

It is a common misconception that you have to be a Tcl programmer to 
use Alpha.  The reason for this misconception is probably that experienced 
Alpha users are very satisfied with the fact that it is so easy to script in Tcl, 
and taylor make Alpha to fit your very particular needs, and sometimes it is
this sort of questions that dominate the Alpha mailing lists.  But let me
stress again that Alpha is designed to work out of the box, and that you
operate it by pointing your mouse to a menu item like in any Mac application.  
All that Tcl stuff is just extra power tools for power users (and a great lot
of fun too, once you realise you can control Eudora, Addressbook, iTunes,
Maxima, CVS, mysql, HTTP, and everything from within Alpha with Tcl 
scripting).

Cheers,
Joachim.


------------------------------------------------------------
Få din egen @start.no-adresse gratis på http://www.start.no/
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list