Running Mark IV

From Wiki
Revision as of 10:58, 12 October 2008 by 81.57.248.225 (talk)
Jump to navigation Jump to search

Introduction

ConTeXt Mark IV does not use the kpathsea library to find files and configuration settings. It follows that running mktexlsr or fmtutil has no effect. This page explains the details of setting up and maintaining Mark IV.

The most important motivation for this page is that the TeX Live 2008 edition contains Mark IV, but it is only copied to the installed system, no post-install setup takes place at all. This year, the post-install setup has to be done manually.

If you have trouble following these instructions, please direct you questions or complaints on the ntg-context mailing list, not the tex-live list.


Special notes:

  • Windows: Running Mark IV under Windows is the same as on Unix, but see below for a installation hints for the 'spaces in names' problem that seem to affect Windows users more often than other platforms.
  • MacTeX: You need to update ConTeXt first.
  • Debian: Mark IV suggests the tex-gyre package, not distributed currently under Debian due to licensing issues (see Debian installation )

Quickstart

Just for the extremely impatient unix user that knows how to deal with a web2c-based TeX distribution and has a simple, private (single-user) installation, this is the only absolutely required extra knowledge:

 luatools --generate

is the Mark IV replacement for mktexlsr.

 context --make

is the Mark IV replacement for fmtutil.

 context myfile.tex

typesets a file.

Everybody else should read on.

A note for windows users: the luatex executable doest not accept filenames with spaces in their name. This means that if you are on windows you will at least have to set up a texmfcnf.lua as explained below, and you likely will even have to reinstall texlive, because the default texlive installation directory itself contains spaces. Details.

Updating ConTeXt

Updating is not absolutely necessary unless you use MacTeX, but most MKIV users will probably want to play with latest & greatest features.

There's a work-in-progress to create a TL repository on the garden with the latest ConTeXt and LuaTeX, so that TeX Live users should be able to upgrade ConTeXt automatically.

Until then you can update ConTeXt in different ways, for example with:

rsync -av rsync://contextgarden.net/minimals/current/context/current/ /usr/local/texlive/2008/texmf-dist/

To update LuaTeX you may use the following line (depending on your platform):

rsync -av rsync://contextgarden.net/minimals/current/bin/luatex/platform-garden/bin/luatex \
          /usr/local/texlive/2008/bin/platform-TL/

Which resolves to one of the following lines:

rsync -av rsync://contextgarden.net/minimals/current/bin/luatex/freebsd/bin/luatex       /usr/local/texlive/2008/bin/i386-freebsd/
rsync -av rsync://contextgarden.net/minimals/current/bin/luatex/linux/bin/luatex         /usr/local/texlive/2008/bin/i386-linux/
rsync -av rsync://contextgarden.net/minimals/current/bin/luatex/linux-64/bin/luatex      /usr/local/texlive/2008/bin/x86_64-linux/
rsync -av rsync://contextgarden.net/minimals/current/bin/luatex/osx-universal/bin/luatex /usr/local/texlive/2008/bin/universal-darwin/

You can upgrade XeTeX or metapost in the same way as LuaTeX.

Of course you need to repeat all the steps mentioned above, for MKIV:

luatools --generate
context --make

and for MKII:

mktexlsr
texexec --make --all
texexec --make --xtx --all

Note that this is a quick-and-dirty way to upgrade TL. Use at your own risk. One should be able to update in a more elegant way.

Generating and updating formats

Before first use and after each update to either the context distribution or the luatex executable you will have to regenerate the formats. The command for that is:

 context --make cont-en

This will generate a new Mark IV format with the English interface. Without an explicit format argument, it will generate four formats: Mark IV cont-en, Matk IV cont-nl, luatex+mptopdf, and luatex+plain.

The generated formats are stored inside the texmf cache.

Using fonts

Context Mark IV can use non-tex fonts (in OpenType, TrueType or Type1 format) directly. The first time that you run

 context myfile.tex

on a file that uses such non-traditional fonts (which is probably always), the actual fonts themselves have to be loaded in luatex's embedded section of fontforge to extract their metric information. This removes the need for tfm and vf files on your disk, but it is also a somewhat lengthy and often memory-hungry process.

That is why the results of that internal preprocessing are also saved inside the texmf cache. Future runs using the same font (not just this file, but all files using that particular font) can then use the cached version of the metrics instead.

Font name database

Because Luatex does not know about the names of fonts all by itself, Mark IV uses a database of 'known font names' to allow you to specify fonts by their internal name instead of the name of the disk file. The mtxrun script named 'fonts' maintains this database. At any time, you can run

 mtxrun --script fonts --list

to get the list of currently known fonts.

 mtxrun --script fonts --help

will show some other options.

Previously,

 mtxrun --script fonts --reload

was always needed if you wanted to use new fonts by their font name (as opposed to their file names).

In the latest beta (July 2008) versions of Mark IV this is no longer the case. In these new versions, the reload command is run automatically whenever a named font cannot be found.

Nowadays, you only have to do the reload manually when you have installed updates to already installed fonts that cause the font and/or file names to change. This normally only happens for fonts that are still in development like TeX Gyre and Latin Modern.

Downloaded files

If you have the program 'curl' installed, then your input file can contain e.g.

\externalfigure
  [http://www.pragma-ade.com/show-gra.pdf]

and the referenced file will be downloaded automatically and placed in the 'texmf cache' if is not found in the cache already.

In case of trouble

File not found

  • You may get errors like
 I can't find file `C:/Program.tex'.

This is likely caused by the luatex executable not handling filename quoting properly yet. If filenames with spaces work at all, you are just lucky.

This problem is most likely to happen on Windows. There two steps to deal with it:

  • You must put the main texmf tree in path without spaces. If you're installing Mark IV via TeXLive 2008, then simply change the top installation path at install time.
  • If you're running XP or Server 2003 (and not Vista or Server 2008), you must also set the TeX user home and the Lua cache to paths without spaces. C:/tlhome is a good candidate.
    • In texmf.cnf set HOMETEXMF to C:/tlhome/$USERNAME or to something similar of your liking. Using $USERNAME in the path will still give a per-user directory, just not under "Documents and Settings". This assumes that the user name doesn't have spaces of course...
    • As mentioned above, create/edit texmfcnf.lua and put a line like return { TEXMFCACHE = 'C:/tlhome/$USERNAME/.texlive2008/texmf-var' }, which sets each user's cache inside his space-free TeX home path.

Cache internals

(this paragraph is for developers and power-users only)

If you look at the folder that TEXMFCACHE points to, you will see a folder named luatex-cache. Inside that, there is the folder context. Inside the context folder, there usually is a single subfolder with a hexadecimal name. This is the md5sum of the name of the 'tex root' folder (aka SELFAUTOPARENT). Below this, there are currently four folders:

  • curl contains downloaded files. The url is converted to something that can be represented on disk by replacing problematic characters by dashes
  • fonts contains the file data/names.tma, this is the 'font name database' (and the derived names.tmc, tmc files are byte-compiled lua code for faster loading). There are also subdirectories containing the preprocessed metrics for non-tex fonts, one folder for each font type.
  • formats contains the Mark IV format file
  • trees has a small set of files with hexadecimal names, one for each of the top-level constituents of TEXMF (containing the filename database for that tree), and one for each of the found texmf.cnf files (containing in preprocessed form all the variables defined by that file). The filenames are md5sums of the contained directory or filename.