29.05.2014 Views

how to install ConTEXt - Pragma ADE

how to install ConTEXt - Pragma ADE

how to install ConTEXt - Pragma ADE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>how</strong> <strong>to</strong> <strong>install</strong><br />

ConT E Xt


1<br />

Introduction<br />

Nowadays most T E X users will use one of the many distributions that are available for<br />

free or commercially. This means that much of the hard work of <strong>install</strong>ation is already<br />

taken care of. When <strong>install</strong>ed properly, the user will quite certainly have the binaries,<br />

hyphenation patterns, fonts and some macro packages on the system.<br />

This manual is therefore not targeted at <strong>install</strong>ing T E X, but focusses on <strong>how</strong> <strong>to</strong> get<br />

ConT E Xt running within an existing distribution. When, after reading this text, you<br />

still cannot get ConT E Xt working properly, we advice you <strong>to</strong> contact the maintainer<br />

of your distribution, or <strong>to</strong> send your questions <strong>to</strong> the ConT E Xt mailing list.<br />

Unpacking the archives<br />

The ConT E Xt distribution consists of several zipped archives. You need <strong>to</strong> unpack<br />

these <strong>to</strong> the appropriate direc<strong>to</strong>ry of you file system. The archives are zipped using<br />

the free zip program, and can be unzipped using its counterpart. 1 Just type:<br />

unzip -a .zip<br />

Everything you need <strong>to</strong> get started can be found in the main ConT E Xt archive:<br />

cont-tmf.zip<br />

the ConT E Xt sources and programs<br />

There are some more archives, like the one with METAPOST <strong>to</strong>ols and the still experimental<br />

T E Xwork editing environment. We just mention them here, since you don’t<br />

need them when you fetched the main archive.<br />

cont-mpd.zip<br />

cont-wrk.zip<br />

a couple of METAPOST <strong>to</strong>ols<br />

the T E Xwork editing environment<br />

There are two more somewhat redundant archives. These can be useful for users of<br />

packages other than ConT E Xt. If you are using the files from cont-tmf.zip, it is not<br />

necessary <strong>to</strong> include the files from these archives.<br />

cont-ppc.zip<br />

cont-uti.zip<br />

the ppchT E X only files<br />

the T E Xutil program<br />

To prevent duplication in files, we strongly advise <strong>to</strong> obey the path as coded in the<br />

archives. The files in these archives will be unpacked in<strong>to</strong> the appropriate direc<strong>to</strong>ries<br />

Shareware programs like WinZip for MSWindows also work well.<br />

1


2<br />

of the official texmf tree. Some files are s<strong>to</strong>red in the direc<strong>to</strong>ries for generic T E X files<br />

or the L A T E X package, but those are not important for ConT E Xt users.<br />

texmf/tex/context/config<br />

texmf/tex/context/base<br />

texmf/tex/context/extra<br />

texmf/tex/context/sample<br />

texmf/tex/context/user<br />

texmf/tex/context/third<br />

texmf/metapost/context<br />

texmf/context/config<br />

texmf/context/data<br />

texmf/context/perltk<br />

texmf/doc/context/base<br />

some configuration files<br />

all ConT E Xt core files, modules<br />

some goodies<br />

a couple of sample files<br />

user specific files<br />

third party contributions<br />

the METAPOST modules<br />

some configuratiom files<br />

data filed used by scripts<br />

the Perl scripts<br />

ConT E Xt documentation<br />

Users can best not put files in the base, extra and sample direc<strong>to</strong>ries. That way they<br />

can conveniently be removed and re<strong>install</strong>ed. The files in third are <strong>to</strong> be organized<br />

by author. 2<br />

On unix, the Perl scripts should be <strong>install</strong>ed without the .pl extension, because<br />

these scripts and possibly other programs rely on these names. They should be<br />

moved <strong>to</strong> the search path for binaries and scripts. On MS Windows running scripts<br />

is not supported by the operating system. In the perltk path you can find a zipped<br />

file with the executable runperl.exe, written by Fabrice Popineau. When copied <strong>to</strong><br />

.exe, this program launches the script with the same name.<br />

The initialization files for T E Xexec go in<strong>to</strong> texmf/context (teT E X) or in<strong>to</strong> the same<br />

direc<strong>to</strong>ry as the binaries. When setting up teT E X, make sure you enable generation of<br />

the format files, by uncommenting the lines that specify the ConT E Xt formats. You<br />

can edit the teT E X (and fpT E X) configuration file using:<br />

fmtutil<br />

In teT E X you should pass the switch --edit. When you pass --all you get all formats.<br />

