Difference between revisions of "ConTeXt Standalone"

From Wiki
Jump to navigation Jump to search
(Tell users to install LMTX instead)
 
(213 intermediate revisions by 61 users not shown)
Line 1: Line 1:
< [[Installation]] | [[ConTeXt Minimals/Structure]] | [[ConTeXt Minimals/Implementation]] >
+
{{note|You almost certainly want to [[Installation|install the newer ConTeXt LMTX]]. This guide is for installing the older, rarely-updated MkIV distribution.}}
  
The '''Minimals''' are an attempt to provide the same functionality as the current [http://www.pragma-ade.com/download-1.htm Pragma's minimal ConTeXt  distributions] in the zip files.
 
  
They are hosted on http://minimals.contextgarden.net (equivalent to '''rsync://contextgarden.net/minimals/''').
+
The '''ConTeXt suite''' is a complete, up-to-date ConTeXt distribution that can be upgraded efficiently. It can also be used in parallel with existing TeX installations such as MikTeX, TeXLive, and so forth. The suite does not include LaTeX packages and binaries.
  
Everyone is invited to test this distribution, but is kindly asked for patience and understanding until we tidy up the details. You need to have '''rsync''' installed, for windows it's shipped together with the minimals.
+
Sometimes ConTeXt beta releases have issues. The ConTeXt suite allows you to test the latest ConTeXt release without worrying whether upgrading will corrupt a critical project. Multiple ConTeXt suite installations are possible. This allows, for example, a stable version and a beta version to run in parallel on the same computer.
  
= Quick Start =
+
ConTeXt is also included in TeXlive. The ConTeXt suite is updated continuously, whereas ConTeXt in TeXlive is updated less often. In particular, <code>luatex</code> and <code>metapost</code> are under active development and their binaries are updated frequently. ConTeXt follows these developments, indeed often drives development. As the binaries included in the TeXlive distribution are only updated yearly, ConTeXt on TeXlive will necessarily be less current than the ConTeXt suite. The ConTeXt suite is self-contained and can happily coexist alongside another installed TeX distribution.
  
== Linux/Mac/FreeBSD ==
+
{{TOClimit|limit=1}}
  
mkdir context && cd context
+
= General Information =
rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh .
 
./first-setup.sh
 
''... go and have a coffee ...''
 
  
and then put something equivalent (depending on where you have placed ConTeXt) of
+
== Supported platforms ==
source ~/context/tex/setuptex ~/context/tex
 
to <code>~/.bash_profile</code> or do this each time when you want to initialize the environment to run the minimals:
 
cd ~/context/tex
 
. setuptex
 
or
 
. ~/context/tex/setuptex ~/context/tex
 
This will enable you to use both TeX Live and ConTeXt minimals without interferring with each other.
 
  
==Mac newbie installation and configuration==
+
{| style="border:1px solid #DDDDDD;"
 +
|- align="left"
 +
! Platform
 +
! Short name
 +
! Notes
 +
|- align="left" style="background-color:#EEEEEE;"
 +
! Windows
 +
| mswin
 +
| from [http://w32tex.org W32TeX]
 +
|- align="left"
 +
! Windows/CygWin
 +
| cygwin
 +
| same binaries as mswin
 +
|- align="left" style="background-color:#EEEEEE;"
 +
! Windows, 32 bit
 +
| win32
 +
| Alias for mswin
 +
|- align="left"
 +
! Windows, 64 bit
 +
| win64
 +
|
 +
|- align="left" style="background-color:#EEEEEE;"
 +
! Linux, 32-bit
 +
| linux
 +
| Debian 8
 +
|- align="left"
 +
! Linux, 64-bit
 +
| linux-64
 +
| Debian 8
 +
|- align="left" style="background-color:#EEEEEE;"
 +
! Linux, ARM (low end.)
 +
| linux-arm
 +
| Raspbian 8
 +
|- align="left"
 +
! Linux, musl
 +
| linuxmusl-64
 +
| Alpine
 +
|- align="left" style="background-color:#EEEEEE;"
 +
! Mac OS X, Intel (64-bit)
 +
| osx-64
 +
| Mac OS X 10.6
 +
|- align="left"
 +
! FreeBSD, 32-bit
 +
| freebsd
 +
|
 +
|- align="left" style="background-color:#EEEEEE;"
 +
! FreeBSD, 64-bit
 +
| freebsd-amd64
 +
|
 +
|- align="left"
 +
! OpenBSD 6.4, 32-bit
 +
| openbsd6.4
 +
|
 +
|- align="left" style="background-color:#EEEEEE;"
 +
! OpenBSD 6.4, 64-bit
 +
| openbsd6.4-amd64
 +
|
 +
|- align="left"
 +
! OpenBSD 6.5, 32-bit
 +
| openbsd6.5
 +
|
 +
|- align="left" style="background-color:#EEEEEE;"
 +
! OpenBSD 6.5, 64-bit
 +
| openbsd6.5-amd64
 +
|
 +
|- align="left"
 +
! Solaris, Intel
 +
| solaris-intel
 +
| Solaris 10 on [http://www.opencsw.org/about/ OpenCSW]
 +
|- align="left" style="background-color:#EEEEEE;"
 +
! Solaris, Sparc
 +
| solaris-sparc
 +
| Solaris 10 on [http://www.opencsw.org/about/ OpenCSW]
 +
|}
  
The following assumes that you want to use ConTeXt and you are a not inside unix world (otherwise, see before and after).
+
* If you run into problems installing, check the available architectures in the minimal’s [http://minimals.contextgarden.net/setup/ setup folder]!
It guides you to install ConTeXt minimal installation under Mac in the typical Applications folder. Then it gives you some information
+
* OpenBSD 6.4 binaries are compiled but are missing in the setup folder ATM (2019-07)
about how to configure [http://smultron.sourceforge.net/ Smultron] to work as an editor for ConTeXt.
 
Smultron is a mac-only, open source text editor which is very easy to use and at the same time powerful (see also [http://en.wikipedia.org/wiki/Smultron]).
 
  
===ConTeXt installation===
+
If you want to support a new platform, please write to the [[Mailing Lists]]
  
1. Create a folder inside your Applications folder and name it "ConTeXtMinimals"
+
== Dependencies ==
 +
* Rsync (The windows binary of rsync is distributed within the suite)
  
2. Open a Terminal window (i.e. go under Utilities and open the Terminal app: a little window pops up)
 
  
3. type this:
+
The following programs are not required for running ConTeXt, but their installation adds additional functionality.
<code>
 
cd /Applications/ConTeXtMinimals/
 
</code>
 
it means "change directory": now we are working under the folder we have created
 
  
4. type this:
+
* curl          : for including remote content
<code>
+
* ghostscript  : for converting PostScript images to PDF
rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh .
+
* graphicsmagick (convert) : for converting GIF and TIFF images
</code>
+
* inkscape      : for converting SVG and compressed SVG
 +
* mupdf (mudraw) : for converting PDF to PNG (used for ePub covers)
 +
* pstoedit      : for converting PostScript to MetaPost outlines
 +
* zint          : for providing barcodes
 +
* zip or 7zip  : for EPUB generation
 +
 
 +
== Disc space required ==
 +
ConTeXt macro files are small (less than 10MB), but the suite comes with various free fonts which considerably increase the size of the distribution (to around 200MB).
 +
 
 +
== Multiple instances of the installation ==
 +
Please note from the start that we recommend installing a complete ConTeXt installation for each project in a production environment. The installation tree is portable (see Moving the Installation Around, below) and can be located under the project's own directory. The advantage is to allow each project to use an instance of ConTeXt that is adapted to its coding and that only gets updated purposely. Since the ConTeXt Standalone is "bleeding edge" and subject to development, certain details in commands, syntax or rendering may evolve slightly. Having a vintage ConTeXt tree for each production project insures that one can come back years later and produce identical results.
 +
 
 +
So as not to get carried away under this approach, one can eventually group projects by vintage, period or season, according to cycles of productivity.
 +
 
 +
== Standalone ==
 +
 
 +
* [[ConTeXt Standalone/FAQ|Standalone/FAQ]]
 +
* [[ConTeXt Standalone/Structure|Standalone/Structure]]
 +
* [[ConTeXt Standalone/Implementation|Standalone/Implementation]]
 +
* [[ConTeXt Standalone/TODO|Standalone/TODO]]
 +
* [[ConTeXt Standalone/Contents|Standalone/Contents]]
 +
* [[ConTeXt Standalone/TeX Live|Standalone/TeX Live]]
 +
* Browse the [http://minimals.contextgarden.net installation tree]
 +
 
 +
 
 +
 
 +
= Unix-like platforms (Linux/MacOS X/FreeBSD/Solaris) =
 +
 
 +
=== (MacOS X) Using the Command line: Terminal.app ===
  
we have called rsync, a program which goes on the contexgarden site (--> you must be connected to internet) and download all the necessary files for us
+
If you do not what a command tool is, do not worry. It is simply a program in which commands are entered as text and then executed. The needed Terminal.app can be found in the Utilities-folder of the Applications-Folder.
  
Now (well, after a while...) we have all the required files into the /Applications/ConTeXtMinimals folder
+
Once you have started Terminal, all you have to do is enter a command and press the RETURN-key and the command will be executed.
  
===Smultron installation and configuration===
+
== Single user installation ==
  
1. Smultron is a mac application. To install it, simply download the dmg and put the app under the Applications folder (as usual)
+
Select a folder where you want to install ConTeXt. We recommend that you can use your <code>$HOME/context</code> directory. Create this folder. Then download and place it in <code>$HOME/context</code> directory. Open a terminal, then ...
  
2. Open Smultron and go under Tools-->Handle Commands-->Show Commands Window
+
execute (Linux/FreeBSD/Solaris):
  
3. The resulting window allows you to define some commands which can be executed by Smultron. Substantially, this means that Smultron opens for you a Terminal, types the code you want and presses return.
+
{{note|You almost certainly want to [[Installation|install the newer ConTeXt LMTX]]. This guide is for installing the older, rarely-updated MkIV distribution.}}
  
4. Create a new command by pressing the "New Command" button and type a name (e.g. "minimalsTexexec"). Then, write in the text field at the bottom:
+
<pre>
 +
  mkdir ~/context
 +
  cd ~/context
 +
  wget http://minimals.contextgarden.net/setup/first-setup.sh
 +
</pre>
  
 +
or (MacOS):
 +
<pre>
 +
  mkdir ~/context
 +
  cd ~/context
 +
  rsync -av rsync://contextgarden.net/minimals/setup/first-setup.sh .
 +
</pre>
 +
Since the Mac does not have `wget` pre-installed.
 +
 
 +
Now run the `first-setup.sh` script:
 
<pre>
 
<pre>
#!/bin/sh  
+
  # Install the latest beta of ConTeXt
 +
  # This takes a long time, so go have a coffee
 +
  # Flags you can add to the first-setup.sh call:
 +
  #    --modules=all      # Install all third-party modules
 +
  #    --context=latest  # Install latest stable version
 +
  #    --engine=luatex    # Install only MkIV, leave out MkII
 +
  #                        # This shrinks the install from 270 MB to 200 MB
  
cd /Applications/ConTeXtMinimals/
+
  sh ./first-setup.sh --modules=all
. /Applications/ConTeXtMinimals/tex/setuptex /Applications/ConTeXtMinimals/tex
 
cd %%d
 
texexec %%p
 
 
</pre>
 
</pre>
  
Texexec is the command you should call from the Terminal to run ConTeXt. Now Smultron can do it for you.
+
== System-wide installation ==
 +
 
 +
A system wide installation is '''only''' recommended for experienced users. You will need administrator rights on the Mac as only administrators are allowed to install programs in the Applications folder, or root (sudo) privileges on other unix-like systems.
 +
 
 +
* on Linux you can use <code>/opt/context</code>
 +
* on MacOS X you can use <code>/Applications/ConTeXt</code>
 +
 
 +
Note that, at present, while ''using'' MkIV, you need to have write permissions for the <code>$TEXMFCACHE</code> directory. This effectively means that only one user will be able to generate the formats unless you set the group permissions appropriately. For example:
  
5. Write your ConTeXt file with Smultron and save it. When you want to compile it, simply go under Tools-->Commands-->Other-->minimalsTexexec. This will generate a pdf file in the same folder of your .tex file.
+
* <code>CONTEXT_HOME=/opt/context</code>
 +
* <code>TEXMFCACHE=$CONTEXT_HOME/tex/texmf-cache</code>
 +
* <code>chmod -R g+w $TEXMFCACHE</code>
  
6. If you want to experiment with LuaTeX simply add another command (you can name it e.g. "minimalsLua") with this text in its text field:
+
{{note|You almost certainly want to [[Installation|install the newer ConTeXt LMTX]]. This guide is for installing the older, rarely-updated MkIV distribution.}}
  
 
<pre>
 
<pre>
#!/bin/sh
+
  # Create the /opt/context directory -- change as appropriate or desired if you
cd /Applications/ConTeXtMinimals/  
+
  # want a different installation directory.
. /Applications/ConTeXtMinimals/tex/setuptex /Applications/ConTeXtMinimals/tex
+
  cd /opt
cd %%d
+
  mkdir context
context %%p
+
 
 +
  cd context
 +
 
 +
  # Fetch the install script (use rsync on the mac, see above)
 +
  wget http://minimals.contextgarden.net/setup/first-setup.sh
 +
 
 +
  # Install the latest beta of ConTeXt
 +
  # This takes a long time, so go have a coffee
 +
  # Flags you can add to the first-setup.sh call:
 +
  #    --modules=all      # Install all third-party modules
 +
  #    --context=latest  # Install latest stable version
 +
  #    --engine=luatex    # Install only MkIV, leave out MkII
 +
  #                        # This shrinks the install from 270 MB to 200 MB
 +
 
 +
  sh ./first-setup.sh --modules=all
 +
 
 +
  # change ownership to real rather than effective id
 +
  chown -R `id -r -u`:`id -r -g` .
 
</pre>
 
</pre>
  
6b. If you explore the Commands window, you will see that clicking under the Shortcut tab you can insert a shortcut
+
===Cache===
  
6c. If you want to see what ConTeXs is telling you (which is fundamental in case of unexpected behaviors) you can select Tools-->Handle Commands-->Show Command Result Window. This will open a window mirroring the content of the Terminal (i.e. what ConTeXt is communicating you)
+
To customize the cache directory and other options, see the [[Custom_Configuration|Custom Configuration]] page.
  
7. If you want an automatic update of the pdf you are workin on you can use another mac app, [http://pdfview.sourceforge.net/ pdfview]. You have simply to install it, open your pdf file and choose the automatic update option. Every time you recompile form Smultron (or by another editor), it updates the displayed pdf
+
===Font Directory===
  
===Notes===
+
Add the OSFONTDIR into ./tex/setuptex. Go to under the line:
1. All the process requires that you have installed on your machine rsync, ruby and perl. But if you are on macosx, Apple should already have provided it, so at 99% there should not be problems.
 
  
2. We are not using the famous TeXShop editor, because it is slighlty more complicated and typically you grab it bundled with a TeX distribution (like MacTeX), and opportunely configured. By using Smultron, we have created a completely autonomous and lightweight ConTeXTMinimals installation which can work aside MacTeX/TeXShop installation. More, by pdfview we have auto update, which is one of the very relevant feature of TeXShop (If you do not know about all this stuff, see [http://wiki.contextgarden.net/Mac_Installation Mac installation]
+
# TODO: we could set OSFONTDIR on Mac for example
  
== Windows ==
+
(if you don't have the line above, go to the end of the file) and add there:
  
Note: rsync sometimes has problems with paths with uppercase letters (like c:\Temp or c:\Documents and Settings). Installing into all-lowercase paths sometimes helps.
+
export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts"
  
Note: If you're behind firewall and rsync times out you need to open port 873 for outgoing TCP connections.
+
For more information: [[Fonts in LuaTeX]]
  
=== Using installer ===
+
== Apache webserver installation ==
  
You may not have MikTeX or TeX Live installed - the two installations will interfere with each other.
+
Another common use case is invoking ConTeXt from within a web application.  Because web directories are often self-contained, and in the case of Apache under Ubuntu, ownership of the directory and its contents are assigned to a user and group without a login shell, e.g., <code>www-data:www-data</code> this prevents a web application from invoking a ConTeXt installation done using either the single-user or system-wide method listed above.
  
Just download and run [http://minimals.contextgarden.net/setup/context-installer/ContextMinimalInstall.exe the installer] and hope for the best.
+
In this case the solution is to install ConTeXt within the website tree, and ideally in the public sub-tree. The public sub-tree is commonly the home directory for the application and relative pathnames are resolved as if immediately below it.
  
=== Using command-line tools ===
+
For example, in the case of the PHP web framework Laravel, ConTeXt can be installed alongside other assets in the <path-to-document-root>/public/context directory:
 +
 
 +
<pre>
 +
  cd <path-to-document-root>/public
 +
  mkdir context
 +
  cd context
 +
  wget http://minimals.contextgarden.net/setup/first-setup.sh
 +
 
 +
  # Install the latest beta of ConTeXt
 +
  # This takes a long time, so go have a coffee
 +
  # Flags you can add to the first-setup.sh call:
 +
  #    --modules=all      # Install all third-party modules
 +
  #    --context=latest  # Install latest stable version
 +
  #    --engine=luatex    # Install only MkIV, leave out MkII
 +
  #                        # This shrinks the install from 270 MB to 200 MB
 +
 
 +
  sh ./first-setup.sh --modules=all
 +
</pre>
 +
 
 +
Once installed, you need to ensure that the permissions are correct for Apache to be able to access it (you will either need <code>sudo</code> privileges or root access):
 +
 
 +
<pre>
 +
$ cd <path-to-document-root>/public
 +
$ sudo chmod -R www-data:www-data context
 +
</pre>
 +
 
 +
Now as part of your application's invocation of ConTeXt, you will need to set up the shell environment.  This is easily done by creating a simple BASH shell script, also to be installed in the public part of the document tree:
 +
 
 +
<pre>
 +
  #!/usr/bin/env bash
 +
 
 +
  #
 +
  # proccontext.sh
 +
  #
 +
  # To be installed in <path-to-document-root>/public/bin
 +
 
 +
  . <path-to-document-root>/public/context/tex/setuptex <path-to-document-root>/public/context/tex
 +
 
 +
  cd tex/spool
 +
  context $1 > /tmp/context_run.log
 +
</pre>
  
Download and unzip [http://minimals.contextgarden.net/setup/context-setup-mswin.zip context-setup-mswin.zip]
+
Here the dynamically generated ConTeXt source file is expected to be found in the <code><path-to-document-root>/tex/spool</code> directory.
  
Run <code>first-setup.bat</code>, go for a coffee.
+
Now within your application, you can invoke this shell script (in this case using PHP):
  
Before being able to use ConTeXt you need to run setuptex.bat to initialize the environment. A simple way to do it is to create a file <code>startcontext.bat</code> (use any name) somewhere in PATH and put this line into it
+
<pre>
 +
  $cmd = "bin/proccontext.sh $input_filename";
 +
  $last_line = system($cmd, $ret_val);
 +
</pre>
  
C:\Programs\context\tex\setuptex.bat C:\Programs\context\tex
+
And the output will once again be found in <code><path-to-document-root>/tex/spool</code>.
  
Then, you can type <code>startcontext</code> into CMD whenever you want to use ConTeXt Minimals instead of MikTeX.
+
==Arch Linux==
 +
There’s a [https://aur.archlinux.org/packages/context-minimals-git PKGBUILD] in
 +
the AUR, provided by Aditya [https://github.com/adityam/context-pkgbuild].
 +
Install it using your favorite AUR frontend, e.g.
  
== Testing ==
+
<pre>
 +
yaourt -S context-minimals-git
 +
</pre>
  
\starttext
+
This will get you a fresh, up-to-date Context tree in
Hello World!
+
<tt>/opt/context-minimals</tt>.
\stoptext
 
  
Now, you should be able to run
+
== The funtoo way ==
context hello.tex
 
or
 
texexec hello.tex
 
  
<code>context</code> uses LuaTeX by default.
+
If you are using [http://funtoo.org funtoo] there are ebuilds that will make an installation as easy as installing any other package from portage. Take a look at the [[ConTeXt Standalone Funtoo]] Howto. This might also work for [http://www.gentoo.org gentoo], but is untested right now.
  
= Goals =
+
== Proxy settings ==
  
We wanted to provide:
+
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal or your startup script (<code>.bashrc</code> or the corresponding file for your shell).  Replace username, password, proxyhost and proxyport with the correct information
* an easy to (no-need-to-)install ConTeXt distribution
 
* a '''fast and convenient way to update ConTeXt and binaries to the latest version''' ''(no need to fetch 100 MB when only minimal modifications have been made in the distribution)''
 
* a reference ConTeXt distribution
 
* an easy way to revert to an older ConTeXt (in case the latest one is broken)
 
  
We do not plan to provide:
+
  export RSYNC_PROXY=username:password@proxyhost:proxyport
* LaTeX packages ''(perhaps the really-basic-latex as an add-on package, but only if someone else has time to investigate what is needed)''
 
* extensive support for whatever binaries or packages which are otherwise standard in TeX distributions: use TeX Live or MikTeX for that purpose
 
  
The minimals contain:
+
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).
* ConTeXt
 
* Fonts: most important TeX-aware ones
 
* pdfTeX, XeTeX, LuaTeX and Metapost (latest version, if possible)
 
* formats (need to be generated by user) for
 
** ConTeXt, mptopdf and plain TeX for pdfTeX/XeTeX/LuaTeX
 
** metafun and plain for Metapost
 
* ''it would be nice to have tex4ht as a package if someone can figure out what is needed to make it work''
 
  
= Supported platforms =
+
  export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'
  
* Windows
+
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.
* Linux (compiled with glibc 2.3.6)
 
* Linux, 64-bit
 
* Mac OS X Intel
 
* Mac OS X PowerPC
 
* FreeBSD
 
* (Solaris)
 
* other platforms on request (please send a mail to the ntg-context mailing list)
 
  
= Installation =
+
== Usage ==
  
== Prerequisites ==
+
ConTeXt suite works in a non-interfering manner because it does not put anything in your <code>$PATH</code> and does not set any system variables. This in turn means that in order to use it, you need to do some initialization. An intialization script called <code>setuptex</code> is provided in <code>installation-dir/tex/</code>.
  
You need to have two packages preinstalled:
+
=== Terminal/Command line ===
* rsync
 
* ruby (at least 1.8)
 
  
== First Installation ==
+
To run context from a terminal, source <code>setuptex</code>:
  
'''Please note that the location or name of that simple installation script may change!''' ''(It's a really stupid one, one could also call it a prototype.)''
+
  source /installation-dir/tex/setuptex
  
The needed files are under:
+
=== Exclusive usage ===
* http://minimals.contextgarden.net/setup/
 
Well, to be honest, all you need to run it on linux/mac is this script (the rest of files will be downloaded autematically):
 
* http://minimals.contextgarden.net/setup/linux/first-setup.sh (<code>rsync -av rsync://contextgarden.net/minimals/setup/linux/first-setup.sh .</code>)
 
Take a look at it, modify it if needed and run it. On Windows you can either take that command-line version from the zip or
 
* [http://minimals.contextgarden.net/setup/context-installer/ContextMinimalInstall.exe Vyatcheslav's Windows Installer] with a GUI
 
  
It will download about 200 MB.
+
If you always use ConTeXt suite and '''never''' use LaTeX or plain TeX provided by another TeX distribution, you can add the following line to the startup script of your shell (For bash, the startup script is <code>$HOME/.bashrc</code>; for zsh it is <code>HOME/.zshrc</code>).
  
== Running ==
+
  source /installation-dir/tex/setuptex
  
Just like for the old minimals, you have to add a command like
+
Then <code>setuptex</code> will always be sourced in your terminal.
  
  source /opt/context/tex/setuptex /opt/context/tex
+
=== Integrating with an editor ===
  
to your system startup
+
The easiest way to run ConTeXt from an editor is to open a terminal, source {{code|setuptex}} in the terminal, and then open your editor '''from the same terminal'''.
 +
 +
Another option is to add {{code|/installation-dir/tex/texmf-<platform>/bin}} to the {{code|$PATH}} that the editor searches. The details vary depending on the editor. See [[Text Editors]] for instructions on integrating ConTeXt with various editors.
  
 
== Updating ==
 
== Updating ==
  
For now, the main recipe to update is to run <code>first-setup</code> again. A command similar to <code>ctxtools --updatecontext</code> might be provided in the future.
+
For updating the ConTeXt suite,  
 +
first update <code>first-setup.sh</code>, then run it. You could
 +
also create an alias or a little script “ctx-update”
 +
with the following example contents:
 +
<pre>
 +
cd /opt/context
 +
rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh .
 +
sh ./first-setup.sh --modules=all
 +
</pre>
 +
 
 +
To update retain currently-installed modules:
 +
<pre>
 +
sh ./first-setup.sh --keep
 +
</pre>
 +
 
 +
== Uninstalling ==
 +
 
 +
ConTeXt suite does not touch anything outside its installation folder. So to uninstall it, you can simply remove the installation folder.
 +
 
 +
== Remaking formats ==
 +
 
 +
Normally, the update script should create the formats for you. If for some reason you need to recreate the formats, you can do the following:
 +
 
 +
* For making MKII format.
 +
 
 +
mktexlsr
 +
texexec --make --all
 +
 
 +
* For making XeTeX format
 +
 
 +
mktexlsr
 +
texexec --make --xtx --all
  
= TODO =
+
* For making MKIV format
  
(this will move to a better place)
+
mtxrun --generate
 +
context --make
  
== Minor notes ==
+
= Windows =
  
* document environmental variables/different modes of installation
+
If you want to use ConTeXt suite alongside MikTeX/TeXLive (needed if you also run LaTeX), follow the command-line installation method.  
* split LM from rest of the fonts
 
* --all switch to get all modules and all fonts
 
* add font metric files from cont-fnt.zip
 
* add Charis SIL
 
* fix mvs
 
* add the lua configuration file
 
  
== Other notes ==
+
== Installation ==
  
This is a description of how the first installation and any subsequent updates should work (or how it would be nice if they worked that way):
+
=== Command line method ===
 +
Download [http://minimals.contextgarden.net/setup/context-setup-mswin.zip context-setup-mswin.zip] or [http://minimals.contextgarden.net/setup/context-setup-win64.zip context-setup-win64.zip], and unzip to a directory where you want to install ConTeXt. It is recommended that you choose a directory that does not have a space in its full path. Then open <code>cmd.exe</code>, go to the installation directory and run
  
We need to:
+
{{note|You almost certainly want to [[Installation|install the newer ConTeXt LMTX]]. This guide is for installing the older, rarely-updated MkIV distribution.}}
* create files <code>README INSTALL</code>
 
* create a file <code>minimals.lua</code> (or some other self-explanatory name):
 
** <b>rsync location</b> (default: <code>rsync://contextgarden.net/minimals</code>, could be anything)
 
** ??? <b>installation location</b> (default is simply the current location (<code>pwd</code>))
 
** <b>engines</b> (default: all - pdftex, xetex, luatex, metapost)
 
** <b>formats</b> (default: english + dutch context for all the installed engines, metapost, metafun; optional: other interfaces, plain pdftex, xetex)
 
** <b>fonts</b> (need to be reorganized/improved anyway, perhaps a list of fonts should be fetched)
 
** once in the future: <b>supported font encodings for pdftex</b> (default: texnansi, ec, optional: greek, t5, t2a, t2b, t2c, ...)
 
** <b>third party modules</b> (list needs to be fetched form the garden, default)
 
** <b>context version</b> (default: current, other options: beta, highly-experimental (for "Hans-and-Taco-only"), specific-date <font color="red">in the case of a fixed version issue a warning at next update</font>)
 
** <b>interactive flag</b>: shoud the script ask for changes interactively again or should it simply reaspect & use them (defaut: interactive for the first time, after that automatic)
 
  
* improve <code>first-setup(.sh, .bat)</code> (or with some other self-explanatory name), which:
+
  first-setup.bat
** checks if rsync exists (if not, an error is issued, saying <code>please install rsync first</code>)
 
** checks for perl and ruby and issues a similar error/warning (in fact, we can still proceed to the next step and download things even if perl & ruby are not installed, but that doesn't make much sense)
 
** does rsync to installation files themselves (in case mtx-update has changed in the mean time)
 
** reads in <code>minimals.lua</code> (which engines, formats, fonts, modules to download ...) if interactive is set to true, ask for default settings again, otherwise respect those settings and continue
 
** asks for installation location
 
** creates (or updates) the file with settings (if interactive)
 
** fetch files with rsync
 
** create formats
 
** suggest what to put into <code>.bash_profile</code> (or equivalent locations) to have context initilized automatically
 
  
* add unzip for windows
+
This takes a long time, so go have a coffee.
  
= Binaries =
+
By default, the suite installs ConTeXt beta. If you want the stable version of ConTeXt, you can use
  
Binaries are mostly taken from TeX Live 2007, but new ones are used whenever available.
+
  first-setup.bat --context=latest
  
== Origin of the binaries ==
+
By default, the suite does ''not'' install modules and other third party content. If you want the modules (and have the bandwidth), you can use
  
* TeX Live 2007 for most binaries and most platforms
+
first-setup.bat --modules=all
* Akira's [http://www.fsci.fuk.kindai.ac.jp/kakuto/win32-ptex/web2c75-e.html W32TeX] for windows binaries (including metapost, LuaTeX, pdfTeX and XeTeX) - automatic
 
* for pdfTeX, XeTeX, LuaTeX and metapost for other platforms added manually whenever possible (nice if it could be automated, but no idea how)
 
* texmf/scripts/context/stubs from ConTeXt
 
  
== List of included binaries ==
 
  
=== Core binaries ===
+
If the above installation instructions don't seem to answer your questions, see page [[Windows_Installation:_ConTeXt_Suite_with_SciTe| Windows Installation: ConTeXt Suite with SciTe]] for more detailed information.
''We will do our best to keep them as up to date as possible. If they're still not up to date for your platform and you know where to find them, please notify us, we will fix that. We might provide XeTeX and LuaTeX in separate packages (on TODO list).''
 
* pdftex
 
* luatex
 
* texlua, texluac ''(only symlinks on "unix" platforms, in Akira's distribution luatex.dll is used + 3 small executables)''
 
* xetex, xdvipdfmx
 
* ''metapost''
 
** dvitomp
 
** makempx
 
** mpost
 
** mpto ''(can this be replaced by ConTeXt's variant in future?)''
 
  
=== Other binaries ===
+
== Proxy settings ==
* ''kpathsea''
 
** kpseaccess
 
** kpsestat
 
** kpsewhich
 
* ''different tools''
 
** bibtex
 
** dvipos
 
** mktexlsr
 
** pdftosrc
 
  
=== Stubs & other ConTeXt-related ===
+
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal as (replace username, password, proxyhost and proxyport with the correct information)
* everything from <code>texmf/scripts/context/stubs</code>
+
 
* luatools, mtxrun
+
  set RSYNC_PROXY=username:password@proxyhost:proxyport
* texmfstart ''(take the latest version by Hans automatically: doesn't happen yet)''
+
 
 +
or set the variable permanently as a Windows environment variable.
 +
 
 +
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).
 +
 
 +
  export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'
 +
 
 +
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.
 +
 
 +
== Usage ==
 +
 
 +
Before running ConTeXt, you need to run <code>setuptex.bat</code> which is provided in <code>installation-dir\tex\</code>. This can be done by typing
 +
 
 +
  installation-dir\tex\setuptex.bat
 +
 
 +
on cmd.exe before you run ConTeXt. To avoid always having to type this, you can create a shortcut to cmd.exe and edit the command line to read (assuming you installed the suite in <code>C:\Programs</code>; otherwise replace <code>C:\Programs\</code> with your installation directory)
 +
 
 +
  C:\WINDOWS\System32\cmd.exe /k C:\Programs\context\tex\setuptex.bat
 +
 
 +
This starts up a new command shell with the environment pre-loaded. Within the new shell you can just type <code>context</code> to run ConTeXt. E.g.
 +
 
 +
  C:\> context --version
 +
 
 +
to check that you are running the version you think you're running.
 +
 
 +
=== Use ConTeXt with Cygwin ===
 +
After installing the ConTeXt suite, you can run it under Cygwin. With Cygwin, you may use gmake and other Unix tools for your automated workflow.
 +
 
 +
# Run <code>setuptex.bat</code> in DOS command prompt
 +
# In the same DOS prompt, enter Cygwin by running <code>cygwin.bat</code> (in your Cygwin installation directory)
 +
# Under Cygwin prompt, run <code> context.cmd test.tex </code>. Note that the <code>.cmd</code> extension is needed under Cygwin.
 +
 
 +
== Updating ==
  
=== Font-related ===
+
If you used the command line method, just run <code>first-setup.bat</code> again to update the suite.
''Might be removed or moved to a special category of "font-related binaries", and only available as an additional package.''
 
* ''only left for testing
 
** afm2pl
 
** afm2tfm
 
** ttf2afm
 
* Knuth's
 
** pltotf
 
** tftopl
 
** vftovp
 
** vptovf
 
  
=== Might-be-removed-soon ===
 
* dvipdfmx
 
* dvips
 
  
= ConTeXt =
+
== Uninstallation ==
  
The Minimals provide several versions of ConTeXt:
+
If you used the command-line installer, you can just delete the installation directory to uninstall the suite.
* stable
 
* beta (suggested for living-on-the-edge ones; will default to stable if not available)
 
* alpha (rarely used; will use beta if not available)
 
* experimental (only for testing - not meant for general use)
 
* date-based ones (currenty only a few versions available - planning to improve)
 
You can use
 
    --context=XXX
 
to get the desired version.
 
  
= Fonts =
 
  
Fonts are split in three packages:
+
== Troubleshooting ==
* used in both pdfTeX and XeTeX/LuaTeX: mostly math (pfb, map, enc, tfm)
 
* used in pdfTeX only: pfb, map, enc, tfm (those that are not present in "common")
 
* used in XeTeX/LuaTeX only: otf
 
  
Currently we have (the latest version, in sync with CTAN):
+
* rsync sometimes has problems with paths with uppercase letters (like <code>c:\Temp</code> or <code>C:\Documents and Settings</code>). Installing into all-lowercase paths without spaces sometimes helps.
* Latin Modern
+
* Directory-name length may also have an effect, due to Windows's 8.3 filename conventions.  An indicator is if running "texexec --lua" on a file produces missing-file warnings containing Windows-created 8-character directory names, such as "C:\CONTEX~1\tex", where your ConTeXt directory is really "C:\context_minimals\tex".  Be conservative and choose a short name like "C:\ctm\tex".  Also, this may even work when an 8-character-or-less directory name like "C:\ctexmin\tex" doesn't.
* Antykwa Torunska
+
* If you're behind firewall and rsync times out, you need to open port 873 for outgoing TCP connections.
* Iwona & Kurier
+
* If you update luaTeX occasionally you may get something like
* TeX Gyre
 
* ams
 
  
Other fonts to be added:
+
<code>engine mismatch (luv: This is LuaTeX, Version beta-<version>-<date1>  (TeX Live 2013/dev)(rev <number1>) <> bin: This is LuaTeX, Version beta-<version>-<date1>  (TeX Live 2012/W32TeX)(rev <number2>)), forcing remake</code>
* TODO
 
  
It is possible that we'll provide a really minimal package with LM only, and additional three packages (common, for new TeX, for old TeX) with all the other fonts.
+
In which case your format will be remade every time you compile a file. In /texmf-mswin make sure that luatex.exe and texlua.exe have the same date; then also delete luatex.dll. This usually solves the problem.
  
* fonts/data/<foundry>/<family|distro>/*
+
= Installing third party modules =
  
* lm  : always
+
The ConTeXt suite only comes with Taco's [[Bibliography|t-bib]] module. If you want to install [http://modules.contextgarden.net/ a new module], say Wolfgang's [[Letter|t-letter]] module, you can use
* gyre : all of them in one set, optional
+
  first-setup.sh --modules="t-letter"
* rest : optional
 
  
= Third-party modules & Other =
+
If you want to install more than one extra module, you can separate them by commas. So, to install the t-letter and t-mathsets module, do
 +
  sh ./first-setup.sh --modules="t-letter,t-mathsets"
  
* TODO
+
If you want to install all extra modules at once, do
* also cont-* from Hans's page
+
  sh ./first-setup.sh --modules=all
  
= Documentation =
+
= Reverting to an older installation =
  
TODO
+
If, for some reason, you want to revert to an older installation, you can do that by
  
= Implementation =
+
  sh ./first-setup.sh --context=date
  
See the [[New ConTeXt Minimals (Implementation)|implementation]] page.
+
where <code>date</code> is the date of one of the stable releases of ConTeXt. The complete list of old releases that are available is [http://minimals.contextgarden.net/current/context/ here].
  
= Hans's requests =
 
  
* reorganize fonts into fonts/data/e-foundry/texgyre/<everything>
+
= Moving the installation tree around =
* list directory contents
 
* list of files to fetch an old ConTeXt version
 
  
= Who are “we”? =
+
According to this post, http://archive.contextgarden.net/message/20101129.144331.d721372f.en.html it's safe to move the installation tree across directory or machines (say you don't have broadband access). You just have to clean and regenerate the cache (./tex/texmf-cache/luatex-cache) with
 +
mtxrun --generate
  
''Ein Teil von jener Kraft, / Die stets das Böse will, und stets das Gute schafft.'' <code>:-)</code>
+
= Notes =
 +
<references/>
  
 +
{{Installation navbox}}
  
 
[[Category:Installation]]
 
[[Category:Installation]]
 +
[[Category:Standalone]]

Latest revision as of 05:15, 11 April 2023


NOTE: You almost certainly want to install the newer ConTeXt LMTX. This guide is for installing the older, rarely-updated MkIV distribution.


The ConTeXt suite is a complete, up-to-date ConTeXt distribution that can be upgraded efficiently. It can also be used in parallel with existing TeX installations such as MikTeX, TeXLive, and so forth. The suite does not include LaTeX packages and binaries.

Sometimes ConTeXt beta releases have issues. The ConTeXt suite allows you to test the latest ConTeXt release without worrying whether upgrading will corrupt a critical project. Multiple ConTeXt suite installations are possible. This allows, for example, a stable version and a beta version to run in parallel on the same computer.

ConTeXt is also included in TeXlive. The ConTeXt suite is updated continuously, whereas ConTeXt in TeXlive is updated less often. In particular, luatex and metapost are under active development and their binaries are updated frequently. ConTeXt follows these developments, indeed often drives development. As the binaries included in the TeXlive distribution are only updated yearly, ConTeXt on TeXlive will necessarily be less current than the ConTeXt suite. The ConTeXt suite is self-contained and can happily coexist alongside another installed TeX distribution.

General Information

Supported platforms

Platform Short name Notes
Windows mswin from W32TeX
Windows/CygWin cygwin same binaries as mswin
Windows, 32 bit win32 Alias for mswin
Windows, 64 bit win64
Linux, 32-bit linux Debian 8
Linux, 64-bit linux-64 Debian 8
Linux, ARM (low end.) linux-arm Raspbian 8
Linux, musl linuxmusl-64 Alpine
Mac OS X, Intel (64-bit) osx-64 Mac OS X 10.6
FreeBSD, 32-bit freebsd
FreeBSD, 64-bit freebsd-amd64
OpenBSD 6.4, 32-bit openbsd6.4
OpenBSD 6.4, 64-bit openbsd6.4-amd64
OpenBSD 6.5, 32-bit openbsd6.5
OpenBSD 6.5, 64-bit openbsd6.5-amd64
Solaris, Intel solaris-intel Solaris 10 on OpenCSW
Solaris, Sparc solaris-sparc Solaris 10 on OpenCSW
  • If you run into problems installing, check the available architectures in the minimal’s setup folder!
  • OpenBSD 6.4 binaries are compiled but are missing in the setup folder ATM (2019-07)

If you want to support a new platform, please write to the Mailing Lists

Dependencies

  • Rsync (The windows binary of rsync is distributed within the suite)


The following programs are not required for running ConTeXt, but their installation adds additional functionality.

  • curl : for including remote content
  • ghostscript : for converting PostScript images to PDF
  • graphicsmagick (convert) : for converting GIF and TIFF images
  • inkscape : for converting SVG and compressed SVG
  • mupdf (mudraw) : for converting PDF to PNG (used for ePub covers)
  • pstoedit : for converting PostScript to MetaPost outlines
  • zint : for providing barcodes
  • zip or 7zip : for EPUB generation

Disc space required

ConTeXt macro files are small (less than 10MB), but the suite comes with various free fonts which considerably increase the size of the distribution (to around 200MB).

Multiple instances of the installation

Please note from the start that we recommend installing a complete ConTeXt installation for each project in a production environment. The installation tree is portable (see Moving the Installation Around, below) and can be located under the project's own directory. The advantage is to allow each project to use an instance of ConTeXt that is adapted to its coding and that only gets updated purposely. Since the ConTeXt Standalone is "bleeding edge" and subject to development, certain details in commands, syntax or rendering may evolve slightly. Having a vintage ConTeXt tree for each production project insures that one can come back years later and produce identical results.

So as not to get carried away under this approach, one can eventually group projects by vintage, period or season, according to cycles of productivity.

Standalone


Unix-like platforms (Linux/MacOS X/FreeBSD/Solaris)

(MacOS X) Using the Command line: Terminal.app

If you do not what a command tool is, do not worry. It is simply a program in which commands are entered as text and then executed. The needed Terminal.app can be found in the Utilities-folder of the Applications-Folder.

Once you have started Terminal, all you have to do is enter a command and press the RETURN-key and the command will be executed.

Single user installation

Select a folder where you want to install ConTeXt. We recommend that you can use your $HOME/context directory. Create this folder. Then download and place it in $HOME/context directory. Open a terminal, then ...

execute (Linux/FreeBSD/Solaris):


NOTE: You almost certainly want to install the newer ConTeXt LMTX. This guide is for installing the older, rarely-updated MkIV distribution.
  mkdir ~/context
  cd ~/context
  wget http://minimals.contextgarden.net/setup/first-setup.sh

or (MacOS):

  mkdir ~/context
  cd ~/context
  rsync -av rsync://contextgarden.net/minimals/setup/first-setup.sh .

Since the Mac does not have wget pre-installed.

Now run the first-setup.sh script:

  # Install the latest beta of ConTeXt
  # This takes a long time, so go have a coffee
  # Flags you can add to the first-setup.sh call:
  #     --modules=all      # Install all third-party modules
  #     --context=latest  # Install latest stable version
  #     --engine=luatex    # Install only MkIV, leave out MkII
  #                        # This shrinks the install from 270 MB to 200 MB

  sh ./first-setup.sh --modules=all

System-wide installation

A system wide installation is only recommended for experienced users. You will need administrator rights on the Mac as only administrators are allowed to install programs in the Applications folder, or root (sudo) privileges on other unix-like systems.

  • on Linux you can use /opt/context
  • on MacOS X you can use /Applications/ConTeXt

Note that, at present, while using MkIV, you need to have write permissions for the $TEXMFCACHE directory. This effectively means that only one user will be able to generate the formats unless you set the group permissions appropriately. For example:

  • CONTEXT_HOME=/opt/context
  • TEXMFCACHE=$CONTEXT_HOME/tex/texmf-cache
  • chmod -R g+w $TEXMFCACHE

NOTE: You almost certainly want to install the newer ConTeXt LMTX. This guide is for installing the older, rarely-updated MkIV distribution.
  # Create the /opt/context directory -- change as appropriate or desired if you 
  # want a different installation directory.
  cd /opt
  mkdir context
  
  cd context
  
  # Fetch the install script (use rsync on the mac, see above)
  wget http://minimals.contextgarden.net/setup/first-setup.sh
  
  # Install the latest beta of ConTeXt
  # This takes a long time, so go have a coffee
  # Flags you can add to the first-setup.sh call:
  #     --modules=all      # Install all third-party modules
  #     --context=latest  # Install latest stable version
  #     --engine=luatex    # Install only MkIV, leave out MkII
  #                        # This shrinks the install from 270 MB to 200 MB

  sh ./first-setup.sh --modules=all

  # change ownership to real rather than effective id
  chown -R `id -r -u`:`id -r -g` .

Cache

To customize the cache directory and other options, see the Custom Configuration page.

Font Directory

Add the OSFONTDIR into ./tex/setuptex. Go to under the line:

# TODO: we could set OSFONTDIR on Mac for example

(if you don't have the line above, go to the end of the file) and add there:

export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts"

For more information: Fonts in LuaTeX

Apache webserver installation

Another common use case is invoking ConTeXt from within a web application. Because web directories are often self-contained, and in the case of Apache under Ubuntu, ownership of the directory and its contents are assigned to a user and group without a login shell, e.g., www-data:www-data this prevents a web application from invoking a ConTeXt installation done using either the single-user or system-wide method listed above.

In this case the solution is to install ConTeXt within the website tree, and ideally in the public sub-tree. The public sub-tree is commonly the home directory for the application and relative pathnames are resolved as if immediately below it.

For example, in the case of the PHP web framework Laravel, ConTeXt can be installed alongside other assets in the <path-to-document-root>/public/context directory:

  cd <path-to-document-root>/public
  mkdir context
  cd context
  wget http://minimals.contextgarden.net/setup/first-setup.sh
  
  # Install the latest beta of ConTeXt
  # This takes a long time, so go have a coffee
  # Flags you can add to the first-setup.sh call:
  #     --modules=all      # Install all third-party modules
  #     --context=latest  # Install latest stable version
  #     --engine=luatex    # Install only MkIV, leave out MkII
  #                        # This shrinks the install from 270 MB to 200 MB

  sh ./first-setup.sh --modules=all

Once installed, you need to ensure that the permissions are correct for Apache to be able to access it (you will either need sudo privileges or root access):

$ cd <path-to-document-root>/public
$ sudo chmod -R www-data:www-data context

Now as part of your application's invocation of ConTeXt, you will need to set up the shell environment. This is easily done by creating a simple BASH shell script, also to be installed in the public part of the document tree:

  #!/usr/bin/env bash

  #
  # proccontext.sh
  #
  # To be installed in <path-to-document-root>/public/bin

  . <path-to-document-root>/public/context/tex/setuptex <path-to-document-root>/public/context/tex

  cd tex/spool
  context $1 > /tmp/context_run.log

Here the dynamically generated ConTeXt source file is expected to be found in the <path-to-document-root>/tex/spool directory.

Now within your application, you can invoke this shell script (in this case using PHP):

   $cmd = "bin/proccontext.sh $input_filename";
   $last_line = system($cmd, $ret_val);

And the output will once again be found in <path-to-document-root>/tex/spool.

Arch Linux

There’s a PKGBUILD in the AUR, provided by Aditya [1]. Install it using your favorite AUR frontend, e.g.

yaourt -S context-minimals-git

This will get you a fresh, up-to-date Context tree in /opt/context-minimals.

The funtoo way

If you are using funtoo there are ebuilds that will make an installation as easy as installing any other package from portage. Take a look at the ConTeXt Standalone Funtoo Howto. This might also work for gentoo, but is untested right now.

Proxy settings

The installation script uses rsync to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set RSYNC_PROXY variable in the terminal or your startup script (.bashrc or the corresponding file for your shell). Replace username, password, proxyhost and proxyport with the correct information

 export RSYNC_PROXY=username:password@proxyhost:proxyport

Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program nc).

 export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'

where tunnelhost is the machine outside of the firewall on which you have ssh access. Of course, this machine must have nc and port 873 open for outgoing TCP connections.

Usage

ConTeXt suite works in a non-interfering manner because it does not put anything in your $PATH and does not set any system variables. This in turn means that in order to use it, you need to do some initialization. An intialization script called setuptex is provided in installation-dir/tex/.

Terminal/Command line

To run context from a terminal, source setuptex:

  source /installation-dir/tex/setuptex

Exclusive usage

If you always use ConTeXt suite and never use LaTeX or plain TeX provided by another TeX distribution, you can add the following line to the startup script of your shell (For bash, the startup script is $HOME/.bashrc; for zsh it is HOME/.zshrc).

  source /installation-dir/tex/setuptex

Then setuptex will always be sourced in your terminal.

Integrating with an editor

The easiest way to run ConTeXt from an editor is to open a terminal, source setuptex in the terminal, and then open your editor from the same terminal.

Another option is to add /installation-dir/tex/texmf-<platform>/bin to the $PATH that the editor searches. The details vary depending on the editor. See Text Editors for instructions on integrating ConTeXt with various editors.

Updating

For updating the ConTeXt suite, first update first-setup.sh, then run it. You could also create an alias or a little script “ctx-update” with the following example contents:

cd /opt/context
rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh .
sh ./first-setup.sh --modules=all

To update retain currently-installed modules:

sh ./first-setup.sh --keep

Uninstalling

ConTeXt suite does not touch anything outside its installation folder. So to uninstall it, you can simply remove the installation folder.

Remaking formats

Normally, the update script should create the formats for you. If for some reason you need to recreate the formats, you can do the following:

  • For making MKII format.
mktexlsr
texexec --make --all 
  • For making XeTeX format
mktexlsr
texexec --make --xtx --all 
  • For making MKIV format
mtxrun --generate
context --make

Windows

If you want to use ConTeXt suite alongside MikTeX/TeXLive (needed if you also run LaTeX), follow the command-line installation method.

Installation

Command line method

Download context-setup-mswin.zip or context-setup-win64.zip, and unzip to a directory where you want to install ConTeXt. It is recommended that you choose a directory that does not have a space in its full path. Then open cmd.exe, go to the installation directory and run


NOTE: You almost certainly want to install the newer ConTeXt LMTX. This guide is for installing the older, rarely-updated MkIV distribution.
 first-setup.bat

This takes a long time, so go have a coffee.

By default, the suite installs ConTeXt beta. If you want the stable version of ConTeXt, you can use

 first-setup.bat --context=latest

By default, the suite does not install modules and other third party content. If you want the modules (and have the bandwidth), you can use

first-setup.bat --modules=all


If the above installation instructions don't seem to answer your questions, see page Windows Installation: ConTeXt Suite with SciTe for more detailed information.

Proxy settings

The installation script uses rsync to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set RSYNC_PROXY variable in the terminal as (replace username, password, proxyhost and proxyport with the correct information)

  set RSYNC_PROXY=username:password@proxyhost:proxyport

or set the variable permanently as a Windows environment variable.

Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program nc).

 export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'

where tunnelhost is the machine outside of the firewall on which you have ssh access. Of course, this machine must have nc and port 873 open for outgoing TCP connections.

Usage

Before running ConTeXt, you need to run setuptex.bat which is provided in installation-dir\tex\. This can be done by typing

 installation-dir\tex\setuptex.bat

on cmd.exe before you run ConTeXt. To avoid always having to type this, you can create a shortcut to cmd.exe and edit the command line to read (assuming you installed the suite in C:\Programs; otherwise replace C:\Programs\ with your installation directory)

 C:\WINDOWS\System32\cmd.exe /k C:\Programs\context\tex\setuptex.bat

This starts up a new command shell with the environment pre-loaded. Within the new shell you can just type context to run ConTeXt. E.g.

 C:\> context --version

to check that you are running the version you think you're running.

Use ConTeXt with Cygwin

After installing the ConTeXt suite, you can run it under Cygwin. With Cygwin, you may use gmake and other Unix tools for your automated workflow.

  1. Run setuptex.bat in DOS command prompt
  2. In the same DOS prompt, enter Cygwin by running cygwin.bat (in your Cygwin installation directory)
  3. Under Cygwin prompt, run context.cmd test.tex . Note that the .cmd extension is needed under Cygwin.

Updating

If you used the command line method, just run first-setup.bat again to update the suite.


Uninstallation

If you used the command-line installer, you can just delete the installation directory to uninstall the suite.


Troubleshooting

  • rsync sometimes has problems with paths with uppercase letters (like c:\Temp or C:\Documents and Settings). Installing into all-lowercase paths without spaces sometimes helps.
  • Directory-name length may also have an effect, due to Windows's 8.3 filename conventions. An indicator is if running "texexec --lua" on a file produces missing-file warnings containing Windows-created 8-character directory names, such as "C:\CONTEX~1\tex", where your ConTeXt directory is really "C:\context_minimals\tex". Be conservative and choose a short name like "C:\ctm\tex". Also, this may even work when an 8-character-or-less directory name like "C:\ctexmin\tex" doesn't.
  • If you're behind firewall and rsync times out, you need to open port 873 for outgoing TCP connections.
  • If you update luaTeX occasionally you may get something like

engine mismatch (luv: This is LuaTeX, Version beta-<version>-<date1> (TeX Live 2013/dev)(rev <number1>) <> bin: This is LuaTeX, Version beta-<version>-<date1> (TeX Live 2012/W32TeX)(rev <number2>)), forcing remake

In which case your format will be remade every time you compile a file. In /texmf-mswin make sure that luatex.exe and texlua.exe have the same date; then also delete luatex.dll. This usually solves the problem.

Installing third party modules

The ConTeXt suite only comes with Taco's t-bib module. If you want to install a new module, say Wolfgang's t-letter module, you can use

 first-setup.sh --modules="t-letter"

If you want to install more than one extra module, you can separate them by commas. So, to install the t-letter and t-mathsets module, do

 sh ./first-setup.sh --modules="t-letter,t-mathsets"

If you want to install all extra modules at once, do

 sh ./first-setup.sh --modules=all

Reverting to an older installation

If, for some reason, you want to revert to an older installation, you can do that by

 sh ./first-setup.sh --context=date

where date is the date of one of the stable releases of ConTeXt. The complete list of old releases that are available is here.


Moving the installation tree around

According to this post, http://archive.contextgarden.net/message/20101129.144331.d721372f.en.html it's safe to move the installation tree across directory or machines (say you don't have broadband access). You just have to clean and regenerate the cache (./tex/texmf-cache/luatex-cache) with mtxrun --generate

Notes