Input and compilation/Modules

From Wiki
Jump to navigation Jump to search

Modules are extensions to ConTeXt’s core functions.

There are not as many modules for ConTeXt as packages for LaTeX, because ConTeXt’s core already contains a lot that needs a package in LaTeX.

Installation

Basics

The installation of extra files in TeX (called modules in ConTeXt) can be difficult for people who are new to TeX or are not themselves interested in TeX programming.

According to the TDS (TeX directory structure) and the ConTeXt developers, user-written files reside under the path

 $TEXMF/tex/context/third/<modulename>/<files>

In the private TeX directory ($TEXMF), directories can have the names

  • texmf-local
  • texmf-extra
  • texmf-project

but their existence depends on the TeX distribution; among these, texmf-local is the most common.

Installation by hand

When you want to install a new single-file module, create the subdirectories in the way described above and place the file there.

Most modules consist of several files though and are distributed as ZIP archives that contain the necessary TDS tree. These you can unzip in the top-level directory (e.g. texmf-local/), and all files should be in the correct place.

After the files are installed, you must update ConTeXt’s database to let it know where it can find the files:

 context --generate

(ConTeXt doesn’t use ls-R files or kpsewhich any more.)

Installation by script (LMTX)

Since 2023-05, there’s a script for mtxrun to list and install modules, usually from https://modules.contextgarden.net. Some modules, get special treatment: For the TikZ modules files are downloaded from CTAN and patches for incompatibilities are applied.

First, cd into the tex directory of your ConTeXt LMTX installation (above the texmf-* trees), the modules installer works only there.


 mtxrun --script install-modules --list

For the installation to work, you must change into the tex directory that contains the texmf-* trees.

 mtxrun --script install-modules --install filter simpleslides

If you list single modules to install, leave out the prefix (t-* or whatever)!

But since there aren’t many, you can just install all modules:

 mtxrun --script install-modules --install --all

Installation by script (old)

Previously, the ConTeXt LMTX distribution did not provide a built-in way to install or update modules. Here’s a method using rsync, to be run from the toplevel directory of the ConTeXt LMTX distribution, i.e. the directory that contains install.sh.

