# [OS X TeX] Re: TeXShop features, AppleScripting

Joachim Kock kock at math.uqam.ca
Thu Jun 24 13:14:52 EDT 2004

Hello Joel,

You might take a look at Alpha
http://www.maths.mq.edu.au/~steffen/Alpha/AlphaX/
Alpha has very elegant interaction with the tetex programmes
and with TeXShop and iTeXMac (and many other previewers).

> * Internal scripting

Alpha uses Tcl --- one of the easiest scripting languages to
learn.

> * The ability to type a keyword (like "eq") in your document, his
> Alt-Enter (say, Command-Enter on the Mac) and have the corresponding
> Macro executed.  This was particularly useful because on the fly I
> could type "eq", hit alt-enter and have an equation environment ready
> for me to keep typing.  CommandCompletion almost does this, but not
> quite.

Alpha has many completion mechanisms.  One which looks a lot like what
you describe is called 'electric contraction': you type b'eq and hit
tab, and a complete equation template is inserted with bullets as
tab stops at the places where you'll want to insert data (and you
hop to next tab stop with the tab key).  More generally you can
bind any keyword to any macro, and then choose a trigger for it.
As a stupid example: let the keyword be lastpage, and let the macro
be one that scans the log file to find out which page is the last,
and let Ctrl-Cmd-F7 be the trigger, then when you write 'lastpage'
and hit Ctrl-Cmd-F7, the keyword is substituted by the pagenumber of
the last page.

> * Interactive \ref{} and \cite{} popups - when you typed the closing
> brace, it gathered all labels and bibliographic references and put them
> in a pop up, and you could select the one you wanted, and it would
> insert it automatically.  Very useful for remembering your labels!

Alpha has several approaches to this.  The most straightforward is
just to type \ref{ and then tab, then you cycle though all the possible
labels of the tex job.  If you do \ref{st you only cycle through
those labels starting with st.  For \cite{ the workings are the same,
except that the completions you cycle through are found by scanning
the relevant bib databases.

> * Project files - I often have several tex (or other text) files I want
> opened all together, not all of which will be type set, but are of
> relevance to my project.  It seems TeXShop can't do this?

Alpha has the concept of filesets: any assigned collection of files
together with an attribute, which could be for example 'TeX': for files
in a TeX fileset, the typeset command applies to the root file, etc.

> * Bookmarks within my document!

Alpha has two sorts of bookmarks: names ones where you give a name
to a certain position in the file, and then you can jump to these
positions from a pop-up menu, all section and subsection titles are
automatically in among the named marks.  And then unnamed marks, which
is a stack of positions: for example you are in the middle of your
document and want to make a new definition in the preamble, just push
another unmamed mark (ctrl-,), go back to the preamble and write what
you want, and come back to the previous mark by Ctrl-. (which then
pops that mark from the stack).  There are several other navigation
facilities, like cmd-double-clicking on a \ref to be taken to the
label, etc.

There are many other TeX specific goodies, like 'typesetSelection',
compile automatization and smart tex-error browsing.  (And of course
all the syntax colouring, auto-indentation and comment handling,
completions, and all that which you expect from a serious editor.)

Note that AlphaTk runs under Windows too.

To finish, let me mention the Alpha users list:
http://lists.sourceforge.net/lists/listinfo/alphatcl-users

Cheers,
Joachim.
-----------------------------------------------------
Post: <mailto:MacOSX-TeX at email.esm.psu.edu>