When in need for patterns other than the default ones, texconfig can be used <strong>to</strong><br />

enable more hyphenation patterns in the file cont-usr.tex. You can also edit this<br />

file directly.<br />

ConT E Xt comes with a font that contains navigational symbols. These fonts go <strong>to</strong> the<br />

corresponding places in the fonts tree, in our case:<br />

You need <strong>to</strong> create this (yet empty) direc<strong>to</strong>ry yourself.<br />

2


3<br />

texmf/fonts/tfm/hoekwater/context<br />

texmf/fonts/afm/hoekwater/context<br />

texmf/fonts/type1/hoekwater/context<br />

the files with suffix tfm<br />

the files with suffix afm<br />

the files with suffix pfb<br />

There is also a ConT E Xt specific encoding/map file. This one is s<strong>to</strong>red in the following<br />

path:<br />

texmf/dvips/config<br />

ConT E Xt fontmap file<br />

Don’t forget <strong>to</strong> add a reference <strong>to</strong> this file context.map <strong>to</strong> the pdftex.cfg file that<br />

resides in the pdfT E X configuration direc<strong>to</strong>ry.<br />

map +context.map<br />

Setting up T E XEXEC<br />

T E Xexec is the command line interface <strong>to</strong> ConT E Xt.<br />

running ConT E Xt in the traditional way, like<br />

There is nothing wrong with<br />

pdfetex<br />

&cont-en filename<br />

or for a web2c bases T E X<br />

pdfetex<br />

&cont-en --progname=context filename<br />

but, and this will be more clear when we provide more options, the next call is more<br />

convenient:<br />

texexec<br />

filename<br />

This not only hides the implementation specific switches, but also removes the need<br />

for specifying the format.<br />

T E Xexec is written in Perl, a scripting language that is available on most leading<br />

software platforms. In order <strong>to</strong> operate well, we need <strong>to</strong> set up T E Xexec. Of course<br />

you must have Perl running on your system. On unix systems, this is always the<br />

case, but for MS Windows you have <strong>to</strong> <strong>install</strong> Perl yourself. 3 .<br />

First you have <strong>to</strong> move T E Xexec and its relative T E Xutil <strong>to</strong> a location in the binaries<br />

path. When issuing the command texexec you should get some response. Even<br />

better, when saying:<br />

A good choice is the Active State distribution that you can fetch from www.activestate.com<br />

3


4<br />

texexec<br />

--verbose<br />

you should get some information on <strong>how</strong> T E Xexec is set up. When generating formats<br />

and processing files fail, you need <strong>to</strong> set up the initialization file texexec.ini. This<br />

file comes disguised as texexec.rme, so when not present, you need <strong>to</strong> copy this<br />

file. The initialization file should be present in the config path, or in the same path<br />

as the script. Next you need <strong>to</strong> edit this file. The simplest way is <strong>to</strong> comment and<br />

uncomment one of the following lines:<br />

set TeXShell <strong>to</strong> tetex<br />

%set TeXShell <strong>to</strong> fptex<br />

%set TeXShell <strong>to</strong> miktex<br />

%set TeXShell <strong>to</strong> private<br />

When this is done, you should check <strong>to</strong> what extent the rest of the variables in this<br />

file match the local settings. We hope that the names of the variables used are clear.<br />

When it is not set up properly, T E Xexec tries very hard <strong>to</strong> locate the files it needs.<br />

Normally T E Xexec should start up rather quickly. When you are under the impression<br />

that you are waiting <strong>to</strong>o long, there is probably an error in the setup.<br />

Using TET E X<br />

When you are using teT E X or derived distributions, you can usually stick <strong>to</strong> the regular<br />

updates, unless you want <strong>to</strong> use the latest version of ConT E Xt. In any event, you<br />

should make sure that only one copy is present on your system, because otherwise<br />

files can get mixed, due <strong>to</strong> the often aggressive file searching algorithms. If you want<br />

<strong>to</strong> update anyway, you can unzip cont-tmf.zip from within the texmf direc<strong>to</strong>ry and<br />

regenerate the format files.<br />

The ppchT E X only archive is for users who maintain their own files and only want <strong>to</strong><br />

<strong>install</strong> this package. The T E Xutil archive is for those who want <strong>to</strong> use this script, but<br />

don’t want <strong>to</strong> <strong>install</strong> ConT E Xt. Neither archive is needed when you <strong>install</strong> ConT E Xt<br />

from cont-tmf.zip.<br />

Using FPT E X<br />

The first step in <strong>install</strong>ing ConT E Xt under fpT E X, is <strong>to</strong> unzip the file cont-tmf.zip<br />

