Windows Installation

From Wiki
Jump to navigation Jump to search

In order to be able to run ConTeXt under Windows, you will need the following:

  • a stand-alone ConTeXt distribution or any other TeX distribution (such as MikTeX, TeX Live, ... )
  • Perl, Ruby and GhostScript (Perl and Ruby are script languages, GS is a PostScript and PDF interpreter)
  • some Text editor
  • PDF viewer (Adobe Reader, GSview or any other)

General

Updating

You have to bear in mind that ConTeXt is being developed reasonably fast (see Release Notes), so it's recommended to update it regulary. Updating in MikTeX is "one-button-click" operation, updating the stand-alone version means unziping cont-tmf.zip to the proper folder and remake formats. Recent ConTeXt versions allow you to update with

ctxtools --update

But you need to update cont-win.zip every now and then as well (no matter which distribution you use)!

Older versions of Windows

The stand-alone distribution only works for newer versions of Windows that have cmd.exe instead of command.com as command interpreter. Running it on Windows 98 (or earlier) is also possible, but needs some tweaking (hardcoding the paths in .bat script). If you really need that and can't make it work alone, try to ask Taco.

Which ConTeXt distribution to choose?

MikTeX is great tool for people typsetting in LaTeX. Updating the packages is easy and packages are downloaded automatically if you need them. But on the other hand it's not adapted for ConTeXt well enough. ConTeXt is working in MikTeX 2.4 (and with some manual changes in 2.5 as well), but some new features aren't and the new updates are sometimes really way behind the time.

The stand-alone ConTeXt is much better in the way that it is always up-to-date, the environment is set up properly and some special functionality that doesn't work in MikTeX should work here as expected. The only drawbacks (although I don't really dare to call them drawbacks) are that you have to have some other distribution working in parallel if you need LaTeX as well and that the installation and updates are not automatic (though still straightforward).

You can use both MikTeX and the stand-alone distr. simultaneously though.

There's another (not so popular) TeX distribution, W32TeX which is probably the only one so far which includes XeTeX. Comes with the latest ConTeXt as well.

I don't know XEmTeX. If anyone is willing to share the experince with other users, you're wellcome to do so.

Stand-alone ConTeXt distribution

Installation Instructions


TODO: I made an example how to use the stand-alone distr. isolated from an existing distro. I would like to "join" this somehow with the first section and move opening of cdemo.bat to something like testing the installation. Perhaps pragmatex.bat can be executed with autorun or something if one is not using another TeX distribution. (See: To-Do List)


by Ville Voipio on the mailing list, 2006-01-19 (modified)

Here is a step by step of how it should go (i.e. what I did with success):

  1. Install Perl and Ruby
  2. Download mswincontext.zip, unzip it and move/rename the isoimage folder to your favourite destination. The instructions to follow assume that you renamed isoimage to
    c:\Programs\context
    There should be one folder (usr) and a few files in it.
  3. Open the folder c:\Programs\context and double-click cdemo.bat.
  4. Now you should see the editor SciTE open with a few files. Press F7 to compile one of the files.

If everything goes smoothly, you are done. If not, read these instructions again carefully. If you cannot get it work, mail the list.


TODO: review this steps: change step numbers and join the information - notes about ruby, Acrobat, ... apply to all windows distributions. (See: To-Do List)


A few notes on the procedure above:

  • It is up to you to choose the location where you unzip the file in step #5, no magic there. Just that you know where the files are.
  • The actual location of the ConTeXt in step #6 tree does not matter. I use c:\context, but you might use something else. However, I would not use anything with a space in the name (e.g. c:\Program Files\context), as that may confuse things. (Has anybody tried lately?)
  • After you have verified everything works in step #9, you can toss cdemo.bat away and use cstart.bat to start everything. Make a link to it somewhere so that you can start the system by a shortcut or through the Start menu. Do not move the batch script anywhere, it has to be run in the root directory of the distribution (e.g. c:\Programs\context).
  • Make sure you have something Acrobatish (any decent PDF viewer) installed, otherwise you won't see the results in step #9.
  • A final note: to have it finally running you should build the formats first. To do so there is at least a way:
 (assuming C:\Programs\context)
 Start->Run->cmd
 cd C:\Programs\context
 cdemo.bat
 Then close the SciTe window but remain in the cmd.
