ConTeXt Typeset Tool

This AppleScript script is for users of the ConTeXt typesetting system on a Mac.

Main purpose of the script is to launch ConTeXt typesetting in a flexible way and independently of the text editor you are using. It can also typeset the product file while you’re editing any component (child) file.

Besides that it provides a GUI for various ConTeXt tools/scripts and contains an updater (and archiver) for the ConTeXt installation.

Usage

  • While your TeX file is open in your text editor just launch the script to start typesetting. It works with almost every text editor (BBEdit, MacVim, TextMate, etc.).
  • If you are working on a component file you’ll most likely want to typeset the product file. To do so just operate the script in Product Mode, and it will typeset the associated product file. (You can toggle the mode via modifier key.) Assigning a TeX file as product file can either be done semi-automatically or by registering the file in one of two swappable register slots.
  • You can also launch the script on any selected TeX file in the Finder without the need to open the file at all.
  • The script itself can be launched …
    • through a hotkey (e.g. install the Service that comes with the script and assign a key),
    • through any launcher like LaunchBar, Keyboard Maestro, Alfred, …,
    • or from the Scripts menu in the Menu Bar.

Some Options

  • Switch between ConTeXt-Beta or ConTeXt-Current (stable) installation. (Of course, you are not limited to Current and Beta; for example, you may also point the “Beta” slot to the latest cutting edge beta, and the “Current” slot to that beta release from last week which worked so perfectly for your documents.)
  • LuaTeX or LuaJitTeX.
  • Product mode or single-file mode.
  • Typesetting in the background or open in the Terminal.
  • Notifications (typesetting start/end, typesetting mode).
  • Completion/error sounds.
  • Selection of preferred PDF viewer (Skim, Preview, Adobe, …).
  • Toggle auto-launch of PDF viewer.
  • Exclude generated PDFs from Time Machine (and CrashPlan) backup.
  • SyncTeX on/off.
  • Some of these options can be toggled on the fly by holding down modifier keys (shift, opt, ctrl).
  • Please see the manual for details.
Ctx Tool: Main screen
Options screen

Additional Tools

  • Automatic detection of your ConTeXt installations.
  • Purging of auxiliary files.
  • Purging of generated PDFs
  • Info on the used ConTeXt version.
  • Updating of the ConTeXt Standalone installation (Beta and Current separately) and automatic archiving of the old one.
  • Syntax check.
  • Make formats, listing fonts.
  • In the Extras folder: Forward SyncTeX for BBEdit, helper files for hotkey setup, etc.
  • See the manual for more.
Ctx Tool: Tools screen
Tools screen

Compatibility and Requirements

  • Works with macOS Mojave, High Sierra, Sierra and OS X El Capitan.
  • Works probably with older OS X versions, too. (See manual and change notes.)
  • The script is designed to work with the so-called ConTeXt Standalone installation (aka ConTeXt Minimal). Out of the box it won’t work with TeXLive installations or any other kind of excessively deviating structures. Of course, you can always edit the script to make it work with everything.
  • The script can interact with almost every text editor (for example BBEdit, TextWrangler, TextMate, MacVim, TeXShop, …).
  • This is only possible through UI scripting. To make this work you have to enable accessibility permissions for your text editor in the Security & Privacy preference pane, if not already done (see screenshot). The easiest way to do this, is to just run the script. Then you will see a pop-up window that tells you which app requires accessibility rights and the preference pane will be populated with that app. You just have to set the check mark.
  • To understand the capabilities of the script you really should read the manual that comes with the script.
Accessibility permissions - text editor
Your text editor needs accessibility permissions. (This is an example; you only have to add the editor you are actually using.)

Issues?

If you encounter any issues or have an idea for an improvement, leave a comment here, or reply to one of my mails on the ntg-context mailing list.


Downloads

The latest versions work with macOS 10.14 and back to 10.11, probably with 10.10, maybe with 10.9/10.8.

Download (2.0.0b / 2018-06-19)

Download (Older versions / –)

Online Manual

If you post a link please use the page link, not the direct download link.