within the texmf direc<strong>to</strong>ry. Afterwards the texexec binaries and Perl script should


5<br />

be copied <strong>to</strong> the direc<strong>to</strong>ries that contain the other T E X binaries. The T E X binaries path,<br />

that should also be part of your PATH variable, often looks like:<br />

../tex/bin/win32<br />

When no file texexec.exe is found, you have <strong>to</strong> unzip texexec.zip and copy<br />

runperl.exe <strong>to</strong> texexec.exe. Don’t forget <strong>to</strong> update the ls-R file database by<br />

running mktexlsr.<br />

Next you need <strong>to</strong> locate the file texmf/web2c/fmtutil.cnf. In this file, which contains<br />

documentation, you need <strong>to</strong> activate the ConT E Xt formats. Now you can run:<br />

texexec --make<br />

When everything is <strong>install</strong>ed properly, T E X generates one or more formats.<br />

T E Xexec fails, you have <strong>to</strong> check the file texexec.ini.<br />

When<br />

Using MIKT E X<br />

This section is provided by Grzegorz Sapijaszko and Ed L. Cashin and concerns the<br />

<strong>install</strong>ation of ConT E Xt under MikT E X. Installation in the MikT E X environment isn’t<br />

much different from the teT E X <strong>install</strong>ation. Nevertheless, you should take a few steps<br />

<strong>to</strong> achieve good results. The first one is copying a texexec.rme file <strong>to</strong> texexec.ini<br />

and uncommenting the lines for MikT E X as follows:<br />

%set TeXShell <strong>to</strong> tetex<br />

%set TeXShell <strong>to</strong> fptex<br />

set TeXShell <strong>to</strong> miktex<br />

%set TeXShell <strong>to</strong> private<br />

In next step you should add a string \context\perltk <strong>to</strong> your environment variable<br />

PATH (in au<strong>to</strong>exec.bat under Win9x, or in Control Panel in WinNT), for example:<br />

PATH=c:\miktex\context\perltk;<br />

If you are using languages other than Dutch, German or English, you should uncomment<br />

the lines in the cont-usr.tex file for the hyphenation patterns of the languages<br />

you need. After that you can refresh the filename databases, for example, by using<br />

“Refresh Filename Databases” from the “Start Programs MikTeX Maintenance” menu<br />

or “MikT E X Options” menu, depending on the version you run. You should also generate<br />

a format file. This is described in the next section. Notice that you should have<br />

Perl <strong>install</strong>ed on your system.


6<br />

After generating the formats you should copy the format file cont-xx.fmt from<br />

\context\perltk <strong>to</strong> the direc<strong>to</strong>ry where MikT E X is s<strong>to</strong>ring formats (usually<br />

\localtexmf\miktex\fmt). Another way is <strong>to</strong> add a \context\perltk direc<strong>to</strong>ry<br />

<strong>to</strong> miktex.ini file:<br />

[MiKTeX]<br />

...<br />

...<br />

;; Where MiKTeX searches for .fmt files.<br />

FMTPath=.;%R\miktex\fmt;C:\localtexmf\context\perltk//<br />

As a convenience, you can copy the runperl.exe file from the cont-wrk.zip archive<br />

<strong>to</strong> texexec.exe. You should make sure sure that those binaries are in the same<br />

direc<strong>to</strong>ry as the Perl scripts.<br />

Generating formats<br />

From its name you can deduce that ConT E Xt is written in the typographic language<br />

T E X. ConT E Xt is parameter driven, which means that users change its behaviour by<br />

setting variables and changing keys. ConT E Xt comes with a multi--lingual interface.<br />

Currently there are three such interfaces: Dutch, English and German.<br />

Users who want complete control can edit the file cont-usr.tex and generate a<br />

format using the main file context.tex. Users who want an Dutch, English or German<br />

format, can stick <strong>to</strong> the files named cont-nl, cont-en, and cont-de. Again, by editing<br />

the file cont-usr.tex, you can influence the outcome.<br />

In the early years of T E X, generating a format was common practice and users were<br />

pretty well aware of format files, hyphenation patterns and fonts. Nowadays, disributions<br />

take care of the more complicated issues, so users can comfortably skip many<br />

nasty <strong>install</strong>ation steps. To make life even more comfortable, ConT E Xt comes with<br />

T E Xexec, a command line interface <strong>to</strong> T E X. When properly set up, this Perl script can<br />

save you much time.<br />

For instance, generating the three formats mentioned is accomplished by:<br />

texexec --make en de nl<br />