Because the final tex/texmf-modules must contain the union of all individual module directories, the commands create and leave an intermediate modules directory that wastes less than 50 MB.

 # Synchronize all modules from ConTeXt Garden in the 'modules' directory, which is created if it doesn’t exist.
 
 rsync --recursive --links --times --info=progress2,remove,symsafe,flist,del --human-readable --del rsync://contextgarden.net/minimals/current/modules/ modules
 
 # Create the union of all modules in tex/texmf-modules (the directory is created if it doesn’t exist).
 # If you have personal modules in tex/texmf-modules, they won’t be modified.
 mkdir -p tex
 rsync -rlt --exclude=/VERSION --del modules/*/ tex/texmf-modules
 # You may delete the 'modules' directory to reclaim some space or keep it to speed up the next update.
 # rm -rf modules
 
 # Update the ConTeXt file database.
 mtxrun --generate

Installation by script (MkIV)

Users of the ConTeXt MkIV standalone can use the first-setup script to install modules:

E.g. to install the simpleslides modules:

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

To install more modules at the same time:

 first-setup.sh --modules="t-simpleslides,t-french"

TeX Live

TeX Live is a large TeX distribution for most common operating systems. It provides binaries and many other files necessary to run TeX and its flavors. Many ConTeXt modules are included.


Usage

When you load a module with \usemodule[modulename] ConTeXt looks for a file with the following names:

  • m-modulename (core module)
  • p-modulename (private module)
  • s-modulename (ConTeXt style file)
  • x-modulename (XML module)
  • t-modulename ("third party" contributed module)
  • modulename

Once a file is found, ConTeXt stops the search and loads the found file (only once).

When you have two files with the same name but different prefixes, you can tell ConTeXt which file it should load with

\usemodule[<prefix>][modulename]

Included Modules

as of 2023-09-30

Macro modules


Style modules

in texmf-context/tex/context/modules/common:

  • s-cdr-00.tex: CD-ROM cover style
  • s-faq-00.tex to -03: FAQ styles
  • s-pre-00.tex to -96: Several old presentation styles (replaced by the following)

in texmf-context/tex/context/modules/mkiv:

  • s-present-*.tex: Several presentation styles (examples in texmf-context/doc/context/presentations/examples)

… many more …

Contributed Modules

(as of 2024-04-21)

For a list of contributed modules see the modules section on contextgarden.net:

  • account draw T-accounts (2009, but works with LMTX)
  • algorithmic like LaTeX algorithmic (2013)
  • animation create animations (2013)
  • annotation todo lists (2013)
  • aquamints AquaMints symbol support (2005, obsolete)
  • bnf BNF grammar (2006)
  • chromato chromatograms (2008)
  • cmscbf bold small caps (2006, outdated)
  • cmttbf bold typewriter (2006, outdated)
  • collating-marks collating marks (signature marks, DE Flattermarken) for multi-signature books (2023)
  • calendar-examples Examples for the PocketDiary module (2023)
  • construction-plan figures with defined scale (2008)
  • crossref cross-document references (2012, obsolete)
  • cyrillic numbers traditional Cyrillic numerals (2018, MkIV)
  • date-driven-lists Extension for the PocketDiary module (2023)
  • degrade downsampling (degrading) JPEG images (2009, outdated)
  • enigma Enigma I cipher (2013)
  • fancybreak thought breaks (2015)
  • filter run external programs on inline code (2022, works with LMTX)
  • french settings for French documents (2011, obsolete)
  • fullpage equal margins without \setuplayout (2017)
  • gantt Gantt charts (2012)
  • gnuplot include GNUplot graphics, context and tikz terminals (2013)
  • Greek Ancient (polytonic) Greek support (2013, obsolete)
  • handlecsv CSV support for mail merging etc. (2024)
  • high syntax highlighting (2017; 2021 version)
  • inifile .ini files (2008, outdated)
  • karnaugh Karnaugh maps (2021)
  • layout first version of \showlayout (2007, obsolete)
  • letter formal letters AKA correspondence (2021, works with LMTX)
  • letterspace letterspacing (2013, MkIV, obsolete)
  • lua-widow-control automatical avoidance of widows and orphans in grid mode (2022, latest version)
  • markdown render markdown documents (LaTeX: 2024, ConTeXt example is MkII)
  • mathsets mathematical sets, probabilities etc. (2011, probably outdated)
  • metaducks partial port of TikZducks to MetaPost (2023)
  • pararef \startParagraph, for paragraphs as ‘thought blocks’ that may contain more than one 'TeX paragraph'. These paragraphs are numbered and can be referenced. See Paragraph referencing. (2012, probably obsolete)
  • pauta practise grids for medieval calligraphy (2024, LMTX)
  • PocketDiary PocketMod-style (and other) calendars incl. sun & moon data (2023, LMTX)
  • president “ConTeXt for pres(id)entations”, a few presentation styles with graphical progress indicator (2023, LMTX)
  • PresVoz automatical PDF presentations with recorded voice (2024, LMTX, works only with Acrobat on Windows)
  • pret-c syntax highlighting (pretty printing) for C (2010, outdated)
  • rst RestructuredText support (2014, MkIV)
  • simplebib simple bibliography (2012)
  • simplefonts simple font support (2013, obsolete)
  • simpleslides presentations (2023, works with LMTX)
  • squares magic/Latin squares (2024)
  • statistical-charts pie charts, bar charts etc. (2020)
  • sudoku port of Peter Norvig’s sudoku solver (2023)
  • title document title pages (2017)
  • transliterator scientific transliteration of Russian, Church Slavonic etc. (2021)
  • typearea like LaTeX/KoMa typearea (2008, MkII, obsolete)
  • vim syntax highlighting using vim’s syntax files (2022, works with LMTX)
  • visualcounter counters for presentations (2013; 2019 version)


Special Purpose Modules

The following modules implement special formatting requirement for journals or magazines. These modules are distributed with ConTeXt, so you don’t need to download anything.

Module writing guidelines

(Section moved to ConTeXt and Lua programming/Module writing)