Open main menu

Changes

5,261 bytes added ,  08:26, 2 July 2022
m
Text replacement - "pragma-ade.com" to "pragma-ade.nl"
== Introduction ==
Context 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 installing setting up and maintaining [[Mark IV]].
== History ==
 
The most important original motivation for this page was that the [[TeX Live]] 2008 edition contained Mark IV, but it was only copied to the installed system, no post-install setup took place at all. For the Tex Live 2008 release, the post-install setup had to be done manually. TeX Live 2009 did not come with a usable Mark IV at all because the luatex on the 2009 editions was too old compared to the ConTeXt version. Instructions on how to deal with TeX Live 2009 were needed then. TeX Live 2010 has a working Context Mark IV out of the box: you can just run 'context' directly. At most, you could run `luatools --generate; context --make` to deal with any tlmgr updates you may have performed since installing TeX Live.
 
In TeX Live 2011, not even that is needed and you only have to run `mtxrun --generate` when files are installed manually ''outside'' of tlmgr. If you are running tl 2011, this page is just background information, there should be no need to take actual actions.
 
=== Special notes (TL 2008/2009): ===
 
* '''Windows''': Running Mark IV under Windows is the same as on Unix, but see [[Running_Mark_IV#In_case_of_trouble|below]] for a installation hints for the 'spaces in names' problem that seem to affect Windows users more often than other platforms.
 
* '''Debian''': Mark IV suggests the tex-gyre package ([[TeX Gyre - Old Content]]), not distributed currently under Debian due to licensing issues (see [[Debian installation]] )
 
=== Special notes (TL 2010): ===
 
* '''[[MacTeX]]''': You need to [[Running_Mark_IV#Updating_ConTeXt|update]] ConTeXt first.
== Quickstart ==
If you have trouble following these instructions, please direct you questions or complaints on the [http://www.ntg.nl/mailman/listinfo/ntg-context ntg-context mailing list], '''not''' the tex-live list. 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 # 2010 and earlieror mtxrun --generate # 2011 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: (tl2008/2009)''' the luatex executable does 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. [[Running_Mark_IV#File_not_found | Details]]. == 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 manual 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. Starting with 2011, formats are automatically (re)generated by `context myfile.tex` when it believes it is necessary to do so. Specifically: assuming the format already exists, automatic regeneration takes places whenever the ConTeXt version of the luatex version do not match the ones in the pre-existing format. Manual patches of the core files still require manual regeneration of the formats. The generated formats are stored inside the texmf cache. == Experimental speedup == In addition to standard [[luatex]] we provide [[luajittex]] which uses just in time compilation to speed up processing. The speedup is mostly due to the faster virtual machine. The exact speedup depends on the tex/lua ratio and we measured speedups between 10% and 40%. You force this engine with   context --jit .... Alternatively you can put
is the replacement for [[mktexlsr]]<texcode>% engine=luajittex</texcode>
context --make --compile on top of your main document source.
is the replacement for [[fmtutil]]== Using fonts ==
mtxrun --script The <code>OSFONTDIR</code> environment variable should contain the paths where the system fonts --reloadmust be looked for.
is needed if you want See [[Fonts in LuaTeX#Getting access to use the system fonts by font name (as opposed to file names)]]
== Downloaded files ==
== Filename and Configuration databases ==If you have the program 'curl' installed, then your input file can contain e.g.
=== Introduction ===<texcode>When you run\externalfigure [http://www.pragma-ade.nl/show-gra.pdf]</texcode>
context myfileand the referenced file will be downloaded automatically and placed in the 'texmf cache' if is not found in the cache already.
both the script 'context' and the Mark IV code inside the format have to find various files. To make this happen as fast as possible, a file name database is used. There is also some configuration information and some generated font data is cached because extracting the OpenType information is a relatively lengthy and memory-consuming process.== In case of trouble ==
All of this data stored inside the 'texmf cache'.=== File not found (TL 2008/2009) ===
=== Cache location ===* 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.
When 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. <code>C:/tlhome</code> is a good candidate.** In <code>texmf.cnf</code> set TEXMFHOME to <code>C:/tlhome/$USERNAME</code> 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 <code>texmfcnf.lua</code> and put a line like <code>return { TEXMFCACHE = 'C:/tlhome/$USERNAME/.texlive2008/texmf-var' }</code>, which sets each user's cache inside his space-free TeX home path.
luatools --generate== Cache internals ==
(this paragraph is run, it creates the file name database. To prevent duplication of settings as much as possible, it parses [[texmf.cnf]] as the source for discovering at what directory trees need to be indexed in the database. This ensures that while Mark IV does not actually use kpathsea, it is still compatible with how kpathsea handles things.developers and power-users only)
But 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 catch: luatools has to decide where on single subfolder with a hexadecimal name. This is the harddisk md5sum of the file name database should of the 'tex root' location (to be stored. This needs extra careprecise, because a runtime command like 'it is the md5sum of the full path expansion of the context myfile' does not look at texmf.cnflua equivalent of the TEXMFCNF variable).
The logic used for finding the cache location is as followsBelow this, there are currently four folders:
* If there '''curl''' contains downloaded files. The url is an environment variable named TEXMFCACHE, this will point converted to the desired harddisk locationsomething that can be represented on disk by replacing problematic characters by dashes* Otherwise, if '''fonts''' contains the web2c configuration directory contains a file named texmfcnfdata/names.luatma, this file is read the 'font name database' (and used to discover the desired location (see belowderived 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. * If that doesn't work either''formats''' contains the Mark IV format file* '''trees''' has a small set of files with hexadecimal names, a list one for each of the top-level constituents of 'likely' environment variables is testedTEXMF (containing the filename database for that tree), and one for each of the first variable found texmf.cnf files (containing in preprocessed form all the variables defined by that is set is assumed to point to file). The filenames are md5sums of the correct locationcontained directory or filename. This list is currently:
TMPDIR, TEMPDIR, TMP, TEMP, HOME, HOMEPATH
but there have been variants forms[[Category:Installation]]