When T E Xexec is set up properly, this command should work. Before you read on,<br />

you should try <strong>to</strong> generate at least the English and Dutch format. The Dutch format<br />

is needed by some of the postprocessing features built in<strong>to</strong> T E Xexec.


7<br />

texexec --make en nl<br />

Additionally, you need <strong>to</strong> make the MetaFun format. This is an extension <strong>to</strong> the standard<br />

METAPOST format which offers not only more features, but also interfaces quite<br />

well <strong>to</strong> ConT E Xt.<br />

texexec<br />

--make metafun<br />

The formats associated with the interfaces default <strong>to</strong> the language of the interface.<br />

This is all right for Dutch, English or German users, but Polish and Czech users are<br />

worse off. For them a format file that defaults <strong>to</strong> their own language makes more<br />

sense. Poles will like <strong>to</strong> say:<br />

texexec --make --language=pl --bodyfont=plr en<br />

while Czech people will go for:<br />

texexec --make --language=cz --bodyfont=csr en<br />

Both produce a format called cont-en with an English interface, but the first one<br />

defaults <strong>to</strong> Polish hyphenation patterns and fonts, and the second one <strong>to</strong> Czech ones.<br />

If wanted, you may pass a comma separated list of languages.<br />

texexec --make --language=pl,it,uk --bodyfont=plr en<br />

or, <strong>to</strong> generate a english interface format with Czech and Slovak patterns and Czech--<br />

Slovak Computer Modern Roman fonts:<br />

texexec --make --language=cz,sk,en --bodyfont=csr en<br />

Unfortunately, the hyphenation patterns are of hard coded in a format file and cannot<br />

be loaded at run time. When patterns are needed other than the ones loaded by<br />

default, you can consider adapting the file cont-usr.tex. This file is loaded at<br />

format generation time. When for instance Italian patterns are <strong>to</strong> be used, given that<br />

these are available either in the file lang-it.pat, or in a file on<strong>to</strong> which this filename<br />

is mapped, you should uncomment the line:<br />

\<strong>install</strong>language [\s!it] [\c!status=\v!start] % italian<br />

The strange looking \s! and \c! things are needed in order <strong>to</strong> support multiple<br />

interfaces. Don’t <strong>to</strong>uch these!<br />

When using web2c, in texmf.cnf some ConT E Xt specific memory settings take place.<br />

When directly generating a format —i.e. when you’re not using the teT E X initialization<br />

script or T E Xexec— you should supply the program name: -progname=context


8<br />

Make sure you read the manual <strong>to</strong> T E Xexec. Apart from the normal processing of files,<br />

there are quite a few useful options: mode dependant processing, output selection,<br />

generating booklets, typesetting contact sheets of figures, manipulating pdf files, and<br />

more.<br />

Changing defaults<br />

The somewhat more run--time specific settings, like certain special drivers, can be<br />

added <strong>to</strong> cont-sys.tex. This file is loaded at run time. For instance, this file can can<br />

contain the line:<br />

\setupoutput[pdftex]<br />

This commands tells ConT E Xt <strong>to</strong> produce pdf output by default. For Y&Y and Acrobat<br />

support, you just say:<br />

\setupoutput[dviwindo,acrobat]<br />

Of course you can also load location specific layout settings in this file. The next few<br />

lines tell ConT E Xt <strong>to</strong> default <strong>to</strong> the ConT E Xt navigational symbols, instead of the ones<br />

composed from other glyphs.<br />

\usesymbols [nav]<br />

\setupsymbolset [navigation 1]<br />

At <strong>Pragma</strong> <strong>ADE</strong> we want <strong>to</strong> process METAPOST files at run--time, so there we also have<br />

entries like:<br />

\recycleMPslotstrue<br />

\runMPgraphicstrue<br />

\runMPTEXgraphicstrue<br />

\useMETAFUNformattrue<br />

The first setting leads <strong>to</strong> less intermediate files. The next two settings let ConT E Xt<br />

process the graphics real--time. For that you need <strong>to</strong> enable write18 in the T E X<br />

configuration file (for web2c this is texmf.cnf). The last setting only makes sense if<br />

you have also generated a MetaFun format. If you want <strong>to</strong> know more about MetaFun,<br />

take a look at its manual.<br />

The verbatim environments provide pretty printing. When you want even more fancy<br />

verbatim, for instance with in--between switching of a language interpreter, you should


9<br />

enable this feature. If you get no idea what we’re talking about here, leave this variable<br />

un<strong>to</strong>uched since tricky code is involved.<br />

\newprettytrue<br />

