Installation

From Wiki
Revision as of 17:36, 14 April 2024 by Garulfoo (talk | contribs) (→‎MacOS)
Jump to navigation Jump to search

Download


You can read the licence (Creative Commons GNU GPL for program code, and Creative Commons Attribution ShareAlike for documentation).

Installation

The general steps to install ConTeXt LMTX are as follows:

  1. Create a directory for ConTeXt.
  2. Download the platform-specific archive file into the ConTeXt directory.
  3. Unpack the archive.
  4. Execute the install program, which downloads the distribution.
  5. Update the PATH environment variable.
  6. Generate cache
  7. Optionally, delete the archive file.

See the next sections for instructions specific to various platforms.

Unix

The steps in this section show how to download and install ConTeXt for a 64-bit Linux system. Change the archive file download link as needed for your target platform. Open a new terminal then run the following commands:

  1. mkdir $HOME/context and cd $HOME/context
  2. wget https://lmtx.pragma-ade.com/install-lmtx/context-linux-64.zip
  3. unzip context-linux-64.zip
  4. sh install.sh
  5. Update the PATH environment variable by using the path instructions displayed when the install program finishes. The instructions will vary depending on the type of shell being used:
    • Bash: echo 'export PATH=...instructions...:$PATH' >> ~/.bashrc
    • Zsh: echo 'export PATH=...instructions...:$PATH' >> ~/.zshenv
    • Sh/Ksh: echo 'export PATH=...instructions...:$PATH' >> ~/.profile
    • Tcsh/csh: echo 'set path = ($path ...instructions...)' >> ~/.cshrc
    • For example, if ConTeXt was downloaded into $HOME/context on a system running bash, then the following line would update the PATH environment variable: echo 'export PATH=$HOME/context/tex/texmf-linux-64/bin:$PATH' >> ~/.bashrc
  6. Then generate the cache with mtxrun --generate.
  7. rm context-linux-64.zip

MacOS

The instructions for MacOS are the same as for Unix, but note that:

  • MacOS versions from Catalina (10.15) and newer use Zsh by default.
  • MacOS versions before Catalina use Bash by default.
  • You might need to de-quarantine the binaries (and sometimes every created PDF):
    • sudo xattr -r -d com.apple.quarantine bin/mtxrun
    • sudo xattr -r -d com.apple.quarantine tex/texmf-osx-64/bin/*

Windows

Complete the following steps to set up ConTeXt on Windows:

  1. Create a directory for ConTeXt, such as C:\context.
  2. Download the architecture-specific version into the ConTeXt directory.
  3. Extract the archive.
  4. Run: install.bat
  5. Run: setpath.bat

Installation is complete.

Upgrade

Re-run the install program to upgrade, which will update the distribution incrementally:

  • Windows: install.bat
  • Unix: sh install.sh

First document

Make sure that ConTeXt is installed on your system. To check that, go to the command line and type

context --version

You should get an output as follows:

mtx-context     | ConTeXt Process Management 1.03
mtx-context     |
mtx-context     | main context file: /opt/context-minimals/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context     | current version: 2020.01.30 14:13

If ConTeXt is not installed on your system, check the installation page for installation instructions.

Follow the steps below to create a simple document using ConTeXt:

Create a ConTeXt file

Open a text editor, type the following content, and save the file as hello.tex or hello.mkxl:

\starttext
\startsection[title={Testing ConTeXt}]
  This is my {\em first} ConTeXt document.
\stopsection
\stoptext

Words starting with a backslash (such as \starttext) are called command sequence or macros. The macros

\starttext
....
\stoptext

mark the content to be typeset. The material before \starttext (called preamble) is used to change the style of the output; any material after \stoptext is ignored.

The macros

\startsection[title={...}]
...
\stopsection

mark the title and the content of a section.

The macro {\em ...} is a font switch that emphasizes the content (by showing it in slanted font).

Compile the ConTeXt file

Go to the command-line and type:

context hello

ConTeXt will then process your document, display some logging information on the console, and generate a hello.pdf output file.

mtx-context     | run 1: luatex --fmt="/home/adityam/.cache/context-minimals/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en" --jobname="hello" --lua="/home/adityam/.cache/context-minimals/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.lui" --c:currentrun=1 --c:fulljobname="./hello.tex" --c:input="./hello.tex" --c:kindofrun=1 --c:maxnofruns=9 --c:texmfbinpath="/opt/context-minimals/texmf-linux-64/bin" "cont-yes.mkiv"

This is LuaTeX, Version 1.10.1 (TeX Live 2019) 
 system commands enabled.
open source     > level 1, order 1, name '/opt/context-minimals/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
system          > 
system          > ConTeXt  ver: 2019.07.24 11:17 MKIV beta  fmt: 2019.8.17  int: english/english
...
...
mkiv lua stats  > lua properties: engine: lua 5.3, used memory: 94 MB, ctx: 93 MB, max: unknown MB), hash chars: min(64,40), symbol mask: utf (τεχ)
mkiv lua stats  > runtime: 0.833 seconds, 1 processed pages, 1 shipped pages, 1.200 pages/second
system          | total runtime: 4.485 seconds

View the generated PDF file

Open the generated hello.pdf PDF file using a PDF viewer. It should look as follows:

Note that the section has been numbered, the section number and the section title appear in a slightly larger fonts, and the emphasized word comes out in a slanted font.


Running MkIV

The new distribution has all the files to run the previous version of ConTeXt.

  • Run context --luatex Hello-world.tex to use the luatex binary and MkIV.


Further installation instructions


ConTeXt is a markup language used to primarily create PDF files. To use ConTeXt, create a text file (typically with a .tex extension) with ConTeXt markup and compile the file by running the command context filename. This creates a PDF file. This page explains how to create your very first ConTeXt document.