FLASHMODE

CLAUS GERHARDT

Date: September 18, 2013.

Contents

Contents
 1.  Introduction
 2.  Installation
 3.  Running Flashmode
 4.  Root files
 5.  Starting new copies of Flashmode and quitting Flashmode
 6.  The „run in the background/foreground“ option
 7.  Test files
 8.  System requirements
 9.  Some helpful scripts
 10.  Download Links
 11.  Links

1. Introduction

Flashmode enables simultaneous typesetting if TeXShop is used as editor for TEX or LATEX or any other common TEX variant. When Flashmode is started, it looks for the front most document in TeXShop, gets its path and after that it is hooked forever to this document as long as it stays open, i.e., a few split seconds after Flashmode has started the front most document in the TeXShop could be anything without doing any harm.

Then Flashmode checks in regular intervals (default is 0.2 sec), if its tex document has been modified, and if so, it initiates a save, a pdflatex run, and asks TeXShop to refresh the corresponding pdf file. Flashmode can be invoked even if a document isn’t typeset yet, but beware that its first action will be a typesetting command.

An important feature is that tex syntax errors don’t cause any error messages or disruptions of any kind, i.e., the pdf gets never corrupted, at least the pdf viewer is never aware of it, and the last refreshment is always visible; the pdf viewer will never complain.

Thus, the user never gets any error messages; the presence of errors can only be deduced from the pdf window which then doesn’t change any more; of course the errors will be reported in the log file and can be looked up.

When the tex document is unmodified, Flashmode stays put in the background with very little CPU load, i.e., Flashmode can stay open as long as one wishes without any bad side effects.

While Flashmode is active, the source document can be typeset independently by TeXShop or by other scripts or commands, especially other tex tools like bibtex can be run without any interference by Flashmode.

2. Installation

Copy Flashmode in the Applications folder

/Applications

3. Running Flashmode

First adjust TeXShop for using it with Flashmode. Open an already typeset document so that both the preview window as well as the source window are present. Your screen should be large enough that both windows can be placed side by side. If you are pleased with the arrangement, open TeXShop’s preferences and check under Document the button „All windows start at fixed position“ and then press „Set with current position“ , same under Preview, uncheck the „Automatic Preview Update“ , set „Default Page Style“ to „Multi-Page“ .

Under Typesetting define the „Sync Method“ you would want to use. You should select „SyncTeX“ . Synchronization is then excellent in both directions.

Flashmode can only be used and will stay open when there is a tex document open in TeXShop which has already been saved once, i.e., it should have a name. When the tex document is opened and front most in TeXShop and you would like it to be controlled by Flashmode, then start Flashmode. Flashmode will then take control of the front document, i.e., it will check periodically, default is 0.2 seconds, if the document has been modified, and if so it will issue a typesetting command.

TFhlaussh,m tohdee dowcounme’tn dtetsehcotu alndy nemvoedrifibcea staiovnesd! manually, since then

On an 8-core Mac Pro the typed text will be instantaneously shown in the preview window in case of a 50 pages document, if the time interval is set to 0.000001 seconds. Even for a 300 pages book the delay will be only 2-3 seconds.

Since Flashmode will never complain or show an error message, your only way of spotting a problem is by watching the preview window which won’t change anymore when the source file has been modified.

When a document should be released from Flashmode’s control simply quit Flashmode or close the document. The latter action is recommended if several documents are controlled by Flashmode, cf. Section 5.

The provided shell scripts require first line parsing for documents
using pdflatex, pdftex, context, xelatex or xetex i.e., the first line
of the corresponding source files should look like

%&pdflatex  
%&cont-en  
%&pdftex  
%&xelatex  
%&xetex

if you want the document to be typeset in pdflatex, context, plain tex, xelatex or xetex.

If the the document should be typeset by using the routine

latex → dvi → ps → pdf

then no first line parsing is allowed and the first lines should not contain any of the commands above.

4. Root files