Then, in one line:
C:\Programs\context\usr\local\context\tex\setuptex.bat C:\Programs\context\usr\local\context\tex
 texexec --make --all
Then, close the cmd, double click in cdemo.bat
and voila !
  • Another way to do it could be to type: texexec --make --all directly in SciTe console.

How to use the stand-alone distr. if you have MikTeX/TeX Live installed

  1. Create a file pragmatex.bat (the name doesn't really matter) with this content:
    C:\Programs\context\usr\local\context\tex\setuptex.bat C:\Programs\context\usr\local\context\tex
    and make sure that this file is visible by PATH.
  2. You can safely continue using your old TeX distribution (MikTeX, TeX Live, ...). If you want to invoke the stand-alone distribution, just execute
    pragmatex
    from the command-line and all the subsequent calls to texexec will use files from the stand-alone tree (you'll notice the difference in file names when running ConTeXt).

Updating the installation


TODO: explain the best way for updating (See: To-Do List)


MikTeX or ProTeXt

MikTeX is probably the easiest and most recommended solution for newbies or for those who have already been using LaTeX and don't want to install anything else. MikTeX is very user-friendly, updating is very easy.

However, some more experienced users may not always be happy with it:

  • using fonts doesn't always work as expected (or at least different than in the stand-alone distribution)
  • ConTeXt format is usually recent, but not always the latest

MikTeX packages that you need

Try running

texexec --version

In most cases MikTeX should install the required package for ConTeXt automatically (if not installed yet). Don't ask me why Russian und Ukrainian hyphenation patterns have to be downloaded as well.

Additional steps

The following steps are highly recommended (and mandatory for MikTeX 2.5). It would be really nice if MikTeX developer would do that for you - Perhaps it will help if more people ask for it politely.

  • Download cont-win.zip and copy texmfstart.exe from the zip file into [MikTeX PATH]\miktex\bin (update that file every now and then)
  • Download cont-tmf.zip and copy the content to MikTeX folder (replace old files).
  • Put [MikTeX PATH]\scrips\context\stubs\mswin in PATH variable before [MikTeX PATH]\miktex\bin.
  • Delete the folder fonts/map/dvipdfm or (proper solution) set
TEXFONTMAPS = .;$TEXMF/fonts/map/{$progname,pdftex,dvips,}//
(I didn't yet check how the latter can be done.)
  • (Open new cmd and check if texexec works. I'll put some more notes here.)
  • Go to next step (refreshing file name database, updating formats, ...)

Comments (skip them):

  • Downloading cont-tmf.zip is not mandatory, but it's easier to explain the other steps then. If you don't want to do it, create an arbitrary folder at some arbitrary place and put it in PATH before MikTeX bin. Create at least texexec.bat with the following content in it:
texmfstart [new]texexec.rb %*

After you install or change something

  • MikTeX Options -> General -> File name database -> Refresh Now
  • MikTeX Options -> General -> Format Files -> Update Now
  • MikTeX Options -> Roots -> [select one] -> Refresh FNDB

(Don't forget to run the MikTeX Update Wizard regularly!)

If you have any problems running ConTeXt, check

  • MikTeX Options -> TeX Formats -> cont-en -> Edit

The following should be set:

Compiler:         pdfe-TeX (Exteded Mode)
Input File Name:  cont-en.tex
Output File Name: ? (I've seen it empty & with name)
Preloaded Format: [empty]
Description:      [anything]
Exclude when updating: [unchecked]

After Apply-ing and Build-ing, Refresh & Update as described above. This is the MikTeX way for doing

texexec --make --en

The latter has no influence since MikTeX doesn't set any system variables and consequently ConTeXt doesn't know where to leave the created formats.

Additional settings (for those who use MetaFun)

Some default "security settings" (not really relevant for you unless you run it on a server) may cause you troubles, esp. when using MetaFun. Do the following:

  • In [MikTeX PATH]\tex\context\user\cont-sys.tex uncomment the following lines:
\runMPgraphicstrue
\runMPTEXgraphicstrue
  • In case the file doesn't exist yet, copy the file cont-sys.rme (in the same folder) to cont-sys.tex first. cont-sys.rme may change every now and then, so check for major changes from time to time and update your cont-sys.tex accordingly.
  • Create a file [localtexmf PATH]\miktex\config\miktex.ini and add the following line to it:
write18=enable

(Because of some unknown reason, write18=enable in [localtexmf PATH]\miktex\config\miktex.ini may be ignored on some computers. In that case make the change in [MikTeX PATH]\miktex\config\miktex.ini, but you may have to repeat this step every time you update MikTeX packages.)

([MikTeX PATH] and [localtexmf PATH] are chosen during the installation. If you don't know what they are, take a look at MikTeX Options -> Roots)

I don't know why and when exactly this is needed (MPtoPDF may cause problems), but

set TEXSYSTEM=miktex

may help you solving some problems.

W32TeX

The only Windows distribution so far that comes with XeTeX.

TeX Live or XEmTeX

Installation instructions are part of the documentation.


TODO: can someone with any experience write something about it? (See: To-Do List)


Required and Useful Tools

Installing Perl and Ruby

You need the two scripting languages in other operating systems as well, but installing them under Windows may be a bit less intuitive for a newbie than under Linux.

You can download ActivePerl here and Ruby here or here (different one; might be better - you only need to extract files from zip).

After installing them (remember the folder where you've put them!) you have to check if both executables are included in the PATH. Open the command line (Start -> Run ... -> type cmd or command) and check if

perl --version

and

ruby --version

work OK.

If windows complains about "Command not found", go to the Control Panel -> System -> Advanced -> click on the "Environment variables" and choose path in "system variables". Type in the path (e.g. D\Program Files\Perl\bin\;) where the ruby and perl *.exe files are installed. Generally, the installation is automatic. you may not need the above method.

(Installing ruby is optional under Windows, but nevertheless recommended. Some scripts need ruby, although it may happen that you will never use those scripts.)

A note about cygwin

(Skip this unless you know what you are doing!)

If you have a working perl and ruby under cygwin and if they are in PATH, this might already work for ConTeXt (although it's a better idea to use native Windows versions). However, if the inclusion of libraries in ruby fails (because of conversion of path names) and if you object to install ruby again, try setting the environmental variable RUBYLIB:

set RUBYLIB=/cygdrive/c/[Path to MikTeX or other distr.]/scripts/context/ruby

[1]

Installing GhostScript

If you already worked with (La)TeX before, you probably already have it installed. Try

gswin32 --version

You have to download GhostScript (filename gs851w32.exe or a similar one) and preferrably GSview as well (gsv47w32.exe or similar). Be sure to include the executables (folder where gswin32.exe is located) into the PATH variable.

Other useful software

Assuming that you already have Adobe Reader (if not, you can get it here; you don't need it to compile your documents, but at least to see the results), there is still some software still worth mentioning.

Choosing a Text editor & compiling

For newbies (like Word (ex)users)


TODO: Explain the difference between GUI/text editor/compiler/PDF document; people often ask me: "ConTeXt - oh, you mean that program with a blue screen and colourful fonts?" (See: To-Do List)


WinEdt has a rich graphical user-interface, but more support for LaTeX than for ConTeXt. (You need to install WinEdt AFTER the installtion of MikTeX, GhostScript and Adobe Reader for Windows.)

ConTeXt support for SciTE was written by Hans Hagen (the ConTeXt developer himself) and also includes recognition and auto-completion of most frequent ConTeXt commands.

According to their web-site: "TeXnicCenter is a feature rich integrated development environment (IDE) for developing LaTeX-documents on Microsoft Windows (Windows 9x/ME, NT/2000/XP) freely available under GPL." It can also be used for processing ConTeXt documents.


TODO: Someone should write how to install SciTE & ConTeXt support for it without installing the stand-alone ConTeXt. (See: To-Do List)


For gurus (like (La)TeX users or programmers)

You probably already have your favourite Text editor (or at least you know what we're talking about) and you may skip this. If not, take a look at the Text editor page to help you choose one.

  • Vim or Emacs may be a good choice if you're willing to invest some time into learning them - it may be worth the effort.

Compiling

After you've done all that, you can finally use your favourite editor to write your first document.

To compile it, open the command line again (Start -> Run ... -> type cmd or command) and run

texexec yourfilename

Some text editors support automatic compiling:

  • F?? in SciTE
  •  ?? in WinEdt
  • F?? in TeXnicCenter
  • see makefile for Vim