Changes

Jump to navigation Jump to search
1,982 bytes added ,  13:18, 9 August 2020
m
Text replacement - "</cmd>" to "}}"
< [[The ConTeXt Way]]
 
Modules are extensions to ConTeXt's core functions.
There are not as many modules for ConTeXt as packages for LaTeX, because a lot of LaTeX package features are in ConTeXt's core.
==Installation==
===Basics===
The installation of extra files in TeX (called modules in ConTeXt) can be difficult
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 module which is available as file only create
context --generate
===ConTeXt standalone===
Users of the ConTeXt standalone (formerly "minimals") distribution don't have to download the module files and unzip them in the local directory, because they can use the <tt>first-setup</tt> script for this.
* [http://modules.contextgarden.net/t-lettrine t-lettrine] decorative paragraph starts (initials)
* [http://modules.contextgarden.net/t-lilypond t-lilypond] include musical scores with GNU LilyPond
* [http://ctan.org/pkg/markdown t-markdown] render markdown documents
* [http://modules.contextgarden.net/mathsets t-mathsets] mathematical sets, probabilities etc.
* [http://modules.contextgarden.net/pararef t-pararef] {{cmd|startParagraph|link=no}}, for paragraphs as ‘thought blocks’ that may contain more than one 'TeX paragraph'. These paragraphs are numbered and can be referenced. See [[Paragraph Referencing]].
(some of these are obsolete...)
==ConTeXt LMTX== As of 2020-06-06, the ConTeXt LMTX distribution does not provide a built-in way to install or update modules. However, (something like) the following can be used to install and update all modules together with the rest of the distribution. The snippet must be run from the toplevel directory of the ConTeXt LMTX distribution, i.e. the directory that contains <tt>install.sh</tt>. Because the final <tt>tex/texmf-modules</tt> must contain the union of all individual module directories, the snippet creates and leaves an intermediate <tt>modules</tt> directory in the toplevel directory of the ConTeXt LMTX distribution. There may be a more clever way of using <tt>rsync</tt>, that does not need an intermediate directory. On the other hand, as of 2020-06-06, only 37MB of space are wasted.  # Transfer all modules from the ConTeXt Garden. # # No -p (--perms) is given to rsync, because, as of 2020-06-06, many # files (e.g. all files in # modules/t-letter/tex/context/third/letter/style) would come out # world-writeable, which may pose a significant security risk on a # multi-user system. # # The --chmod=D755,F644 may not be necessary. However, as of # 2020-06-06, without it files come out with executable bits set. rsync -rltsv --new-compress --delete --chmod=D755,F644 \ rsync://contextgarden.net/minimals/current/modules/ \ modules # Recreate tex/texmf-modules as an empty directory. WARNING: This # assumes that you have nothing but modules from ConTeXt Garden in # tex/texmf-modules. rm -rf tex/texmf-modules mkdir -p tex/texmf-modules # Create the union of all modules in tex/texmf-modules. for module in modules/* ; do rsync -rlts --exclude=/VERSION ${module}/ tex/texmf-modules done # Update the ConTeXt LMTX distribution. Alternatively, if you do not # want to do that, you have to run mtxrun --generate. sh ./install.sh ==TeX Live===
TeX Live is a large TeX distribution for most Linux and BSD based operating systems. It provides binaries and many other files necessary to run TeX and its flavors. Many ConTeXt modules are included.
* context-vim
==Usage==
When you load a module with <code>\usemodule[modulename]</code> ConTeXt looks for a file with the following names:
<code>\usemodule[<prefix>][modulename]</code>
==Included Modules==
* {{code|bibl-bib.lua}} ({{src|bibl-bib.mkiv}}): [[Bibliography]] (maintained by Taco)
* {{code|m-chemic}} ({{src|m-chemic.mkii}} {{src|m-chemic.mkiv}}): [[Chemistry|PPCHTeX]] (chemical structure formulae)
* {{code|m-cweb}} ({{src|m-cweb.tex}}): [[CWEB]] pretty printing
* {{code|m-database}} ({{src|m-database.lua}} {{src|m-database.mkii}} {{src|m-database.mkiv}}): creating simple tables (or forwarding data to user-defined commands) using [[mM-database|comma/space/tab-separated values]]. Wiki: [[M-database]].
* {{code|m-datastrc}} ({{src|m-datastrc.tex}}):
* {{code|m-directives}} ({{src|m-directives.mkiv}}):
* {{code|m-translate}} ({{src|m-translate.mkiv}}):
* {{code|m-units}} ({{src|m-units.mkii}} {{src|m-units.mkiv}}): Structured input of values with [[units]]
* {{code|m-visual}} ({{src|m-visual.mkii}} {{src|m-visual.mkiv}}): [[Visual Debugging]] (described in [[This WayThis_Way_-_My_Way#ThisWay|ThisWay]] no.7 [[magazine:0007|Faking Text and More]])
* {{code|m-zint}} ({{src|m-zint.mkiv}}): Generate barcodes using [http://www.zint.org.uk zint.exe]
==Contributed Modules==
For a list of contributed modules see [http://tlcontrib.metatex.org/ tlcontrib] and/or [http://modules.contextgarden.net the modules section] on contextgarden.net.
In order to install a contributed module, copy its directory into <code>$TEXMF/tex/context/third</code> then run <code>luatools --generate</code>.
==Special Purpose Modules==
The following modules implement special formatting requirement for journals or magazines. These modules are distributed with ConTeXt, so you need not download anything.
* [[Modules/This Way - My Way#MyWay|MyWayMy Way]] , User documentation on ConTeXt
* [[Modules/Pracjourn|pracjourn]] Articles for [http://tug.org/pracjourn/ The PracTeX Journal]
* [[Modules/Maps|maps]] Articles for [http://www.ntg.nl/maps.html MAPS], the publication of NTG (Nederlandstalige TeX Gebruikersgroep or Netherlands TeX Group)
==Modules writing guidelines==
===Module requirements===
All modules should start with a block containing ''meta information'' about that module.
There is a [[module Module template]] available to help setting up that header correctly.
Do not forget to specify a ''license'' as the permitted modes of distribution
After releasing a module its namespace[s] should be registered in the [[Module_Namespaces#List_of_Module_Namespaces|list]] for other module authors to know.
===XML Interface file===
Each module should have an associated XML specification file
(as in [http://source.contextgarden.net/tex/context/interface/cont-en.xml /tex/context/interface/cont-en.xml]).
the [[Mailing list|mailing list]].
===Self-documenting source code===
Source files are supposed to contain explanatory comments that document
implementation details and other peculiarities the reader should be
Go there for examples of the output.)
===Legacy modules disclaimer===
<!-- This info is obsolete, the section could be kicked out, doesn’t it? -->
Prior to release ''2005.05.25'', ConTeXt silently truncated all file names in <{{cmd>|usemodule</cmd> }} commands to 8 characters long and lowercased them to "prevent cross platform problems with filenames". Thus, module files that are to be used with older versions of ConTeXt must have filenames that fit those restrictions, or they will (somewhat cryptically) not be found.

Navigation menu