Changes

Jump to navigation Jump to search
12,731 bytes added ,  19:07, 4 June 2016
m
Added the t-markdown module.
< [[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.
==Included modules:Installation==* [[source:t-bib.tex|t-bib]]: [[bibliography]] (maintained by Taco)* [[source:m-arabtex.tex|m-arabtex]]: loading of Lagally's [[Arabian and Hebrew|ArabTeX]]* [[source:m-chart.tex|m-chart]]: [[Flow Charts]]* [[source:m-chemic.tex|m-chemic]]: [[Chemistry|PPCHTeX]] (chemical structure formulae)* [[source:m-cweb.tex|m-cweb]]: [[CWEB]] pretty printing* [[source:m-edtsnc.tex|m-edtsnc]]: support for editor synchronization, will replace m-pdfsync* [[source:m-educat.tex|m-educat]]: educational additions (for settings school tests or questionaires)* [[source:m-gamma.tex|m-gamma]]: [[Aleph|Omega]] support* [[source:m-gnuplot.tex|m-gnuplot]]: support for direct inclusion of [[Gnuplot]] graphs out of the source* [[source:m-graph.tex|m-graph]]: support for [[MetaPost]] graph module* [[source:m-layout.tex|m-layout]]: defines some [[Layout]] presets* [[source:m-level.tex|m-level]]: module for catching nesting errors* [[source:m-newmat.tex|m-newmat]]: support for some AMSmath features, is loaded by [[Math with amsl|amsl]], see [[Math with newmat]]* [[source:m-pdfsnc.tex|m-pdfsnc]]: editor/PDF synchronization support (used by iTeXMac and TeXShop)* [[source:m-pictex.tex|m-pictex]]: needed for [[PicTeX]] without eTeX* [[source:m-plus.tex|m-plus]]: loads some extra features (side bars?)* [[source:m-pstric.tex|m-pstric]]: connection macros for [[PSTtricks]] (PostScript tricks)* [[source:m-quest.tex|m-quest]]: dutch only module for questionaires(?)* [[source:m-steps.tex|m-steps]]: Step Charts, see [[XML]] step charts* [[source:m-subsub.tex|m-subsub]]: Defines 5 extra sectioning levels* [[source:m-tex4ht.tex|m-tex4ht]]: will become a tex4html interface for ConTeXt* [[source:m-atryout.tex|m-tryout]]: (changing, temporary functions for tryout)* [[source:m-units.tex|m-units]]: [[units]]* [[source:m-visual.tex|m-visual]]: [[Visual Debugging]] (described in [[This Way]] no.7 [[manual:mag-0007.pdf|Faking Text and More]])
==Contributed modules:=Basics===For a list of contributed modules see [http://modules.contextgarden.net the modules section] on contextgarden.net.
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 module which is available as file only create
the subdirectories in the way described above and place the file there, for
modules which are available as zip files with precreated subdorectories you
can unzip the archive in the top-level directory (e.g. texmf-local/) and all
files are on the correct place.
 
After the files are placed at the right place you have to update TeX's database
to let it know where it can find the files, this is done for MkII with
 
mktexlsr (command name depends on the TeX distribution)
 
and for MkIV with
 
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.
 
To install for example the simpleslides modules you write
 
first-setup.sh --modules="t-simpleslides"
 
To install more modules at the same time write
 
first-setup.sh --modules="t-simpleslides,t-french"
 
The complete list of availables modules in standalone is:
 
* [http://modules.contextgarden.net/account t-account] draw T-accounts
* [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-bnf t-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-french t-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-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]].
* 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...)
 
===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-account
* context-bnf
* context-chromato
* context-construction-plan
* context-degrade
* context-french
* context-games
* context-gantt
* context-gnuplot
* context-letter
* context-lettrine
* context-lilypond
* context-mathsets
* context-simpleslides
* context-taspresent
* context-typearea
* context-vim
 
==Usage==
 
When you load a module with <code>\usemodule[modulename]</code> ConTeXt looks for a file with the following names:
 
* m-modulaname (core module)
* p-modulename (private module)
* s-modulename (ConTeXt style file)
* x-modulename (XML module)
* t-modulename (Third party module)
* modulename
 
Once a file is found ConTeXt stops the search and loads the found file (only once).
 
When you have two file with the same name but different prefixes you can tell ConTeXt which file it should load with
 
<code>\usemodule[<prefix>][modulename]</code>
 
==Included Modules==
 
* {{code|bibl-bib.lua}} ({{src|bibl-bib.mkiv}}): [[Bibliography]] (maintained by Taco)
* {{code|m-arabtex}} ({{src|m-arabtex.mkii}}): loading of Lagally's [[Arabian and Hebrew|ArabTeX]]
* {{code|m-barcodes}} ({{src|m-barcodes.mkiv}}): generate barcodes using PStricks. You should probably use m-zint instead.
* {{code|m-chart}} ({{src|m-chart.lua}} {{src|m-chart.mkii}} {{src|m-chart.mkvi}}): [[Flow Charts]]
* {{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 [[m-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-dratex}} ({{src|m-dratex.mkii}}): loading of DraTeX
* {{code|m-edtsnc}} ({{src|m-edtsnc.mkii}}): support for editor synchronization, will replace m-pdfsync
* {{code|m-educat}} ({{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>
* {{code|m-graph}} ({{src|m-graph.mkii}} {{src|m-graph.mkiv}}): support for [[MetaPost]] graph module
* {{code|m-ipsum}} ({{src|m-ipsum.mkiv}}): lorem ipsum filler text
* {{code|m-layout}} ({{src|m-layout.tex}}): defines some [[Layout]] presets
* {{code|m-level}} ({{src|m-level.mkii}}): module for catching nesting errors
* {{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}} ({{src|m-narrowtt.tex}}): using a narrower [[Latin Modern]] font for verbatim
* {{code|m-newmat}} ({{src|m-newmat.tex}}): support for some AMSmath features, is loaded by [[Math with amsl|amsl]], see [[Math with newmat]]
* {{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}} ({{src|m-pdfsnc.mkii}}): editor/PDF synchronization support (used by iTeXMac and TeXShop)
* {{code|m-pictex}} ({{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-quest.tex|m-quest]]: module for fill-in forms
* (dutch only)</strike>
* {{code|m-r}} ({{src|m-r.tex}}): typing and executing [http://www.r-project.org/ R] scripts
* {{code|m-spreadsheet}} ({{src|m-spreadsheet.lua}} {{src|m-spreadsheet.mkiv}}):
* {{code|m-steps}} ({{src|m-steps.lua}} {{src|m-steps.mkii}} {{src|m-steps.mkvi}}): Step Charts, see [[XML]] step charts
* {{code|m-streams}} ({{src|m-streams.tex}}): Synchronised typesetting from different sources
* {{code|m-subsub}} ({{src|m-subsub.tex}}): Defines 5 extra sectioning levels
* {{code|m-tex4ht}} ({{src|m-tex4ht.mkii}}): convert a ConTeXt document to html, more about it on [[tex4ht]]
* {{code|m-timing}} ({{src|m-timing.mkiv}}):
* {{code|m-trackers}} ({{src|m-trackers.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 Way]] 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.
 
{{todo|list more modules or none of them}}
 
* [[Extended description|xdesc]] (extended description, e.g. for epigrams)
* [[Math with nath|nath]] (natural math, see [[Math]])
* [[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)
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/MyWay|MyWay]] 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==
Prior ===Module requirements===All modules should start with a block containing ''meta information'' about that module.There is a [[module template]] available to release 2005help setting up that header correctly. Do not forget to specify a ''license'' as the permitted modes of distributiondepend on which one you choose.The [http://wiki.05contextgarden.25net/Read_Me#The_Code ConTeXt sources] are licensedeither under GPLv2 or the LPPL, ConTeXt silently truncated all so you might want to stick to these or a more permissivelicense.(Choose one: [http://www.opensource.org/].)Including the full text of your license in your source repo is best practice. In order to avoid ''conflicting macros'' it is essential for a module that it adhere to the [[Module_Namespaces|namespace convention]].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 names (as in [http://source.contextgarden.net/tex/context/interface/cont-en.xml /tex/context/interface/cont-en.xml]).Its purpose is a comprehensive listing of the optional and non-optionalarguments that a macro defined in the module accepts.From the interface a good deal of documentation can be auto-generated,as are for instance the [http://pragma-ade.com/general/qrcs/setup-en.pdf ConTeXt Quick Reference]and the initial input of the [http://wiki.contextgarden.net/Category:Reference/en Command Reference],which itself started as a wikification of the now obsolete ''TeXShow''. When documenting your module, you can use<cmdtexcode>\usemodule[int-load] %Allow xml parsing \loadsetups[m-name-of-your-module.xml] % to load the file with definitions\setup{nameofyourcommand}</cmdtexcode> commands to 8 characters long and lowercased them to  An example:<context source="prevent cross platform problems with filenamesyes">\setuppapersize[A5]\usemodule[int-load]\loadsetups\setup{externalfigure}</context> By default, this places a frame around the setup. If you want to get gray background, as in the context documentation, add the following <texcode> Thus\setupframedtexts [setuptext] [background=color, module backgroundcolor=lightgray, frame=off]</texcode> Apart from the existing XML files in the ConTeXt tree there is littledocumentation online, so feel free to relay your questions tothe [[Mailing list|mailing list]]. ===Self-documenting source code===Source files that are supposed to contain explanatory comments that documentimplementation details and other peculiarities the reader should be used with older versions aware of ConTeXt must have filenames that fit those restrictions.In <tt>.tex</tt> files (and other files containing primarily TeX code, or they e.g.<tt>.mki[iv]</tt>) any line beginning with the comment leader <tt>%D</tt>will be treated as such a docstring.Formatting is done via ordinary TeX commands.In Lua files (somewhat crypticallye.g. <tt>.cld</tt>) not multi-line comments start with<tt>--[[ldx--</tt> and end with <tt>--ldx]]--</tt>.Text inside those delimiters can be formatted using basic ''HTML'' tags.Ordinary comments are still treated as part of the source and thereforethey will be foundtypeset inside the listing.
Docstrings, though they appear to the [Lua]TeX interpreter as ordinary
comments, allow for pretty printing source code when used with two
dedicated modules:
* [[source:x-ldx.ctx|<tt>x-ldx.ctx</tt>]] for Lua files, and
* [[source:s-mod.ctx|<tt>s-mod.ctx</tt>]] for TeX files.
Thus, in order to generate the documentation for the
[https://bitbucket.org/wolfs/simplefonts/src ''simplefonts'']
module you first have to chdir to the <tt>files</tt> subdirectory of
your checkout.
Next you run the pretty printer on its main file
<pre>
context --ctx=s-mod t-simplefonts.tex
</pre>
to get a <tt>t-simplefonts.pdf</tt> which contains the &ndash; sparse
&ndash; annotations in serif and the actual code as colorful listing.
Likewise the processing of Lua code, e.g. <tt>[[source:font-def.lua|font-def.lua]]</tt> from
the main ConTeXt tree:
<pre>
context --ctx=x-ldx font-def.lua
</pre>
Which should generate a font-def.pdf in your current directory.
<b>TODO<(The autogenerated documentation of all ConTeXt sources has beenmade available by Luigi at [http:/b>/foundry.supelec.fr/gf/project/modules/].Go there for examples of the output.)
Each module should have an associated specification file (as in [http://source.contextgarden.net/tex/context/interface/cont===Legacy modules disclaimer===<!-- This info is obsolete, the section could be kicked out, doesn’t it? -en.xml /tex/context/interface/cont-en>Prior to release ''2005.xml])05. Probably one day this will become a part of [http:25'', ConTeXt silently truncated all file names in <cmd>usemodule<//texshowcmd> commands to 8 characters long and lowercased them to "prevent cross platform problems with filenames".contextgarden.net/ texshow] and Thus, module files that are to be used with older versions of ConTeXt must have filenames that fit those restrictions, or they will also (somewhat cryptically) not be easy-to-editfound.
1

edit

Navigation menu