Changes
2.0.0b (68) (2018-06-19)
The script now stores user preferences, remembered product files, file paths etc. in NSUserDefaults (i.e. in a plist file in ~/Library/Preferences). This allows for proper code signing and makes the preferences more robust. (You can now also modify and recompile the script without loosing any setting or path.)
Removed the spoken “warnings” when the typesetting failed. (I couldn’t stand them anymore 😉
Repaired some minor glitches in the UI.
1.3.0 (67) (2017-05-24)
This release is mainly to move the script out of Beta, since it is working reliably for me for months. Very minor changes. Some major changes coming soon!
1.3.0b2 (66) (2016-09-22)
Compatibility: macOS 10.11, 10.12; probably 10.10 (untested); maybe 10.9.
Removed ASObjC Runner from the bundle (incompatibility with macOS Sierra).
Rewritten all code formerly related to ASObjC Runner.
Removed terminal-notifier -> No more notifications on OS X 10.8.
Changed Trash Generated PDF Files action: it now shows a list where you can select the PDFs to trash.
Updated 7zr to version 16.02
Removed the Python dependency.
Fixed some path and encoding problems for mtxrun and texutil.
1.2.5 (64) (2016-03-22)
Notifications now working on El Capitan (10.11).
1.2.4 (63) (2015-04-10)
Rewritten parts of the manual.
1.2.4 (62) (2015-04-09)
Replaced ASObjC Runner component with a new copy (code signature problem).
Updated terminal-notifier component to 1.6.3 (this is only used on OS X prior to 10.9).
1.2.4 (61) (2015-04-09)
Added the option to enforce SyncTeX via command switch --synctex=zipped. This will work also where \enabledirectives [system.synctex] doesn’t work, for example in standalone tex documents without components or other input files. (See also this.)
Changed the “typesetting started”-notification emoji from U+231A U+FE0F to U+2615 U+FE0F. (Thank you, Apple, for having converted the formerly nice Watch emoji into a blemished Apple Watch emoji that resembles a piece of coal in 12pt.)
For semantic coherence changed the “typesetting finished” emoji from U+1F3C1 to U+1F37A 😉
Manual: Added note on Auto syntax check in Product Mode.
1.2.3 (60) (2015-03-29)
Added update switch --modules=all.
Removed the update switch --keep.
When updating ConTeXt first-setup.sh will get updated, too.
1.2.3 (58) (2015-03-28)
Added to the GUI (Tools section): Possibility to quickly remap ConTeXt directories to the “Beta”/“Current” slots. This should be useful if you are switching between more than two ConTeXt installations, for example an old Current, an older (but working) Beta and the latest Beta from last night. (Formerly you had to rename the ConTeXt folder on disk in order to force the script to prompt for new locations.)
Slightly changed wording in main window.
Updated and extended the manual.
1.2.2 (56) (2015-03-24)
Recompiled 7zr.
1.2.2 (55) (2015-03-23)
Updated 7zr binary.
Corrected typo in Version Info dialog.
1.2.1 (54) (2015-01-18)
Works again with BBEdit 11 (uses BBEdit’s AS dictionary now).
Notifications now working with Yosemite (10.1.0).
1.2.0 (51) (2015-01-16)
Manual updated (Incompatibility of Terminal mode with zsh shell).
1.2.0 (50) (2014-05-07)
Bugs fixed in the BBEdit script (Extra folder).
1.2.0 (49) (2014-05-07)
The auxiliary files .synctex.gz, .tuc, .log now automatically get the Time Machine exclusion attribute. (CrashPlan respects this no-backup attribute too.).
1.2.0 (48) (2014-05-07)
Improved handling of Skim: If Skim is set as PDF viewer a “revert” command is sent to Skim after typesetting. Thus you should disable “Check file for changes” in Skim’s preferences. This is in accord with the Skim recommendations as of here. (Works only if not typesetting in the Terminal.)
Included script “Synctex Forward Search for BBEdit” (in Extras).
1.1.8 (2014-04-10)
Changed default setting for the exclusion of generated PDF from Time Machine Backup. If you do want your PDF to get backed up you have to select the option “Don’t exclude generated PDF from Backup” now.
Included an Automator service for easy removal of the no-backup xattr (in Extras).
Raised delay for modifier keys from 0.4 to 0.6s. It is more comfortable now to launch the script and hit a modifier key shortly afterwards. (You can change the delay in the Settings section in the script if you feel that it slows down the script launch too much.)
1.1.7 (2014-02-11)
Changes to the backup system for ConTeXt installations:
  • OS X’s tar (bsdtar) is now used instead of cpio
  • Significantly faster (but slightly less efficient) compression settings for gz (2) and xz (5)
1.1.6 (2014-02-04)
LuaTeX versions string is now parsed at full length.
Frontmost process at script launch time (i.e. probably your text editor) is now properly brought back to front …
  • when the options window is closed
  • before the background execution of the typeset command
  • after registration of a product file via modifier key
  • for all Terminal sessions when ‘Terminal in background’ is selected
‘Terminal in background’ properly designated as global option (that is, for typesetting runs and for tools that run in the Terminal).
1.1.5 (2014-01-29)
Added LuaJitTeX as option.
Fixed the search for ‘setuptex’ (‘…/scripts/stubs/setuptex’ will no longer appear in the search results. Only ‘…/tex/setuptex’ is considered a valid setuptex file.
Updated the notifications for un-/re-registering product files for Mavericks compatibility (native AppleScript notifications).
Complete overhaul of the main options window; more expressive and coherent symbolization. See manual for details.
1.1.1 (2014-01-25)
Introduced a very short execution delay to avoid problems with the recognition of modifier keys.
Updated the manual and mentioned the possibility to work with a longer launch delay in order to be able to use the modifier keys asynchronously (after script launch).
1.1.0 (2013-12-16)
Added feature: Exclude generated PDF from Time Machine backup.
Updated manual.
1.0.3 (2013-11-14)
Manual is again accessible from “Help” in the main options window.
1.0.2 (2013-11-14)
If in Product Mode all purging tools (tex, PDF) now target the product file’s directory.
1.0.1 (2013-11-13)
Removed problems with some tools not working properly.
1.0.0 (2013-10-25)
Rewrite of the notification system: Script will now detect on which system version it is running. On Mavericks the new AppleScript access to notifications will be used (‘display notification’); on Mountain Lion the tool ‘terminal notifier’ will be used (as before); on older systems notification commands will be entirely disabled.
Typeset error sound now changes randomly.
Fixed run counter, so that the message with the shortcut hints will pop up again. (After 1st complete run and one more time later.)
Manual updated.
0.9.9 (2013-10-24)
Selection of Ctx Current is now remembered again.
Current problem with OS 10.9: Notifications from terminal notifier don’t show up. I will re-write the script to make use of the new “display notification” AppleScript command.