Changes

Jump to navigation Jump to search
6,140 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 unzipthem in the local directory, because they can use the <tt>first-setup</tt> script for this.
To install for example the simpleslides modules you write
The complete list of availables modules in standalone is:
* [http://modules.contextgarden.net/account t-urwgaramond* taccount] draw T-accountaccounts* [http://modules.contextgarden.net/algorithmic t-algorithmic] like LaTeX algorithmic* [http://modules.contextgarden.net/animation t-animation] create animations* [http://modules.contextgarden.net/annotation t-annotation] todo lists* [http://modules.contextgarden.net/t-bnft-bnf] BNF grammar* [http://modules.contextgarden.net/chromato t-chromato] chromatograms* [http://modules.contextgarden.net/cmscbf t-cmscbf] bold small caps* [http://modules.contextgarden.net/cmttbf t-cmttbf] bold typewriter* [http://modules.contextgarden.net/t-construction-plan t-construction-plan] figures with defined scale* [http://modules.contextgarden.net/t-degrade t-degrade] degrading JPEG images* [http://modules.contextgarden.net/fancybreak t-fancybreak] thought breaks* [http://modules.contextgarden.net/filter t-filter] run external programs on inline code* [http://modules.contextgarden.net/fixme t-fixme] like LaTeX fixme* [http://modules.contextgarden.net/t-frencht-french]* [http://modules.contextgarden.net/fullpage t-fullpage]* [http://modules.contextgarden.net/games t-games] board games* [http://modules.contextgarden.net/gantt t-gantt] Gantt charts* [http://modules.contextgarden.net/gnuplot t-gnuplot] include GNUplot graphics* [http://modules.contextgarden.net/t-layout t-layout]* [http://modules.contextgarden.net/letter t-letter] formal letters* [http://modules.contextgarden.net/t-lettrinet-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/mathsetst-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]].
* t-pgfplots
* [http://modules.contextgarden.net/ruby t-ruby] Ruby markup (for Chinese, not programming language)* [http://modules.contextgarden.net/simplefonts t-simplefonts] simplified font mechanism* [http://modules.contextgarden.net/simpleslides t-simpleslides] presentations* [http://modules.contextgarden.net/typearea t-typearea] like LaTeX/KoMa typearea* [http://modules.contextgarden.net/typescripts t-typescripts] collection of typescripts* [http://modules.contextgarden.net/urwgaramond t-urwgaramond]* [http://modules.contextgarden.net/urwgothic t-urwgothic]* [http://modules.contextgarden.net/vim t-vim] syntax highlighting using vim’s syntax files (some of these are obsolete...) ==ConTeXt LMTX==
===TeX Live===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 ${{Note | description required}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.
The following modules are available:
* context-french
* context-games
* context-gantt
* context-gnuplot
* context-letter
* 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:=Modules= * [[source:t{{code|bibl-bib.texlua}} ({{src|tbibl-bib]].mkiv}}): [[Bibliography]] (maintained by Taco)* [[source:{{code|m-arabtex.tex}} ({{src|m-arabtex]].mkii}}): loading of Lagally's [[Arabian and Hebrew|ArabTeX]]* [[source{{code|m-barcodes}} ({{src|m-barcodes.mkiv}}):generate barcodes using PStricks. You should probably use m-zint instead.* {{code|m-chart}} ({{src|m-chart.texlua}} {{src|m-chart.mkii}} {{src|m-chart]].mkvi}}): [[Flow Charts]]* [[source:{{code|m-chemic}} ({{src|m-chemic.texmkii}} {{src|m-chemic]].mkiv}}): [[Chemistry|PPCHTeX]] (chemical structure formulae)* [[source:{{code|m-cweb.tex}} ({{src|m-cweb]].tex}}): [[CWEB]] pretty printing* [[source:{{code|m-database}} ({{src|m-database.lua}} {{src|m-database.texmkii}} {{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}}):* [[source{{code|m-directives}} ({{src|m-directives.mkiv}}):* {{code|m-dratex}} ({{src|m-dratex]].mkii}}): loading of DraTeX* [[source:{{code|m-edtsnc.tex}} ({{src|m-edtsnc]].mkii}}): support for editor synchronization, will replace m-pdfsync* [[source:{{code|m-educat.tex}} ({{src|m-educat]].tex}}): educational additions (for settings school tests or questionaires)* {{code|m-fields}} ({{src|m-fields.mkiv}}):* {{code|m-format}} ({{src|m-format.tex}}):* <strike>[[source:m-gamma.tex|m-gamma]]: [[Aleph|Omega]] support</strike>* [[source:{{code|m-graph}} ({{src|m-graph.texmkii}} {{src|m-graph]].mkiv}}): support for [[MetaPost]] graph module* [[source{{code|m-ipsum}} ({{src|m-ipsum.mkiv}}):lorem ipsum filler text* {{code|m-layout.tex}} ({{src|m-layout]].tex}}): defines some [[Layout]] presets* [[source:{{code|m-level.tex}} ({{src|m-level]].mkii}}): module for catching nesting errors* [[source{{code|m-logcategories}} ({{src|m-logcategories.mkiv}}):* {{code|m-markdown}} ({{src|m-markdown.lua}} {{src|m-markdown.mkiv}}):* {{code|m-mathcrap}} ({{src|m-mathcrap.mkiv}}):* {{code|m-mkii}} ({{src|m-mkii.mkiv}}):* {{code|m-mkivhacks}} ({{src|m-mkivhacks.mkiv}}):* {{code|m-morse}} ({{src|m-morse.mkvi}}):* {{code|m-narrowtt.tex}} ({{src|m-narrowtt]].tex}}): using a narrower [[Latin Modern]] font for verbatim* [[source:{{code|m-newmat.tex}} ({{src|m-newmat]].tex}}): support for some AMSmath features, is loaded by [[Math with amsl|amsl]], see [[Math with newmat]]* [[source{{code|m-ntb-to-xtb}} ({{src|m-ntb-to-xtb.mkiv}}):* {{code|m-obsolete}} ({{src|m-obsolete.mkii}} {{src|m-obsolete.mkiv}}):* {{code|m-oldfun}} ({{src|m-oldfun.mkiv}}):* {{code|m-oldnum}} ({{src|m-oldnum.mkiv}}):* {{code|m-pdfsnc.tex}} ({{src|m-pdfsnc]].mkii}}): editor/PDF synchronization support (used by iTeXMac and TeXShop)* [[source:{{code|m-pictex.tex}} ({{src|m-pictex]].tex}}): needed for [[PicTeX]] without eTeX* <strike>[[source:m-plus.tex|m-plus]]: loads some extra features (currently empty)</strike>* {{code|m-pstricks}} ({{src|m-pstricks.lua}} {{src|m-pstricks.mkii}} {{src|m-pstricks.mkiv}}):* {{code|m-punk}} ({{src|m-punk.mkiv}}):* <strike>[[source:m-pstricquest.tex|m-pstricquest]]: connection macros module for [[PSTricks]] fill-in forms* (PostScript tricksdutch only)</strike>* [[source:{{code|m-r.tex}} ({{src|m-r]].tex}}): typing and executing [http://www.r-project.org/ R] scripts* [[source:{{code|m-spreadsheet}} ({{src|m-questspreadsheet.texlua}} {{src|m-quest]]spreadsheet.mkiv}}): module for fill* {{code|m-in forms steps}} (dutch only)* [[source:{{src|m-steps.lua}} {{src|m-steps.texmkii}} {{src|m-steps]].mkvi}}): Step Charts, see [[XML]] step charts* [[source:{{code|m-streams.tex}} ({{src|m-streams]].tex}}): Synchronised typesetting from different sources* [[source:{{code|m-subsub.tex}} ({{src|m-subsub]].tex}}): Defines 5 extra sectioning levels* [[source:{{code|m-tex4ht.tex}} ({{src|m-tex4ht]].mkii}}): convert a ConTeXt document to html, more about it on [[tex4ht]]* [[source{{code|m-timing}} ({{src|m-timing.mkiv}}):* {{code|m-tryouttrackers}} ({{src|m-trackers.texmkiv}}):* {{code|m-translate}} ({{src|m-tryout]]translate.mkiv}}): Contains temporary functions for testing* [[source:{{code|m-units}} ({{src|m-units.texmkii}} {{src|m-units]].mkiv}}): Structured input of values with [[units]]* [[source:{{code|m-visual}} ({{src|m-visual.texmkii}} {{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:=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.
* [[Math with amsl|amsl]] (AMSmath, see [[Math]])
* [[Gnuplot]]: support for direct inclusion of Gnuplot graphs out of the source (the module has been removed from the main distribution and will be included into third party modules again when ready)
* [[Gantt charts]] (drawing Gantt charts)
File names of included modules start with "m-", but third party (contributed) modules should start with "t-".
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]).
An example:
<context source="yes">
\setuppapersize[A5]
\usemodule[int-load]
\loadsetups
\setupframedtexts
[setuptext]
[background=screencolor, backgroundcolor=lightgray,
frame=off]
</texcode>
Apart from the existing XML files in the ConTeXt tree there is little
documentation online, so feel free to relay your questions to
the [[ConTeXt_Mailing_ListsMailing 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