Maintaining ConTeXt Minimals on Arch Linux

On Linux, and to a slightly lesser extent on Windows and Mac, TeX Live is the de-facto TeX distribution. However, TeX Live is not satisfactory to a ConTeXt user because the updates on TeX Live are slow. Only stable releases of ConTeXt are synced with TeX Live, while ConTeXt users are accustomed to the almost daily beta releases of ConTeXt. (So much so that if ConTeXt is not updated for a few days, users think that something is wrong with their setup).

An alternative TeX distribution for ConTeXt is ConTeXt Minimals. Its name, and motto, should not be confused with minimalism. On the contrary, ConTeXt minimals contains everything needed to run ConTeXt (well everything except ruby, which is used by MkII scripts) and once installed, it occupies a good 200MB disk space. It is minimal in the sense that if you took away anything from it, some functionality of ConTeXt would be crippled.

The Minimals is a rsync based distribution. I will not bore you with the installation instructions that are well explained on the ConTeXt wiki. The main advantage of the minimals is that it can be installed in parallel with an existing TeX distribution. So, you can continue to use TeX Live for LaTeX related stuff, while, at the same time, use the Minimals for ConTeXt related stuff.

Nonetheless, the Minimals are not completely satisfactory given the fickle nature of some of the ConTeXt beta releases. Sometimes, the beta has a serious bug and it is essential to revert to an earlier release. In the past, I used to take care of this my having multiple Minimal installations in parallel: one installation for the latest beta, one installation for the latest beta that does not break any of my projects, one installation for a critical project, and so on. However, keeping track of, and testing, all the installation became a chore. Since about an year now, I use only one installation that syncs to the latest beta release.

But what about reverting to an earlier release if something goes wrong? This is where Arch Linux’s package management comes in. Basically, in Arch Linux if you want to install a package that is not part of the standard distribution, you can build a binary package for that program using PKGBUILD and makepkg. The advantage of using this approach is that installation, update, removal, etc. of the package can be managed by the standard package management tool: pacman. In case of ConTeXt Minimals, an additional advantage of this approach is that you can keep the old binary packages around and revert to an earlier version if something goes wrong.

So, if you use Arch Linux and ConTeXt, try this alternative approach to installing ConTeXt minimals.

  1. Choose a directory where you will store the installation scripts and the binary packages. I use $HOME/Software for this.

  2. Clone context-pkgbuild from github.

    $ cd $HOME/Software
    $ git clone git://github.com/adityam/context-pkgbuild.git
    $ cd context-pkgbuild
    
  3. Build ConTeXt Minimals. The first time you do this, the script downloads around 200MB of data, so be patient. Subsequent updates are faster as only files that have changed are downloaded.

    $ makepkg
    

This will create a file called context-minimals-git-<year><month><date>.tar.gz, which is a compressed binary package.

  1. To install this package run

    $ pacman -U context-minimals-git-<year><month><date>.tar.gz
    

This installs ConTeXt Minimals at /opt/context-minimals/. To use ConTeXt Minimals, run

$ source /opt/context-minimals/setuptex

from the shell that you use to compile a document. If you run ConTeXt from an editor, you have to add that line to the editor’s startup scripts.

When you want to update to the latest beta, simply run

$ cd $HOME/Software/context-pkgbuild
$ makepkg

and a new binary package context-minimals-git-<year><month><date>.tar.gz will be created. Upgrade ConTeXt using

$ pacman -U context-minimals-git-<new-date>.tar.gz

Do not delete the old binary packages. If something goes wrong with the new beta, you can revert to the earlier version by reinstalling that package using

$ pacman -U context-minimals-git-<old-date>.tar.gz

This gives the best of both worlds: a complete and up-to-date ConTeXt distribution using the Minimals, and the ability to revert back to earlier releases using pacman. I have been using this setup for almost an year now, without any major glitches.

Advertisements

7 thoughts on “Maintaining ConTeXt Minimals on Arch Linux

  1. please recommend an editor and how to initialize that sourcing when launching the editor, thank you, using arch linux also

    • I use vim (in console mode, not gui). If you want to use a GUI editor and compile context from the editor, there are three ways:

      1. Run setuptex and then launch the editor from the command line.

      2. Create a script that source setuptex and then luanches the editor.

      3. Set the compile command of your editor as “source /opt/context/setuptex && context $1” (assuming $1 is filename).

  2. Attempted to install using this method, but missing files will not allow install to complete, most seem to be *.mkii type but perhaps only because it didn’t get as far as mkiv. have there been changes that I should reflect in the PKGBUILD?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s