When ConT E Xt cannot determine the dimensions of an external figure, and no<br />

texutil.tuf file is present, you can let ConT E Xt call T E Xutil directly. If you use<br />

pdfT E X, you can leave this switch off.<br />

\runutilityfiletrue<br />

Morethan one instance of T E X a single path, can lead <strong>to</strong> clashes in temporary files. The<br />

next switch enables a filename security feature:<br />

\protectbufferstrue<br />

For the moment, we use these low level boolean switches instead of more readable<br />

commands.<br />

An important section in this file are the font defaults. You can set a default font<br />

encoding as well as enable map file loading for pdfT E X. Soem of these features are still<br />

experimental.<br />

The WEB2C configuration<br />

Although not stricktly needed, ConT E Xt will operate more smoothly when these features<br />

are set in the file texmf.cnf.<br />

openout_any = a<br />

shell_escape = t<br />

allow_multiple_suffixes = f<br />

The first line permits ConT E Xt <strong>to</strong> open parent paths that can hold common styles.<br />

The second line enables enables users <strong>to</strong> embed METAPOST code in their document.<br />

As a result, METAPOST is called au<strong>to</strong>matically. 4 The last line makes sure that when<br />

opening files like somefile.tuo, T E X will not try <strong>to</strong> open somefile.tuo.tex first.<br />

When you embed T E X code in a METAPOST definition, using btex ... etex, the next<br />

line will use T E Xexec <strong>to</strong> process that fragment in the case of using METAPOST directly.<br />

You can disable this feature by running T E Xexec with the switch --au<strong>to</strong>mp.<br />

4


10<br />

MPXCOMMAND=texexec --mptex<br />

Processing files<br />

You can test you <strong>install</strong>ation with the following file.<br />

\starttext<br />

\framed {Let’s see if it works.}<br />

\s<strong>to</strong>ptext<br />

If ConT E Xt is set up properly, then the command<br />

texexec<br />

filename<br />

will produce a file filename.dvi. Unless a file was already processed before, you<br />

will notice that T E Xexec processes the file at least two times. During a T E X run,<br />

ConT E Xt saves information in the files filename.tui: cross references, entries <strong>to</strong><br />

the table of contents, data needed for optimization, etc. If the run is succesful, this<br />

file is converted <strong>to</strong> a file called filename.tuo and used in the next run. T E Xexec will<br />

reprocess the file until the tuo file is unchanged.<br />

We strongly recommend <strong>to</strong> use pdf-ε-T E X: Peter Breitenlohners ε-T E X permits ConT E Xt<br />

<strong>to</strong> run more efficient, while Hàn Thê´ Thành’s pdfT E X provides pdf output and pdf-ε-T E X<br />

combined both in one program. For those unfamiliar with ε-T E X: this is an extension<br />

of T E X that is not only more efficient and in some aspects faster, but that also offers<br />

a few features that come in handy when writing complicated code. For the moment,<br />

ConT E Xt adapts its behaviour <strong>to</strong> the kind of T E X that is used, but future versions may<br />

rely on ε-T E X or other descendants completely.<br />

By default, ConT E Xt generates dvi output for dvips, unless the output is specified<br />

otherwise. We already mentioned the \setupoutput command. A second way of<br />

achieving this is:<br />

texexec --pdf filename<br />

And yet another way is adding a comment line in the document source, like:<br />

% interface=en output=pdftex translate=cp1250pl<br />

or<br />

% interface=en output=pdftex translate=cp1250cz


11<br />

Now we can omit the --pdf switch when we launch T E Xexec. Normally T E Xexec is able<br />

<strong>to</strong> sort out the interface itself, but in case of troubles, you can set some defaults in the<br />

file texexec.ini. The translate key is only needed when you use the reencoding--<br />

on--the--fly feature of web2c.<br />

Subscribing <strong>to</strong> the list<br />

There are two dedicated mailing lists hosted by the ntg:<br />

the ConT E Xt mailing list<br />

the ppchT E X mailing list<br />

These lists are so called majordomo ones, therefore you should send a subscription<br />

command <strong>to</strong>:<br />

majordomo@ntg.nl<br />

Just send a message <strong>to</strong> this address with the body text:<br />

subscribe ntg-context<br />

Of course you can also directly contact the authors at:<br />

<strong>Pragma</strong> <strong>ADE</strong>: pragma@wxs.nl


PRAGMA<br />

Advanced Document Engineering Ridderstraat 27 8061GH Hasselt NL<br />

tel: +31 (0)38 477 53 69 email: pragma@wxs.nl internet: www.pragma-ade.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!