Input and compilation/Modules
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.
Contents
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
x-asciimath
(x-asciimath.mkxl etc.): Support for ASCII math input (used by math4all)m-asymptote
(m-asymptote.mkiv): Inclusion of Asymptote codem-barcodes
(m-barcodes.mkiv m-barcodes.mkxl): generate Create barcodes using PStricks (MkIV), redirects tom-zint
in LMTX.x-calcmath
(x-calcmath.mkxl x-calcmath.lmt etc.): calculator math syntaxx-cals
(x-cals.mkiv x-cals.lua): XML cals table rendererm-catchword
(m-catchword.mkiv): show the first word of the next page in the footer (like in medieval manuscripts; Custode, Reklamante, Blatthüter)m-chart
(m-chart.lua m-chart.mkvi): Flow chartsm-chemic
(m-chemic.mkiv): dummy module, since PPCHTeX (chemical structure formulae) is now built inx-chemml
(x-.mkiv x-.lua): ChemML syntax supportm-circuitikz
(m-circuitikz.mkiv m-circuitikz.mkxl): drawing circuits with TikZm-compatible
(m-compatible.mkiv): compatibility for older versions (unattended since 2018)m-crappyspec
(m-crappyspec.mkxl): limit text to a certain number of characters per linex-ct
(x-ct.mkiv x-ct.lua): tabulate and combination structures in XMLm-cweb
(m-cweb.mkiv): CWEB pretty printingm-database
(m-database.lua m-database.mkiv): creating simple tables (or forwarding data to user-defined commands) using comma/space/tab-separated values. Wiki: M-database.m-directives
(m-directives.mkiv): just calls \showdirectivesm-educat
(m-educat.mkiv): educational additions (for settings school tests or questionaires)x-entities
(x-entities.mkiv): load character entities for HTML interpretationm-escrito
(m-escrito.mkiv m-escrito.lua): limited PostScript interpreterm-examn
(m-examn.mkiv): testing and examination in JavaScript (outdated)m-fields
(m-fields.mkiv): fill-in form field with JS checkm-format
(m-format.mkiv): for formatting poetry (very old code)x-foxet
(x-foxet.mkiv): support for formatting objects, not usablem-gimmicks
(m-gimmicks.mkxl): “whatever comes up” (?)m-gnuplot
(m-gnuplot.mkxl): limited support for GNUplot via SVGm-graph
(m-graph.mkiv mp-grap.mpiv): support for MetaPost and MetaFun graph modulem-hemistich
(m-hemistich.mkiv): hemistiches (half-line poetry)x-html
(x-html.mkiv): HTML_to_ConTeXt setupm-ipsum
(m-ipsum.mkiv): lorem ipsum filler text with optionsm-json
(m-json.mkiv m-json.mkxl util-jsn.lua): activates Lua functions to interprete JSONm-layout
(m-layout.mkiv): defines some page layout presetsx-ldx
(x-ldx.mkiv x-ldx.ctx x-ldx.lua): Lua source code formatterx-lmx-html
(x-lmx-html.mkiv x-lmx-demo.mkiv): interpretation of filled-in HTML formsm-logcategories
(m-logcategories.mkiv): just calls \showlogcategoriesm-mathcrap
(m-mathcrap.mkiv): use Unicode super-/subscripts in math (not recommended)m-mathfun
(m-mathfun.mkxl): “weird stuff” (?)x-mathml
(x-mathml.mkxl x-mathml.lmt x-mathml.mkiv x-mathml.lua x-mathml-basics.mkiv): MathML syntax supportx-mathml-html
(x-mathml-html.mkiv): MathML syntax, support for some HTML tagsx-math-svg
(x-math-svg.mkiv x-math-svg.lua): convert MathML to SVGm-oldmath
(m-oldmath.mkxl): support for some obsolete math commands like\over
m-matrix
(m-matrix.mkiv): calculation and typsetting of Mathematics/Matricesm-maybe
(m-maybe.mkiv): experimental codem-media
(m-media.mkiv): support for SWF and U3D (deactivated)m-mkii
(m-mkii.mkiv): re-activate some MkII font switches (no general MkII compatibility)m-mkivhacks
(m-mkivhacks.mkiv): temporary hacksm-morse
(m-morse.mkvi): convert text to Morse code and backm-narrowtt
(m-narrowtt.mkiv): using a narrower Latin Modern font for verbatimm-nodechart
(m-nodechart.mkvi m-nodechart.lua): extension form-chart
(Flow charts)m-ntb-to-xtb
(m-ntb-to-xtb.mkiv): map |Natural tables with TABLE to Extreme tables with xtablem-obsolete
(m-obsolete.mkiv): print obsolete module warningm-old-columnsets
(m-old-columnsets.mkiv page-set.mkiv): activates old columsets codem-old-multicolumns
(m-old-multicolumns.mkiv page-mul.mkiv): activates old multicolumn codem-oldfun
(m-oldfun.mkiv): old implementation of initials (drop caps) etc. (current: \setupinitial)m-oldnum
(m-oldnum.mkiv): old implementation of \digitm-openstreetmap
(m-openstreetmap.mkxl m-openstreetmap.lmt): limited OSM XML renderer (no labels)x-pandoc
(x-pandoc.mkiv): Pandoc DocBook rendering (misleading name)x-pfs-01
(x-pfs-01.mkiv): pfsense status renderingx-physml
(x-physml.mkiv): PhysML syntax supportm-pictex
(m-pictex.mkiv): PicTeX support for MkIV; not supported in LMTX any morem-pipemode
(m-pipemode.mkiv): disables directivesystem.errorcontext
(\disabledirective)m-polynomial
(m-polynomial.mkxl): typesetting of polynomialsm-pstricks
(m-pstricks.lua m-pstricks.mkiv): PStricks support for MkIV; not supported in LMTX any morem-punk
(m-punk.mkiv): support for the Punk metapost fontm-scite
(m-scite.mkiv): syntax highlighting with SciTE lexersx-setups
(x-setups.mkiv etc.): load and typeset command syntax from interface filesm-simulate
(m-simulate.mkiv): fake words, similar tom-visual
’s \fakewordsm-spreadsheet
(m-spreadsheet.lua m-spreadsheet.mkiv): calculations in tablesm-sql
(m-sql.mkiv util-sql.lua): access to SQL databasesm-steps
(m-steps.lua m-steps.mkvi x-steps.mkiv): Step Charts, see XML step chartsm-subsub
(m-subsub.tex): Defines subsections up to level 12; obsolete, part of the corem-svg
(m-svg.mkxl): auxiliary functions for SVG rendering via MetaPostm-system-aliasing
(m-system-aliasing.mkiv): support for file aliases incl. globbing (?)m-system-readers
(m-system-readers.mkxl): reading from filesm-three
(m-three.mkiv mp-tres.mpiv): support for pseudo-3D projections with Metapost moduletres
m-tikz
(m-tikz.mkiv m-tikz.mkxl): TikZ supportm-tikz-pgfplots
(m-tikz-pgfplots.tex): TikZ supportm-tikz-pgfplotstable
(m-tikz-pgfplotstable.tex): TikZ supportm-timing
(m-timing.mkiv m-timing.mkxl): where does TeX spend its processing time?m-trackers
(m-trackers.mkiv): just calls \showtrackersm-translate
(m-translate.mkiv): text replacementsm-typesetting
(m-typesetting.mkiv): sample pages for documentation (?)x-udhr
(x-udhr.mkiv): typeset the declaration of human rights in several languages as Unicode test files (UDHR)m-units
(m-units.mkiv): Structured input of values with units; obsolete, part of the corem-visual
(m-visual.mkiv): Visual Debugging (described in ThisWay no.7 Faking Text and More)x-xfdf
(x-xfdf.mkiv): support for XFDF (XML Forms Data Format, PDF form exports) filesm-zint
(m-zint.mkiv): Generate barcodes using zint
Style modules
in texmf-context/tex/context/modules/common
:
s-cdr-00.tex
: CD-ROM cover styles-faq-00.tex
to-03
: FAQ styless-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 intexmf-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.
- My Way, User documentation on ConTeXt
cgj
Articles for ConTeXt Journal (proceedings of ConTeXt meetings)- pracjourn Articles for The PracTeX Journal
- maps Articles for MAPS, the publication of NTG (Nederlandstalige TeX Gebruikersgroep or Netherlands TeX Group)
- karnaugh draws Karnaugh maps containing data
- Extended description xdesc
Module writing guidelines
(Section moved to ConTeXt and Lua programming/Module writing)