Joachim's web pages
[Home]
[AlphaTcl]
Flash mechanism for Alpha
Download for xdvi
# Flash mode prototype for Alpha (with xdvi or TeXniscope) # ======================================================== # # # Overview # -------- # Flash mode is the feature peculiar to Textures, by which a preview window # continuously reflects the changes in the source document. Recently Claus # Gerhardt has implemented a version of this as a compiled AppleScript # application controlling an editor and a previewer. # # The present Alpha 'plugin' is a short Tcl script to achieve a flash # effect between Alpha and xdvi (or TeXniscope). # # It's approach is different from Claus Gerhardt's in two main respects: # # 1) it doesn't modify the source file itself, and uses instead a temporary # file, together with a dynamically precompiled custom tex format. # # 2) it works by notification instead of by polling. Instead of having the # various components check every fraction of a second if there is anything # to do, the components here communicate via a two-way pipe and via event # hooks, notifying each other when an action is required. This means there # is no unnecessary waiting time -- the updating occurs as soon as # possible. (It also means that when idle (nothing is typed in the tex # source window), the workload is zero.) # # # Speed and usability # ------------------- # I am testing this on my good-old 500MHz G3 iBook (without Quartz # Extreme). The mechanism typesets a 2-page document about 90 times per # minute (which I think is comparable to what Textures achieves on # documents of this length (?)), hence the maximum amount of time elapsing # from a character is typed until it appears in the preview window is about # 0.66 seconds. (These measurements are for xdvi. TeXniscope takes a # little longer.) However when the document is in an unstable state # (unmatched dollar sign or such), the gap can be somewhat longer. For # long documents, there is an option to preview and flash only the # surroundings of the cursor, i.e. only current paragraph. This works at # about the same speed, independently of the size of the document. # # # Shortcomings # ------------ # This is only a prototype. To keep the flash script as simple as possible # in this phase of development (and because of general laziness), I have # refrained from several obvious refinements. The current shortcomings # include: # # The window geometries are currently hardcoded to fit on a 1024x768 # display -- squeezed! It would not be too difficult to automatically # adjust to the screen size, or provide these settings as preference flags # where the user can write his own idiosynchrasies. # # Because the pdf is produced from a temporary file, right now standard # synchronisation doesn't work optimally together with flash mode: all # line indications are shifted by the number of lines in the preamble! # Fixing this will require a few tweaks to Alpha's synchronisation code, # but there is no technically difficulty in this project. # # The partial flash mode is certainly not very well polished, and fails # if you are typing near the top of the document! It is just a very quick # hack... # # I don't think it works in AlphaTk, since I have been a bit sloppy with # file positions... # # # Instructions for installation and usage # --------------------------------------- # Place this file /anyhwere/you/want and write the following line in # your prefs.tcl file: # # source /anywhere/you/want/flash.tcl # # Then restart Alpha. # # To try out the mechanism, open a tex document (a self-contained latex # document) and press F2. Then start typing. To stop the mechanism, press # shift-F2. (The mechanism also stops automatically when the source window # is closed.) (If these keyboard shortcuts are in conflict with others, # you can change them using Alpha's usual syntax for key bindings, e.g. # # Bind 'a' Last updated: 2005-05-29 by Joachim Kock. |