When writing a book in LATEX one usually has a root file and the chapters are loaded through the „include“ command. In this situation the chapters are the target files for Flashmode though the typesetting’s target has to be the root file. A smooth interaction can be accomplished by inserting

%SourceDoc rootName.tex

in one of the first three lines of the chapter file, where „rootname“ is the name of your root file, and in the present situation it is assumed that the chapter file and the root file are in the same directory. If this is not the case, then the relative path to the root file has to be given like e.g.,

%SourceDoc ./rootName.tex

TcaenXSehiothperusbees u aseddiffceorenncturrpehnrtalyseotroyoinudiccaatnettelhle T reoXoSthofiple wtohiucshe
its old settings by issuing the command in the terminal
defaults write TeXShop UseOldHeadingCommands YES

5. Starting new copies of Flashmode and quitting Flashmode

Flashmode can only control one document. If you want to control another document you have to start a new copy of Flashmode. Since Flashmode’s default behaviour is to run in the background like a shell script, it is supposed to be started by the Applescript „new-clone“, which should be used as a TeXShop macro. When Flashmode’s behaviour has been changed to to run in the foreground, see next section, it can be started like an ordinary application and the clones by pressing the key „n“ when Flashmode, or any of its clones, is the active application.

This way you can control arbitrarily many documents, but beware to create a clone only for a fresh document that isn’t already controlled by Flashmode.

In case you are afraid that a document is controlled by several Flashmode clones simply close the document, then all clones will automatically quit.

There is an easy way to check if a document is controlled by Flashmode: Modify it, then its icon will be dimmed and if it stays dimmed then it is not under the control of Flashmode.

There is also an Applescript for quitting Flashmode from within TeXShop, cf. the next section and Section 9.

6. The „run in the background/foreground“ option

There is an option to let Flashmode run in the background or foreground, the default is running in the background. Note that, when Flashmode runs in the background, it can only be started by the script „new-clone“ and quit by either closing the document or by the script „quitFlashmode“ which can be downloaded, cf. Section 9. Running in the background means that no application icon will be put in the dock and that there will never be an active application with accessible menus.

The option is accessible via the Applescript „backgroundOption“ which can be downloaded, cf. Section 9.

7. Test files

In the folder

~/Library/Apple Support/Flashmode/Test-files

are minimal test files for articles or books that should run with Flashmode and a useful template for using metapost via the package mfpic. If they aren’t typeset by Flashmode then there is probably something wrong with your set up.

8. System requirements

Flashmode requires OS 10.8 or better; a large screen is recommended.

9. Some helpful scripts

All scripts can and should be used as macros in TeXShop.

1
Starting Flashmode or a clone. Note that this script should be installed as a macro in TeXShop if Flashmode is supposed to run in the background. new-clone
2
Quitting Flashmode or a clone. Note that this script should be installed as a macro in TeXShop if Flashmode is supposed to run in the background. quitFlashmode
3
A script for running Flashmode in the background/foreground. Note that, when Flashmode runs in the background, it can only be started by the script „new-clone“ and quit by either closing the document or by the script „quitFlashmode“ . Running in the background means that no application icon will be put in the dock and that there will never be an active application with accessible menus. backgroundOption
4
The former application „Flashmode“, which is now obsolete, has been modified to support the new „Flashmode“ by offering useful LATEX related scripts and is now called „Flashmode-Scripts“. Copy it in the Applications folder. It can be downloaded here.

10. Download Links

Flashmode

Flashmode-BBEdit (A version that requires BBEdit as editor and TeXShop as pdf viewer.)

11. Links

Home page, TEXHelpers, TEX Switcher, pdfselect, TEX Scripts, Books, Preprints, Former Students, Veranstaltungen, Lecture Notes

Ruprecht-Karls-Universitt, Institut fr Angewandte Mathematik, Im Neuenheimer Feld 294, 69120 Heidelberg, Germany

URL: http://www.math.uni-heidelberg.de/studinfo/gerhardt/