https://wiki.contextgarden.net/api.php?action=feedcontributions&user=Braslau&feedformat=atomWiki - User contributions [en]2024-03-29T12:38:49ZUser contributionsMediaWiki 1.34.1https://wiki.contextgarden.net/index.php?title=ConTeXt_Standalone&diff=23161ConTeXt Standalone2016-10-19T00:18:29Z<p>Braslau: added openbsd (coming soon)</p>
<hr />
<div>{{Installation navbox}}<br />
<br />
The '''ConTeXt suite''' is a complete, up-to-date ConTeXt distribution that can be upgraded efficiently. It can also be used in parallel with existing TeX installations such as MikTeX, TeXLive, and so forth. The suite does not include LaTeX packages and binaries.<br />
<br />
Sometimes ConTeXt beta releases have issues. The ConTeXt suite allows you to test the latest ConTeXt release without worrying whether upgrading will corrupt a critical project. Multiple ConTeXt suite installations are possible. This allows, for example, a stable version and a beta version to run in parallel on the same computer.<br />
<br />
ConTeXt is also included in TeXlive. The ConTeXt suite is updated continuously, whereas ConTeXt in TeXlive is updated less often. In particular, <code>luatex</code> and <code>metapost</code> are under active development and their binaries are updated frequently. ConTeXt follows these developments, indeed often drives development. As the binaries included in the TeXlive distribution are only updated yearly, ConTeXt on TeXlive will necessarily be less current than the ConTeXt suite. (ConTeXt on TeXlive can be kept somewhat more current using the http://tlcontrib.metatex.org repository.) The ConTeXt suite is self-contained and can happily coexist alongside another installed TeX distribution.<br />
<br />
{{TOClimit|limit=1}}<br />
<br />
= General Information =<br />
<br />
== Supported platforms ==<br />
<br />
{| style="border:1px solid #DDDDDD;"<br />
|- align="left" <br />
! Platform<br />
! Short name<br />
! Binaries by<br />
! Notes<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Windows<br />
| mswin<br />
| Akira Kakuto ([http://w32tex.org W32TeX])<br />
|<br />
|- align="left"<br />
! Linux<br />
| linux<br />
| Hans Hagen, Mojca Miklavec, Alan Braslau<br />
| compiled with glibc 2.3.6<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Linux, 64-bit<br />
| linux-64<br />
| Alan Braslau<br />
|<br />
|- align="left"<br />
! Linux, PowerPC<br />
| linux-ppc<br />
| Piotr Kopszak<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Linux, Arm (low end.)<br />
| linux-armel<br />
| Boris Veytsman<br />
| in progress<br />
|- align="left"<br />
! Mac OS X, Intel (32-bit)<br />
| osx-intel<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Mac OS X, Intel (64-bit)<br />
| osx-64<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left"<br />
! Mac OS X, PowerPC<br />
| osx-ppc<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Mac OS X, Universal Binaries<br />
| osx-universal<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left"<br />
! FreeBSD<br />
| freebsd<br />
| Alan Braslau<br />
| compiled with libstdc++<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! FreeBSD, 64-bit<br />
| freebsd-amd64<br />
| Alan Braslau<br />
| compiled with libstdc++<br />
|- align="left"<br />
! kFreeBSD<br />
| kfreebsd-i386<br />
| Alan Braslau<br />
| FreeBSD + glibc (Debian)*<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! kFreeBSD, 64-bit<br />
| kfreebsd-amd64<br />
| Alan Braslau<br />
| FreeBSD + glibc (Debian)*<br />
|- align="left"<br />
! OpenBSD<br />
| openbsd<br />
| Alan Braslau<br />
| coming soon<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! OpenBSD, 64-bit<br />
| openbsd-amd64<br />
| Alan Braslau<br />
| coming soon<br />
|- align="left"<br />
! Solaris, Intel<br />
| solaris-intel<br />
| Marco Patzer<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Solaris, Sparc<br />
| solaris-sparc<br />
| Mojca Miklavec<br />
| Solaris 10 on [http://www.opencsw.org/about/ OpenCSW]<br />
|}<br />
<br />
*Note: we have stopped distributing binaries for kfreebsd. However, this system is still supported, and natively-compiled binaries can be installed from the Debian distribution.<br />
<br />
We need volunteers for providing binaries for other platforms. If you want to support a platform, please write to [[ConTeXt Mailing Lists]]<br />
<br />
== Dependencies ==<br />
* [http://www.ruby-lang.org Ruby] 1.8 or newer (used for MKII)<br />
* Rsync (The windows binary of rsync is distributed within the suite)<br />
<br />
<br />
The following programs are not required for running ConTeXt, but their installation adds additional functionality.<br />
<br />
* curl : for including remote content<br />
* ghostscript : for converting PostScript images to PDF<br />
* graphicsmagick (convert) : for converting GIF and TIFF images<br />
* inkscape : for converting SVG and compressed SVG<br />
* mupdf (mudraw) : for converting PDF to PNG (used for ePub covers)<br />
* pstoedit : for converting PostScript to MetaPost outlines<br />
* zint : for providing barcodes<br />
* zip or 7zip : for EPUB generation<br />
<br />
== Disc space required ==<br />
ConTeXt macro files are small (less than 10MB), but the suite comes with various free fonts which considerably increase the size of the distribution to around 200MB).<br />
<br />
== Multiple instances of the installation ==<br />
Please note from the start that we recommend installing a complete ConTeXt installation for each project in a production environment. The installation tree is portable (see Moving the Installation Around, below) and can be located under the project's own directory. The advantage is to allow each project to use an instance of ConTeXt that is adapted to its coding and that only gets updated purposely. Since the ConTeXt Standalone is "bleading edge" and subject to developement, certain details in commands, syntax or rendering may evolve slightly. Having a vintage ConTeXt tree for each production project insures that one can come back years later and produce identical results.<br />
<br />
So as not to get carried away under this approach, one can eventually group projects by vintage, period or season, according to cycles of productivity.<br />
<br />
== Standalone ==<br />
<br />
* [[ConTeXt Standalone/FAQ|Standalone/FAQ]] <br />
* [[ConTeXt Standalone/Structure|Standalone/Structure]] <br />
* [[ConTeXt Standalone/Implementation|Standalone/Implementation]]<br />
* [[ConTeXt Standalone/TODO|Standalone/TODO]] <br />
* [[ConTeXt Standalone/Contents|Standalone/Contents]] <br />
* [[ConTeXt Standalone/TeX Live|Standalone/TeX Live]]<br />
* Browse the [http://minimals.contextgarden.net installation tree]<br />
<br />
<br />
<br />
= Unix-like platforms (Linux/MacOS X/FreeBSD/Solaris) =<br />
<br />
For Mac installation see also [http://wiki.contextgarden.net/Mac_Installation Mac installation page].<br />
<br />
== Single user installation ==<br />
<br />
Select a folder where you want to install ConTeXt. We recommend that you can use your <code>$HOME/context</code> directory. Create this folder. Then download and place it in <code>$HOME/context</code> directory. Open a terminal, then:<br />
<br />
<pre><br />
mkdir ~/context<br />
cd ~/context<br />
wget http://minimals.contextgarden.net/setup/first-setup.sh<br />
<br />
# Install the latest beta of ConTeXt<br />
# This takes a long time, so go have a coffee<br />
# Flags you can add to the first-setup.sh call:<br />
# --modules=all # Install all third-party modules<br />
# --context=current # Install latest stable version<br />
# --engine=luatex # Install only MkIV, leave out MkII<br />
# # This shrinks the install from 270 MB to 200 MB<br />
<br />
sh ./first-setup.sh --modules=all<br />
</pre><br />
<br />
== System-wide installation ==<br />
<br />
A system wide installation is recommended for users who are comfortable with the command line. Only the location of installing ConTeXt is different for a system wide installation.<br />
<br />
* on Linux you can use <code>/opt/context</code><br />
* on MacOS X you can use <code>/Applications/ConTeXt</code><br />
<br />
Note that, at present, while ''using'' MkIV, you need to have write permissions for the <code>$TEXMFCACHE</code> directory. This effectively means that only one user will be able to generate the formats unless you set the group permissions appropriately. For example:<br />
<br />
* <code>CONTEXT_HOME=/opt/context</code><br />
* <code>TEXMFCACHE=$CONTEXT_HOME/tex/texmf-cache</code><br />
* <code>chmod -R g+w $TEXMFCACHE</code><br />
<br />
<pre><br />
# Create the /opt/context directory -- change as appropriate or desired if you <br />
# want a different installation directory.<br />
cd /opt<br />
mkdir context<br />
<br />
cd context<br />
<br />
# Fetch the install script<br />
wget http://minimals.contextgarden.net/setup/first-setup.sh<br />
<br />
# Install the latest beta of ConTeXt<br />
# This takes a long time, so go have a coffee<br />
# Flags you can add to the first-setup.sh call:<br />
# --modules=all # Install all third-party modules<br />
# --context=current # Install latest stable version<br />
# --engine=luatex # Install only MkIV, leave out MkII<br />
# # This shrinks the install from 270 MB to 200 MB<br />
<br />
sh ./first-setup.sh --modules=all<br />
<br />
# change ownership to real rather than effective id<br />
chown -R `id -r -u`:`id -r -g` .<br />
</pre><br />
<br />
===Cache===<br />
<br />
To customize the cache directory and other options, see the [[Custom_Configuration|Custom Configuration]] page.<br />
<br />
===Font Directory===<br />
<br />
Add the OSOFONTDIR into ./tex/setuptex. Go to under the line:<br />
<br />
# TODO: we could set OSFONTDIR on Mac for example<br />
<br />
(if you don't have the line above, go to the end of the file) and add there:<br />
<br />
export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts"<br />
<br />
For more information: [[Fonts in LuaTeX]]<br />
<br />
== Apache webserver installation ==<br />
<br />
Another common usecase is invoking ConTeXt from within a web application. Because web directories are often self-contained, and in the case of Apache under Ubuntu, ownership of the directory and its contents are assigned to a user and group without a login shell, e.g., <code>www-data:www-data</code> this prevents a web application from invoking a ConTeXt installation done using either the single-user or system-wide method listed above.<br />
<br />
In this case the solution is to install ConTeXt within the website tree, and ideally in the public sub-tree. The public sub-tree is commonly the home directory for the application and relative pathnames are resolved as if immediately below it.<br />
<br />
For example, in the case of the PHP web framework Laravel, ConTeXt can be installed alongside other assets in the <path-to-document-root>/public/context directory:<br />
<br />
<pre><br />
cd <path-to-document-root>/public<br />
mkdir context<br />
cd context<br />
wget http://minimals.contextgarden.net/setup/first-setup.sh<br />
<br />
# Install the latest beta of ConTeXt<br />
# This takes a long time, so go have a coffee<br />
# Flags you can add to the first-setup.sh call:<br />
# --modules=all # Install all third-party modules<br />
# --context=current # Install latest stable version<br />
# --engine=luatex # Install only MkIV, leave out MkII<br />
# # This shrinks the install from 270 MB to 200 MB<br />
<br />
sh ./first-setup.sh --modules=all<br />
</pre><br />
<br />
Once installed, you need to ensure that the permissions are correct for Apache to be able to access it (you will either need <code>sudo</code> privileges or root access):<br />
<br />
<pre><br />
$ cd <path-to-document-root>/public<br />
$ sudo chmod -R www-data:www-data context<br />
</pre><br />
<br />
Now as part of your application's invocation of ConTeXt, you will need to set up the shell environment. This is easily done by creating a simple BASH shell script, also to be installed in the public part of the document tree:<br />
<br />
<pre><br />
#!/usr/bin/env bash<br />
<br />
#<br />
# proccontext.sh<br />
#<br />
# To be installed in <path-to-document-root>/public/bin<br />
<br />
. <path-to-document-root>/public/context/tex/setuptex <path-to-document-root>/public/context/tex<br />
<br />
cd tex/spool<br />
context $1 > /tmp/context_run.log<br />
</pre><br />
<br />
Here the dynamically generated ConTeXt source file is expected to be found in the <code><path-to-document-root>/tex/spool</code> directory.<br />
<br />
Now within your application, you can invoke this shell script (in this case using PHP):<br />
<br />
<pre><br />
$cmd = "bin/proccontext.sh $input_filename";<br />
$last_line = system($cmd, $ret_val);<br />
</pre><br />
<br />
And the output will once again be found in <code><path-to-document-root>/tex/spool</code>.<br />
<br />
==Arch Linux==<br />
There’s a [https://aur.archlinux.org/packages/context-minimals-git PKGBUILD] in<br />
the AUR, provided by Aditya [https://github.com/adityam/context-pkgbuild].<br />
Install it using your favorite AUR frontend, e.g.<br />
<br />
<pre><br />
yaourt -S context-minimals-git<br />
</pre><br />
<br />
This will get you a fresh, up-to-date Context tree in<br />
<tt>/opt/context-minimals</tt>.<br />
<br />
== The funtoo way ==<br />
<br />
If you are using [http://funtoo.org funtoo] there are ebuilds that will make an installation as easy as installing any other package from portage. Take a look at the [[ConTeXt Standalone Funtoo]] Howto. This might also work for [http://www.gentoo.org gentoo], but is untested right now.<br />
<br />
== Proxy settings ==<br />
<br />
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal or your startup script (<code>.bashrc</code> or the corresponding file for your shell). Replace username, password, proxyhost and proxyport with the correct information<br />
<br />
export RSYNC_PROXY=username:password@proxyhost:proxyport<br />
<br />
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).<br />
<br />
export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'<br />
<br />
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.<br />
<br />
== Usage ==<br />
<br />
ConTeXt suite works in a non-interfering manner because it does not put anything in your <code>$PATH</code> and does not set any system variables. This in turn means that in order to use it, you need to do some initialization. An intialization script called <code>setuptex</code> is provided in <code>installation-dir/tex/</code>. <br />
<br />
=== Terminal/Command line ===<br />
<br />
To run context from a terminal, source <code>setuptex</code>:<br />
<br />
source /installation-dir/tex/setuptex<br />
<br />
=== Exclusive usage ===<br />
<br />
If you always use ConTeXt suite and '''never''' use LaTeX or plain TeX provided by another TeX distribution, you can add the following line to the startup script of your shell (For bash, the startup script is <code>$HOME/.bashrc</code>; for zsh it is <code>HOME/.zshrc</code>).<br />
<br />
source /installation-dir/tex/setuptex<br />
<br />
Then <code>setuptex</code> will always be sourced in your terminal.<br />
<br />
=== Integrating with an editor ===<br />
<br />
The easiest way to run ConTeXt from an editor is to open a terminal, source {{code|setuptex}} in the terminal, and then open your editor '''from the same terminal'''. <br />
<br />
Another option is to add {{code|/installation-dir/tex/texmf-<platform>/bin}} to the {{code|$PATH}} that the editor searches. The details vary depending on the editor. See [[Text Editors]] for instructions on integrating ConTeXt with various editors. <br />
<br />
For information about configuring [http://smultron.sourceforge.net/ Smultron] and [http://www.uoregon.edu/~koch/texshop/obtaining.html TeXShop] (which are popular TeX editors on Mac) see [[ConTeXt Standalone/Mac Installation]].<br />
<br />
<br />
== Updating ==<br />
<br />
For updating the ConTeXt suite, <br />
first update <code>first-setup.sh</code>, then run it. You could<br />
also create an alias or a little script “ctx-update”<br />
with the following example contents:<br />
<pre><br />
cd /opt/context<br />
rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh .<br />
sh ./first-setup.sh --modules=all<br />
</pre><br />
<br />
== Uninstalling ==<br />
<br />
ConTeXt suite does not touch anything outside its installation folder. So to uninstall it, you can simply remove the installation folder.<br />
<br />
== Remaking formats ==<br />
<br />
Normally, the update script should create the formats for you. If for some reason you need to recreate the formats, you can do the following:<br />
<br />
* For making MKII format.<br />
<br />
mktexlsr<br />
texexec --make --all <br />
<br />
* For making XeTeX format<br />
<br />
mktexlsr<br />
texexec --make --xtx --all <br />
<br />
* For making MKIV format<br />
<br />
mtxrun --generate<br />
context --make<br />
<br />
= Windows =<br />
<br />
If you want to use ConTeXt suite alongside MikTeX/TeXLive (needed if you also run LaTeX), follow the command-line installation method. <br />
<br />
== Installation ==<br />
<br />
=== Command line method ===<br />
Download [http://minimals.contextgarden.net/setup/context-setup-mswin.zip context-setup-mswin.zip] or [http://minimals.contextgarden.net/setup/context-setup-win64.zip context-setup-win64.zip], and unzip to a directory where you want to install ConTeXt. It is recommended that you choose a directory that does not have a space in its full path. Then open <code>cmd.exe</code>, go to the installation directory and run<br />
<br />
first-setup.bat<br />
<br />
This takes a long time, so go have a coffee. <br />
<br />
By default, the suite installs ConTeXt beta. If you want the stable version of ConTeXt, you can use <br />
<br />
first-setup.bat --context=current<br />
<br />
By default, the suite does ''not'' install modules and other third party content. If you want the modules (and have the bandwidth), you can use<br />
<br />
first-setup.bat --modules=all<br />
<br />
<br />
If the above installation instructions don't seem to answer your questions, see page [[Windows_Installation:_ConTeXt_Suite_with_SciTe| Windows Installation: ConTeXt Suite with SciTe]] for more detailed information.<br />
<br />
<br />
== Proxy settings ==<br />
<br />
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal as (replace username, password, proxyhost and proxyport with the correct information)<br />
<br />
set RSYNC_PROXY=username:password@proxyhost:proxyport<br />
<br />
or set the variable permanently as a Windows environment variable.<br />
<br />
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).<br />
<br />
export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'<br />
<br />
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.<br />
<br />
== Usage ==<br />
<br />
Before running ConTeXt, you need to run <code>setuptex.bat</code> which is provided in <code>installation-dir\tex\</code>. This can be done by typing<br />
<br />
installation-dir\tex\setuptex.bat<br />
<br />
on cmd.exe before you run ConTeXt. To avoid always having to type this, you can create a shortcut to cmd.exe and edit the command line to read (assuming you installed the suite in <code>C:\Programs</code>; otherwise replace <code>C:\Programs\</code> with your installation directory)<br />
<br />
C:\WINDOWS\System32\cmd.exe /k C:\Programs\context\tex\setuptex.bat<br />
<br />
This starts up a new command shell with the environment pre-loaded. Within the new shell you can just type <code>context</code> to run ConTeXt. E.g.<br />
<br />
C:\> context --version<br />
<br />
to check that you are running the version you think you're running.<br />
<br />
=== Use ConTeXt with Cygwin ===<br />
After installing the ConTeXt suite, you can run it under Cygwin. With Cygwin, you may use gmake and other Unix tools for your automated workflow.<br />
<br />
# Run <code>setuptex.bat</code> in DOS command prompt<br />
# In the same DOS prompt, enter Cygwin by running <code>cygwin.bat</code> (in your Cygwin installation directory)<br />
# Under Cygwin prompt, run <code> context.cmd test.tex </code>. Note that the <code>.cmd</code> extension is needed under Cygwin.<br />
<br />
== Updating ==<br />
<br />
If you used the command line method, just run <code>first-setup.bat</code> again to update the suite.<br />
<br />
<br />
== Uninstallation ==<br />
<br />
If you used the command-line installer, you can just delete the installation directory to uninstall the suite.<br />
<br />
<br />
== Troubleshooting ==<br />
<br />
* rsync sometimes has problems with paths with uppercase letters (like <code>c:\Temp</code> or <code>C:\Documents and Settings</code>). Installing into all-lowercase paths without spaces sometimes helps.<br />
* Directory-name length may also have an effect, due to Windows's 8.3 filename conventions. An indicator is if running "texexec --lua" on a file produces missing-file warnings containing Windows-created 8-character directory names, such as "C:\CONTEX~1\tex", where your ConTeXt directory is really "C:\context_minimals\tex". Be conservative and choose a short name like "C:\ctm\tex". Also, this may even work when an 8-character-or-less directory name like "C:\ctexmin\tex" doesn't.<br />
* If you're behind firewall and rsync times out, you need to open port 873 for outgoing TCP connections.<br />
* If you update luaTeX occasionally you may get something like <br />
<br />
<code>engine mismatch (luv: This is LuaTeX, Version beta-<version>-<date1> (TeX Live 2013/dev)(rev <number1>) <> bin: This is LuaTeX, Version beta-<version>-<date1> (TeX Live 2012/W32TeX)(rev <number2>)), forcing remake</code><br />
<br />
In which case your format will be remade every time you compile a file. In /texmf-mswin make sure that luatex.exe and texlua.exe have the same date; then also delete luatex.dll. This usually solves the problem.<br />
<br />
= Installing third party modules =<br />
<br />
The ConTeXt suite only comes with Taco's [[Bibliography|t-bib]] module. If you want to install [http://modules.contextgarden.net/ a new module], say Wolfgang's [[Letter|t-letter]] module, you can use<br />
first-setup.sh --modules="t-letter"<br />
<br />
If you want to install more than one extra module, you can separate them by commas. So, to install the t-letter and t-mathsets module, do<br />
sh ./first-setup.sh --modules="t-letter,t-mathsets"<br />
<br />
If you want to install all extra modules at once, do<br />
sh ./first-setup.sh --modules=all<br />
<br />
= Reverting to an older installation =<br />
<br />
If, for some reason, you want to revert to an older installation, you can do that by<br />
<br />
sh ./first-setup.sh --context=date<br />
<br />
where <code>date</code> is the date of one of the stable releases of ConTeXt. The complete list of old releases that are available is [http://minimals.contextgarden.net/current/context/ here].<br />
<br />
<br />
= Moving the installation tree around = <br />
<br />
According to this post, http://archive.contextgarden.net/message/20101129.144331.d721372f.en.html it's safe to move the installation tree across directory or machines (say you don't have broadband access). You just have to clean and regenerate the cache (./tex/texmf-cache/luatex-cache) with <br />
mtxrun --generate<br />
<br />
= Notes =<br />
<references/><br />
<br />
{{Getting started navbox}}<br />
[[Category:Installation]]<br />
[[Category:Standalone]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Math&diff=23039Math2016-02-19T18:01:24Z<p>Braslau: The wiki may describe mkii and need revision; also, newmat module is not core functionality.</p>
<hr />
<div>< [[Main Page]] | [[Math with newmat]] | [[MathML]] | [[Math_structures]]><br />
<br />
== Introduction ==<br />
<br />
TeX was designed for ease of typesetting books that contained mathematics. As ConTeXt is built on top of TeX, it inherits all those features. In addition to these, ConTeXt adds lot of macros to make the typesetting of mathematics easier.<br />
<br />
There are '''two''' kinds of '''math modes''' --- '''inline math and display math'''. Mathematical expressions that are written with the running text are called inline math; while mathematical expressions that break the flow of the text (such as formulas or equations) are called display math. TeX takes care of proper spacing around expressions and provides macros to typeset most mathematical constructs.<br />
Complicated expressions can be built by working in steps---break down the expression into sub-expressions, build the sub-expressions and then combine them to get the complicated expression.<br />
<br />
The basics of typesetting math in ConTeXt is explained here.<br />
<br />
=== Display math mode ===<br />
Type<br />
<br />
<texcode><br />
\startformula ... \stopformula<br />
</texcode><br />
<br />
to get display math mode.<br />
<br />
=== Inline math mode ===<br />
There are four equivalent commands to get inline math mode:<br />
<br />
<texcode><br />
$ ... $ % TeX style.<br />
\m{ ... } <br />
\math{ ... } <br />
\mathematics{ ... }<br />
</texcode><br />
<br />
=== Note to Plain TeX Users ===<br />
ConTeXt is plain TeX compatible. So, if you have any old document written in plain TeX, it will work with ConTeXt. This does not mean that you will get pixel by pixel identical output with ConTeXt. For inline math, everything that you learnt for plain TeX is also true for ConTeXt. However, display math is significantly different. '''Do not use <code>$$ .... $$</code>''' to write display math formulas in ConTeXt, since you will not get the correct spacing around the formulas. Instead use <br />
<br />
<texcode><br />
\startformula ... \stopformula<br />
</texcode><br />
<br />
See [[Math/Display]] for more details on how to use display math in ConTeXt.<br />
<br />
=== Note to AMSTeX/LaTeX Users ===<br />
ConTeXt offers almost all the features that are present in AMSTeX and LaTeX. However, ConTeXt syntax is different. See this [http://dl.contextgarden.net/myway/context-latex-math.pdf My Way] for how to 'translate' from amsmath syntax to ConTeXt syntax. [[LaTeX_Math_in_ConTeXt]] gives some brief ideas on how to get the LaTeX syntax to run in ConTeXt.<br />
<br />
== The details ==<br />
<br />
=== Math symbols ===<br />
* [[Math/basic | How to input math]] (binary relations, greek letters, subscripts and superscripts)<br />
* Accents<br />
* underbrace, overbrace<br />
* [[Math/fractions | Fractions, Binomials, genfrac, continued fractions.]]<br />
* Delimiters (big, bigg, left, middle, right)<br />
* Integrals and Sums<br />
* ([[Math/functions|Log like]]) functions<br />
* dots<br />
* [[Multiline_equations#Cases|Cases]], matrices, bordermatrix<br />
* Arrows (see [http://dl.contextgarden.net/myway/matharrows.pdf Math Arrows])<br />
* [[Vectors]]<br />
* [[Product integral]]<br />
<br />
=== Display Math ===<br />
* [[Math/Display | Formula, formula number]]<br />
* [[Multiline equations]] (see [http://dl.contextgarden.net/myway/mathalign.pdf Using \mathalign and friends])<br />
* Math sub-alignment<br />
* [[Math spacing]]<br />
* Discussion: [[User_talk:Zenlima | summary of formula numbering problems]] (comment: unverified)<br />
<br />
==Math Fonts==<br />
<br />
''See [[Math fonts]]'' for the main article about this subject.<br />
<br />
== Other Methods ==<br />
* There are two different math modules on [http://dante.ctan.org/tex-archive/macros/context/contrib/maths/ CTAN], [[Math with nath|nath]] and [[Math with amsl|amsl]]. And there's a [[Math with newmat|new math]] module in the distribution.<br />
* Context now has inbuilt support for [[Multiline equations]]<br />
* It is also possible to use most [[LaTeX Math in ConTeXt|LaTeX equations in ConTeXt]] with a relatively small set of supporting definitions.<br />
* The "native" ConTeXt way of math is [[MathML]], an application of [[XML]] - rather verbose but mighty.<br />
<br />
==Science==<br />
* Esp. for physics there’s the [[Units]] module.<br />
* Additions to [[MathML]] are PhysML and ChemML.<br />
* [[Chemistry]]<br />
* There's a module for chemical structure formulae: [[Chemistry|PPCHTeX]] (works also with LaTeX).<br />
<br />
==Number Formatting==<br />
There's a special command, <cmd>digits</cmd>, with its own manual about formatting numbers, see [http://www.pragma-ade.com/general/magazines/mag-0003.pdf Pasting digits together]<br />
<br />
==Evaluating expressions in ConTeXt==<br />
(i.e. ''doing'' math)<br />
* See also [[Expressions]].<br />
<br />
[[Category:Math]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Math&diff=23038Math2016-02-19T17:54:44Z<p>Braslau: Added a link to a discussion page on formula numbering problems (previously appeared as a RED tag).</p>
<hr />
<div>< [[Main Page]] | [[Math with newmat]] | [[MathML]] | [[Math_structures]]><br />
<br />
== Introduction ==<br />
<br />
TeX was designed for ease of typesetting books that contained mathematics. As ConTeXt is built on top of TeX, it inherits all those features. In addition to these, ConTeXt adds lot of macros to make the typesetting of mathematics easier.<br />
<br />
There are '''two''' kinds of '''math modes''' --- '''inline math and display math'''. Mathematical expressions that are written with the running text are called inline math; while mathematical expressions that break the flow of the text (such as formulas or equations) are called display math. TeX takes care of proper spacing around expressions and provides macros to typeset most mathematical constructs.<br />
Complicated expressions can be built by working in steps---break down the expression into sub-expressions, build the sub-expressions and then combine them to get the complicated expression.<br />
<br />
The basics of typesetting math in ConTeXt is explained here.<br />
<br />
=== Display math mode ===<br />
Type<br />
<br />
<texcode><br />
\startformula ... \stopformula<br />
</texcode><br />
<br />
to get display math mode.<br />
<br />
=== Inline math mode ===<br />
There are four equivalent commands to get inline math mode:<br />
<br />
<texcode><br />
$ ... $ % TeX style.<br />
\m{ ... } <br />
\math{ ... } <br />
\mathematics{ ... }<br />
</texcode><br />
<br />
=== Note to Plain TeX Users ===<br />
ConTeXt is plain TeX compatible. So, if you have any old document written in plain TeX, it will work with ConTeXt. This does not mean that you will get pixel by pixel identical output with ConTeXt. For inline math, everything that you learnt for plain TeX is also true for ConTeXt. However, display math is significantly different. '''Do not use <code>$$ .... $$</code>''' to write display math formulas in ConTeXt, since you will not get the correct spacing around the formulas. Instead use <br />
<br />
<texcode><br />
\startformula ... \stopformula<br />
</texcode><br />
<br />
See [[Math/Display]] for more details on how to use display math in ConTeXt.<br />
<br />
=== Note to AMSTeX/LaTeX Users ===<br />
ConTeXt offers almost all the features that are present in AMSTeX and LaTeX. However, ConTeXt syntax is different. See this [http://dl.contextgarden.net/myway/context-latex-math.pdf My Way] for how to 'translate' from amsmath syntax to ConTeXt syntax. [[LaTeX_Math_in_ConTeXt]] gives some brief ideas on how to get the LaTeX syntax to run in ConTeXt.<br />
<br />
== The details ==<br />
<br />
=== Math symbols ===<br />
* [[Math/basic | How to input math]] (binary relations, greek letters, subscripts and superscripts)<br />
* Accents<br />
* underbrace, overbrace<br />
* [[Math/fractions | Fractions, Binomials, genfrac, continued fractions.]]<br />
* Delimiters (big, bigg, left, middle, right)<br />
* Integrals and Sums<br />
* ([[Math/functions|Log like]]) functions<br />
* dots<br />
* [[Multiline_equations#Cases|Cases]], matrices, bordermatrix<br />
* Arrows (see [http://dl.contextgarden.net/myway/matharrows.pdf Math Arrows])<br />
* [[Vectors]]<br />
* [[Product integral]]<br />
<br />
=== Display Math ===<br />
* [[Math/Display | Formula, formula number]]<br />
* [[Multiline equations]] (see [http://dl.contextgarden.net/myway/mathalign.pdf Using \mathalign and friends])<br />
* Math sub-alignment<br />
* [[Math spacing]]<br />
* Discussion: [[User_talk:Zenlima | summary of formula numbering problems]]<br />
<br />
==Math Fonts==<br />
<br />
''See [[Math fonts]]'' for the main article about this subject.<br />
<br />
== Other Methods ==<br />
* There are two different math modules on [http://dante.ctan.org/tex-archive/macros/context/contrib/maths/ CTAN], [[Math with nath|nath]] and [[Math with amsl|amsl]]. And there's a [[Math with newmat|new math]] module in the distribution.<br />
* Context now has inbuilt support for [[Multiline equations]]<br />
* It is also possible to use most [[LaTeX Math in ConTeXt|LaTeX equations in ConTeXt]] with a relatively small set of supporting definitions.<br />
* The "native" ConTeXt way of math is [[MathML]], an application of [[XML]] - rather verbose but mighty.<br />
<br />
==Science==<br />
* Esp. for physics there’s the [[Units]] module.<br />
* Additions to [[MathML]] are PhysML and ChemML.<br />
* [[Chemistry]]<br />
* There's a module for chemical structure formulae: [[Chemistry|PPCHTeX]] (works also with LaTeX).<br />
<br />
==Number Formatting==<br />
There's a special command, <cmd>digits</cmd>, with its own manual about formatting numbers, see [http://www.pragma-ade.com/general/magazines/mag-0003.pdf Pasting digits together]<br />
<br />
==Evaluating expressions in ConTeXt==<br />
(i.e. ''doing'' math)<br />
* See also [[Expressions]].<br />
<br />
[[Category:Math]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Math/Display&diff=23037Math/Display2016-02-19T17:33:17Z<p>Braslau: removed RED flagged text.</p>
<hr />
<div>< [[Math]] ><br />
<br />
= Display Math =<br />
<br />
Display math is enclosed in a {{cmd|startformula}} / {{cmd|stopformula}} pair. Thus <br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
= Numbering Formulae =<br />
<br />
ConTeXt provides an easy way to number the display maths equations. Simply, put {{cmd|placeformula}} before {{cmd|startformula}} and you will get numbered equations. Thus,<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
The {{cmd|placeformula}} command is optional, and produces the equation number; leaving it off produces an unnumbered equation.<br />
<br />
== Changing format of numbers ==<br />
You can use {{cmd|setupformulas}} to change the format of numbers. For example to get bold numbers inside square brackets use<br />
<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
</texcode><br />
</td><br />
<br />
<td>which gives<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
To get equations also numbered by section, add the command:<br />
<texcode><br />
\setupnumber[formula][way=bysection] <br />
</texcode><br />
To the start of your document.<br />
<br />
To get alphabets instead of numbers, use<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[conversion=Character]<br />
</texcode><br />
</td><br />
<td>which gives<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\setupformulas[conversion=Character]<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
== Changing Formula alignment ==<br />
<br />
Normally a formula is centered, but in case you want to align it left or right, you can set up formulas to behave<br />
that way. Normally a formula will adapt its left indentation to the environment:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
This is a bit of text for purpose of example.\epar<br />
\startitemize<br />
\item This is some other example text.\epar<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\item This is yet other example text.\epar<br />
\stopitemize<br />
This is a bit more text for other purpose of example.\epar<br />
</context><br />
<br />
In the next examples we explicitly align formulas to the left ({{cmd|raggedleft}}), center and right ({{cmd|raggedright}}):<br />
<br />
<context source="yes" text="Or in print:"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=left]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
With formula numbers the code is:<br />
<br />
<context source="yes" text="And the formulas look like:"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=left]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
When tracing is turned on ({{cmd|tracemathtrue}}) you can visualize the bounding box of the formula,<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=left]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
As you can see, the dimensions are the natural ones, but if needed you can force a normalized line:<br />
<br />
<context source="yes" text="This time we get a more spacy result. [Ed. Note: For this example equation, there appears to be no visible change.]"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=middle,strut=yes]<br />
\tracemathtrue<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
We will now show a couple of more settings and combinations of settings. In centered formulas, the number takes no space<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=middle]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
You can influence the placement of the whole box with the parameters <tt>leftmargin</tt> and <tt>rightmargin</tt>.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
Some example text, again, to show where the right and left margins of the text block are.<br />
\tracemathtrue<br />
\setupformulas[align=right,leftmargin=3em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
<br />
\setupformulas[align=left,rightmargin=1em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
You can also inherit the margin from the environment.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
Some example text, again, to show where the right and left margins of the text block are.<br />
\tracemathtrue<br />
\setupformulas[align=right,margin=standard]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
The distance between the formula and the number is only applied when the formula is left or right aligned.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=left,distance=2em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
= Referencing formulae =<br />
Equations can be referred to by simply adding a label to {{cmd|placeformula}} and using {{cmd|ref}} to create the reference:<br />
<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (and again) is given by<br />
\placeformula[formulalabel]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
And now we can refer to formula \ref[][formulalabel].<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (and again) is given by<br />
\placeformula[formulalabel]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
<br />
And now we can refer to formula \ref[][formulalabel].<br />
</context><br />
</td></tr></table><br />
<br />
Note, that {{cmd|ref}} expects two arguments, therefore you need the brackets twice.<br />
<br />
By default, only the formula number appears as a reference. This can be changed by using {{cmd|definereferenceformat}}. For example, to create a command <code>\eqref</code> which shows the formula number in brackets, use<br />
<texcode><br />
\definereferenceformat[eqref][left=(,right=)]<br />
</texcode><br />
See [[References]] for more examples of {{cmd|definereferenceformat}}.<br />
<br />
=Sub-Formula Numbering=<br />
<br />
== Automatic Sub-Formula Numbering ==<br />
<br />
To use subformula numbering, you can use {{cmd|startsubformulas}}/{{cmd|stopsubformulas}}. For example<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\startsubformulas[eq:1]<br />
\placeformula[eq:first]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placeformula[eq:second]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
\stopsubformulas<br />
Formula (\in[eq:1]) states <br />
the Pythagora's Theorem twice,<br />
once in (\in[eq:first]) and <br />
again in (\in[eq:second]).<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
Examples:<br />
\startsubformulas[eq:1]<br />
\placeformula[eq:first]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placeformula[eq:second]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
\stopsubformulas<br />
Formula (\in[eq:1]) states the Pythagora's Theorem twice, once in (\in[eq:first]) and again in (\in[eq:second]).<br />
</context><br />
</td></tr></table><br />
<br />
<br />
== The Manual Method ==<br />
<br />
Sometimes, you need more fine grained control over numbering of subformulas. In that case one can make use of the optional agument of {{cmd|placeformula}} command and the related {{cmd|placesubformula}} commands which can be used to produce sub-formula numbering. For example:<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
What's going on here is simpler than it might appear at first glance. Both {{cmd|placeformula}} and {{cmd|placesubformula}} produce equation numbers with the optional tag added at the end; the sole difference is that the former increments the equation number first, while the latter does not (and thus can be used for the second and subsequent formulas that use the same formula number but presumably have different tags).<br />
<br />
This is sufficient for cases where the standard ConTeXt equation numbers suffice, and where only one equation number is needed per formula. However, there are many cases where this is insufficient, and {{cmd|placeformula}} defines {{cmd|formulanumber}} and {{cmd|subformulanumber}} commands, which provide hooks to allow the use of ConTeXt-managed formula numbers with plain TeX equation numbering. These, when used within a formula, simply return the formula number in properly formatted form, as can be seen in this simple example with plain TeX's {{cmd|eqno}}. Note that the optional tag is inherited from {{cmd|placeformula}}.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
In order for this to work properly, we need to turn off ConTeXt's automatic formula number placement; thus the {{cmd|let}} command to empty {{cmd|doplaceformulanumber}}, which must be placed <em>after</em> the start of the formula. In many practical examples, however, this is not necessary; ConTeXt redefines {{cmd|displaylines}} and {{cmd|eqalignno}} to do this automatically.<br />
<br />
For more control over sub-formula numbering, {{cmd|formulanumber}} and {{cmd|subformulanumber}} have an optional argument parallel to that of {{cmd|placeformula}}, as demonstrated in this use of plain TeX's {{cmd|eqalignno}}, which places multiple equation numbers within one formula.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
\placeformula<br />
\startformula<br />
\eqalignno{<br />
c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
c &= \left(a^2 + b^2\right)^{\vfrac{1}{2}} &\subformulanumber{b}\cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{c} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\placeformula<br />
\startformula<br />
\eqalignno{<br />
c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
c &= \left(a^2 + b^2\right)^{\vfrac{1}{2}} &\subformulanumber{b}\cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{c} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
Note that both {{cmd|formulanumber}} and {{cmd|subformulanumber}} can be used within the same formula, and the formula number is incremented as expected. Also, if an optional argument is specified in both {{cmd|placefigure}} and {{cmd|formulanumber}}, the latter takes precedence.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples for left-located equation number:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
More examples for left-located equation no.:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
-- 23:46, 15 Aug 2005 (CEST) Prinse Wang<br />
<br />
=List of Formulas=<br />
<br />
You can have a list of the formulas contained in a document by using {{cmd|placenamedformula}} instead of {{cmd|placeformula}}. Only the formulas written with {{cmd|placenamedformula}} are not put in the list, so that you can control precisely the content of the list.<br />
<br />
{{cmd|placenamedformula}} takes as first parameter the name of the formula put in the list. The other {{cmd|placeformula}} features are still available. The list can be formatted like any other list.<br />
<br />
Example:<br />
<texcode><br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</texcode><br />
<br />
Gives:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=13cm]<br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</context><br />
<br />
= Shaded background for part of a displayed equation =<br />
(see also [[Framed]])<br />
<br />
To highlight part of a formula, you can give it a gray background using {{cmd|mframed}}: the following is the code you can use in mkii (see below what one has to do in mkiv):<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setupcolors[state=start]<br />
\def\graymath{\mframed[frame=off,<br />
background=color,<br />
backgroundcolor=gray,<br />
backgroundoffset=3pt]}<br />
<br />
\startformula<br />
\ln (1+x) =\, \graymath{x - {x^2\over2}} \,+ {x^3\over3}-\cdots.<br />
\stopformula<br />
</context><br />
<br />
In mkiv the code is slightly different: one may define {{cmd|graymath}} directly using {{cmd|definemathframed}}<br />
<br />
<texcode><br />
\setuppapersize[A5]<br />
\definemathframed[graymath]<br />
[<br />
frame=off,<br />
location=mathematics,<br />
background=color,<br />
backgroundcolor=lightgray,<br />
backgroundoffset=2pt<br />
]<br />
\starttext<br />
Since for $|x| < 1$ we have<br />
\startformula<br />
\log(1+x) = \graymath{x- \displaystyle{x^2\over2}} + {x^3 \over 3} + \cdots<br />
\stopformula<br />
we may write $\log(1+x) = x + O(x^2)$.<br />
\stoptext<br />
</texcode><br />
<br />
The result is shown below (possibly the framed part of the formula is not aligned correctly with the remainder of the formula because the mkiv engine on Context Garden is not up to date…).<br />
<br />
<context mode=mkiv><br />
\setuppapersize[A5]<br />
\definemathframed[graymath]<br />
[<br />
frame=off,<br />
location=mathematics,<br />
background=color,<br />
backgroundcolor=lightgray,<br />
backgroundoffset=2pt<br />
]<br />
<br />
Since for $|x| < 1$ we have<br />
\startformula<br />
\log(1+x) = \graymath{x- \displaystyle{x^2\over2}} + {x^3 \over 3} + \cdots<br />
\stopformula<br />
we may write $\log(1+x) = x + O(x^2)$.<br />
</context></div>Braslauhttps://wiki.contextgarden.net/index.php?title=Math/Display&diff=23036Math/Display2016-02-19T17:31:37Z<p>Braslau: Undo revision 23034 by Braslau (talk)</p>
<hr />
<div>< [[Math]]| ><br />
<br />
<br />
<div style="border: 3px solid red; background: #ffaaaa; padding: 0.4em;"><br />
<div style="fontsize: 1.3em; fontweight: bold">Warning!</div><br />
If you consider using ConTeXt for a paper with a proper formula numbering please wait until it is implemented in mkiv. At the moment only a very limited formula numbering is possilbe:<br />
* number formula(s) with a plain number<br />
* number formula(s) with a subnumber<br />
Not possible is at the moment:<br />
* Table of formulas<br />
* Named subformulas<br />
* Mixure of formulas and subformulas in one block<br />
* Reference on a (sub-)formula without having it listed in the Table of formulas<br />
For more details and actual state see mailing list and [http://wiki.contextgarden.net/User_talk:Zenlima Summary of formula numbering problem].<br />
</div><br />
<br />
<br />
= Display Math =<br />
<br />
Display math is enclosed in a {{cmd|startformula}} / {{cmd|stopformula}} pair. Thus <br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
= Numbering Formulae =<br />
<br />
ConTeXt provides an easy way to number the display maths equations. Simply, put {{cmd|placeformula}} before {{cmd|startformula}} and you will get numbered equations. Thus,<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
The {{cmd|placeformula}} command is optional, and produces the equation number; leaving it off produces an unnumbered equation.<br />
<br />
== Changing format of numbers ==<br />
You can use {{cmd|setupformulas}} to change the format of numbers. For example to get bold numbers inside square brackets use<br />
<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
</texcode><br />
</td><br />
<br />
<td>which gives<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
To get equations also numbered by section, add the command:<br />
<texcode><br />
\setupnumber[formula][way=bysection] <br />
</texcode><br />
To the start of your document.<br />
<br />
To get alphabets instead of numbers, use<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[conversion=Character]<br />
</texcode><br />
</td><br />
<td>which gives<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\setupformulas[conversion=Character]<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
== Changing Formula alignment ==<br />
<br />
Normally a formula is centered, but in case you want to align it left or right, you can set up formulas to behave<br />
that way. Normally a formula will adapt its left indentation to the environment:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
This is a bit of text for purpose of example.\epar<br />
\startitemize<br />
\item This is some other example text.\epar<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\item This is yet other example text.\epar<br />
\stopitemize<br />
This is a bit more text for other purpose of example.\epar<br />
</context><br />
<br />
In the next examples we explicitly align formulas to the left ({{cmd|raggedleft}}), center and right ({{cmd|raggedright}}):<br />
<br />
<context source="yes" text="Or in print:"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=left]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
With formula numbers the code is:<br />
<br />
<context source="yes" text="And the formulas look like:"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=left]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
When tracing is turned on ({{cmd|tracemathtrue}}) you can visualize the bounding box of the formula,<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=left]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
As you can see, the dimensions are the natural ones, but if needed you can force a normalized line:<br />
<br />
<context source="yes" text="This time we get a more spacy result. [Ed. Note: For this example equation, there appears to be no visible change.]"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=middle,strut=yes]<br />
\tracemathtrue<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
We will now show a couple of more settings and combinations of settings. In centered formulas, the number takes no space<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=middle]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
You can influence the placement of the whole box with the parameters <tt>leftmargin</tt> and <tt>rightmargin</tt>.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
Some example text, again, to show where the right and left margins of the text block are.<br />
\tracemathtrue<br />
\setupformulas[align=right,leftmargin=3em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
<br />
\setupformulas[align=left,rightmargin=1em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
You can also inherit the margin from the environment.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
Some example text, again, to show where the right and left margins of the text block are.<br />
\tracemathtrue<br />
\setupformulas[align=right,margin=standard]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
The distance between the formula and the number is only applied when the formula is left or right aligned.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=left,distance=2em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
= Referencing formulae =<br />
Equations can be referred to by simply adding a label to {{cmd|placeformula}} and using {{cmd|ref}} to create the reference:<br />
<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (and again) is given by<br />
\placeformula[formulalabel]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
And now we can refer to formula \ref[][formulalabel].<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (and again) is given by<br />
\placeformula[formulalabel]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
<br />
And now we can refer to formula \ref[][formulalabel].<br />
</context><br />
</td></tr></table><br />
<br />
Note, that {{cmd|ref}} expects two arguments, therefore you need the brackets twice.<br />
<br />
By default, only the formula number appears as a reference. This can be changed by using {{cmd|definereferenceformat}}. For example, to create a command <code>\eqref</code> which shows the formula number in brackets, use<br />
<texcode><br />
\definereferenceformat[eqref][left=(,right=)]<br />
</texcode><br />
See [[References]] for more examples of {{cmd|definereferenceformat}}.<br />
<br />
=Sub-Formula Numbering=<br />
<br />
== Automatic Sub-Formula Numbering ==<br />
<br />
To use subformula numbering, you can use {{cmd|startsubformulas}}/{{cmd|stopsubformulas}}. For example<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\startsubformulas[eq:1]<br />
\placeformula[eq:first]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placeformula[eq:second]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
\stopsubformulas<br />
Formula (\in[eq:1]) states <br />
the Pythagora's Theorem twice,<br />
once in (\in[eq:first]) and <br />
again in (\in[eq:second]).<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
Examples:<br />
\startsubformulas[eq:1]<br />
\placeformula[eq:first]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placeformula[eq:second]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
\stopsubformulas<br />
Formula (\in[eq:1]) states the Pythagora's Theorem twice, once in (\in[eq:first]) and again in (\in[eq:second]).<br />
</context><br />
</td></tr></table><br />
<br />
<br />
== The Manual Method ==<br />
<br />
Sometimes, you need more fine grained control over numbering of subformulas. In that case one can make use of the optional agument of {{cmd|placeformula}} command and the related {{cmd|placesubformula}} commands which can be used to produce sub-formula numbering. For example:<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
What's going on here is simpler than it might appear at first glance. Both {{cmd|placeformula}} and {{cmd|placesubformula}} produce equation numbers with the optional tag added at the end; the sole difference is that the former increments the equation number first, while the latter does not (and thus can be used for the second and subsequent formulas that use the same formula number but presumably have different tags).<br />
<br />
This is sufficient for cases where the standard ConTeXt equation numbers suffice, and where only one equation number is needed per formula. However, there are many cases where this is insufficient, and {{cmd|placeformula}} defines {{cmd|formulanumber}} and {{cmd|subformulanumber}} commands, which provide hooks to allow the use of ConTeXt-managed formula numbers with plain TeX equation numbering. These, when used within a formula, simply return the formula number in properly formatted form, as can be seen in this simple example with plain TeX's {{cmd|eqno}}. Note that the optional tag is inherited from {{cmd|placeformula}}.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
In order for this to work properly, we need to turn off ConTeXt's automatic formula number placement; thus the {{cmd|let}} command to empty {{cmd|doplaceformulanumber}}, which must be placed <em>after</em> the start of the formula. In many practical examples, however, this is not necessary; ConTeXt redefines {{cmd|displaylines}} and {{cmd|eqalignno}} to do this automatically.<br />
<br />
For more control over sub-formula numbering, {{cmd|formulanumber}} and {{cmd|subformulanumber}} have an optional argument parallel to that of {{cmd|placeformula}}, as demonstrated in this use of plain TeX's {{cmd|eqalignno}}, which places multiple equation numbers within one formula.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
\placeformula<br />
\startformula<br />
\eqalignno{<br />
c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
c &= \left(a^2 + b^2\right)^{\vfrac{1}{2}} &\subformulanumber{b}\cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{c} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\placeformula<br />
\startformula<br />
\eqalignno{<br />
c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
c &= \left(a^2 + b^2\right)^{\vfrac{1}{2}} &\subformulanumber{b}\cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{c} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
Note that both {{cmd|formulanumber}} and {{cmd|subformulanumber}} can be used within the same formula, and the formula number is incremented as expected. Also, if an optional argument is specified in both {{cmd|placefigure}} and {{cmd|formulanumber}}, the latter takes precedence.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples for left-located equation number:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
More examples for left-located equation no.:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
-- 23:46, 15 Aug 2005 (CEST) Prinse Wang<br />
<br />
=List of Formulas=<br />
<br />
You can have a list of the formulas contained in a document by using {{cmd|placenamedformula}} instead of {{cmd|placeformula}}. Only the formulas written with {{cmd|placenamedformula}} are not put in the list, so that you can control precisely the content of the list.<br />
<br />
{{cmd|placenamedformula}} takes as first parameter the name of the formula put in the list. The other {{cmd|placeformula}} features are still available. The list can be formatted like any other list.<br />
<br />
Example:<br />
<texcode><br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</texcode><br />
<br />
Gives:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=13cm]<br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</context><br />
<br />
= Shaded background for part of a displayed equation =<br />
(see also [[Framed]])<br />
<br />
To highlight part of a formula, you can give it a gray background using {{cmd|mframed}}: the following is the code you can use in mkii (see below what one has to do in mkiv):<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setupcolors[state=start]<br />
\def\graymath{\mframed[frame=off,<br />
background=color,<br />
backgroundcolor=gray,<br />
backgroundoffset=3pt]}<br />
<br />
\startformula<br />
\ln (1+x) =\, \graymath{x - {x^2\over2}} \,+ {x^3\over3}-\cdots.<br />
\stopformula<br />
</context><br />
<br />
In mkiv the code is slightly different: one may define {{cmd|graymath}} directly using {{cmd|definemathframed}}<br />
<br />
<texcode><br />
\setuppapersize[A5]<br />
\definemathframed[graymath]<br />
[<br />
frame=off,<br />
location=mathematics,<br />
background=color,<br />
backgroundcolor=lightgray,<br />
backgroundoffset=2pt<br />
]<br />
\starttext<br />
Since for $|x| < 1$ we have<br />
\startformula<br />
\log(1+x) = \graymath{x- \displaystyle{x^2\over2}} + {x^3 \over 3} + \cdots<br />
\stopformula<br />
we may write $\log(1+x) = x + O(x^2)$.<br />
\stoptext<br />
</texcode><br />
<br />
The result is shown below (possibly the framed part of the formula is not aligned correctly with the remainder of the formula because the mkiv engine on Context Garden is not up to date…).<br />
<br />
<context mode=mkiv><br />
\setuppapersize[A5]<br />
\definemathframed[graymath]<br />
[<br />
frame=off,<br />
location=mathematics,<br />
background=color,<br />
backgroundcolor=lightgray,<br />
backgroundoffset=2pt<br />
]<br />
<br />
Since for $|x| < 1$ we have<br />
\startformula<br />
\log(1+x) = \graymath{x- \displaystyle{x^2\over2}} + {x^3 \over 3} + \cdots<br />
\stopformula<br />
we may write $\log(1+x) = x + O(x^2)$.<br />
</context></div>Braslauhttps://wiki.contextgarden.net/index.php?title=Math/Display&diff=23035Math/Display2016-02-19T17:30:51Z<p>Braslau: </p>
<hr />
<div>< [[Math]]| ><br />
<br />
= Display Math =<br />
<br />
Display math is enclosed in a {{cmd|startformula}} / {{cmd|stopformula}} pair. Thus <br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
= Numbering Formulae =<br />
<br />
ConTeXt provides an easy way to number the display maths equations. Simply, put {{cmd|placeformula}} before {{cmd|startformula}} and you will get numbered equations. Thus,<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
The {{cmd|placeformula}} command is optional, and produces the equation number; leaving it off produces an unnumbered equation.<br />
<br />
== Changing format of numbers ==<br />
You can use {{cmd|setupformulas}} to change the format of numbers. For example to get bold numbers inside square brackets use<br />
<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
</texcode><br />
</td><br />
<br />
<td>which gives<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
To get equations also numbered by section, add the command:<br />
<texcode><br />
\setupnumber[formula][way=bysection] <br />
</texcode><br />
To the start of your document.<br />
<br />
To get alphabets instead of numbers, use<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[conversion=Character]<br />
</texcode><br />
</td><br />
<td>which gives<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\setupformulas[conversion=Character]<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
== Changing Formula alignment ==<br />
<br />
Normally a formula is centered, but in case you want to align it left or right, you can set up formulas to behave<br />
that way. Normally a formula will adapt its left indentation to the environment:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
This is a bit of text for purpose of example.\epar<br />
\startitemize<br />
\item This is some other example text.\epar<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\item This is yet other example text.\epar<br />
\stopitemize<br />
This is a bit more text for other purpose of example.\epar<br />
</context><br />
<br />
In the next examples we explicitly align formulas to the left ({{cmd|raggedleft}}), center and right ({{cmd|raggedright}}):<br />
<br />
<context source="yes" text="Or in print:"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=left]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
With formula numbers the code is:<br />
<br />
<context source="yes" text="And the formulas look like:"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=left]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
When tracing is turned on ({{cmd|tracemathtrue}}) you can visualize the bounding box of the formula,<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=left]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
As you can see, the dimensions are the natural ones, but if needed you can force a normalized line:<br />
<br />
<context source="yes" text="This time we get a more spacy result. [Ed. Note: For this example equation, there appears to be no visible change.]"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=middle,strut=yes]<br />
\tracemathtrue<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
We will now show a couple of more settings and combinations of settings. In centered formulas, the number takes no space<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=middle]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
You can influence the placement of the whole box with the parameters <tt>leftmargin</tt> and <tt>rightmargin</tt>.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
Some example text, again, to show where the right and left margins of the text block are.<br />
\tracemathtrue<br />
\setupformulas[align=right,leftmargin=3em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
<br />
\setupformulas[align=left,rightmargin=1em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
You can also inherit the margin from the environment.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
Some example text, again, to show where the right and left margins of the text block are.<br />
\tracemathtrue<br />
\setupformulas[align=right,margin=standard]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
The distance between the formula and the number is only applied when the formula is left or right aligned.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=left,distance=2em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
= Referencing formulae =<br />
Equations can be referred to by simply adding a label to {{cmd|placeformula}} and using {{cmd|ref}} to create the reference:<br />
<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (and again) is given by<br />
\placeformula[formulalabel]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
And now we can refer to formula \ref[][formulalabel].<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (and again) is given by<br />
\placeformula[formulalabel]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
<br />
And now we can refer to formula \ref[][formulalabel].<br />
</context><br />
</td></tr></table><br />
<br />
Note, that {{cmd|ref}} expects two arguments, therefore you need the brackets twice.<br />
<br />
By default, only the formula number appears as a reference. This can be changed by using {{cmd|definereferenceformat}}. For example, to create a command <code>\eqref</code> which shows the formula number in brackets, use<br />
<texcode><br />
\definereferenceformat[eqref][left=(,right=)]<br />
</texcode><br />
See [[References]] for more examples of {{cmd|definereferenceformat}}.<br />
<br />
=Sub-Formula Numbering=<br />
<br />
== Automatic Sub-Formula Numbering ==<br />
<br />
To use subformula numbering, you can use {{cmd|startsubformulas}}/{{cmd|stopsubformulas}}. For example<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\startsubformulas[eq:1]<br />
\placeformula[eq:first]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placeformula[eq:second]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
\stopsubformulas<br />
Formula (\in[eq:1]) states <br />
the Pythagora's Theorem twice,<br />
once in (\in[eq:first]) and <br />
again in (\in[eq:second]).<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
Examples:<br />
\startsubformulas[eq:1]<br />
\placeformula[eq:first]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placeformula[eq:second]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
\stopsubformulas<br />
Formula (\in[eq:1]) states the Pythagora's Theorem twice, once in (\in[eq:first]) and again in (\in[eq:second]).<br />
</context><br />
</td></tr></table><br />
<br />
<br />
== The Manual Method ==<br />
<br />
Sometimes, you need more fine grained control over numbering of subformulas. In that case one can make use of the optional agument of {{cmd|placeformula}} command and the related {{cmd|placesubformula}} commands which can be used to produce sub-formula numbering. For example:<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
What's going on here is simpler than it might appear at first glance. Both {{cmd|placeformula}} and {{cmd|placesubformula}} produce equation numbers with the optional tag added at the end; the sole difference is that the former increments the equation number first, while the latter does not (and thus can be used for the second and subsequent formulas that use the same formula number but presumably have different tags).<br />
<br />
This is sufficient for cases where the standard ConTeXt equation numbers suffice, and where only one equation number is needed per formula. However, there are many cases where this is insufficient, and {{cmd|placeformula}} defines {{cmd|formulanumber}} and {{cmd|subformulanumber}} commands, which provide hooks to allow the use of ConTeXt-managed formula numbers with plain TeX equation numbering. These, when used within a formula, simply return the formula number in properly formatted form, as can be seen in this simple example with plain TeX's {{cmd|eqno}}. Note that the optional tag is inherited from {{cmd|placeformula}}.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
In order for this to work properly, we need to turn off ConTeXt's automatic formula number placement; thus the {{cmd|let}} command to empty {{cmd|doplaceformulanumber}}, which must be placed <em>after</em> the start of the formula. In many practical examples, however, this is not necessary; ConTeXt redefines {{cmd|displaylines}} and {{cmd|eqalignno}} to do this automatically.<br />
<br />
For more control over sub-formula numbering, {{cmd|formulanumber}} and {{cmd|subformulanumber}} have an optional argument parallel to that of {{cmd|placeformula}}, as demonstrated in this use of plain TeX's {{cmd|eqalignno}}, which places multiple equation numbers within one formula.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
\placeformula<br />
\startformula<br />
\eqalignno{<br />
c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
c &= \left(a^2 + b^2\right)^{\vfrac{1}{2}} &\subformulanumber{b}\cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{c} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\placeformula<br />
\startformula<br />
\eqalignno{<br />
c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
c &= \left(a^2 + b^2\right)^{\vfrac{1}{2}} &\subformulanumber{b}\cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{c} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
Note that both {{cmd|formulanumber}} and {{cmd|subformulanumber}} can be used within the same formula, and the formula number is incremented as expected. Also, if an optional argument is specified in both {{cmd|placefigure}} and {{cmd|formulanumber}}, the latter takes precedence.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples for left-located equation number:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
More examples for left-located equation no.:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
-- 23:46, 15 Aug 2005 (CEST) Prinse Wang<br />
<br />
=List of Formulas=<br />
<br />
You can have a list of the formulas contained in a document by using {{cmd|placenamedformula}} instead of {{cmd|placeformula}}. Only the formulas written with {{cmd|placenamedformula}} are not put in the list, so that you can control precisely the content of the list.<br />
<br />
{{cmd|placenamedformula}} takes as first parameter the name of the formula put in the list. The other {{cmd|placeformula}} features are still available. The list can be formatted like any other list.<br />
<br />
Example:<br />
<texcode><br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</texcode><br />
<br />
Gives:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=13cm]<br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</context><br />
<br />
= Shaded background for part of a displayed equation =<br />
(see also [[Framed]])<br />
<br />
To highlight part of a formula, you can give it a gray background using {{cmd|mframed}}: the following is the code you can use in mkii (see below what one has to do in mkiv):<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setupcolors[state=start]<br />
\def\graymath{\mframed[frame=off,<br />
background=color,<br />
backgroundcolor=gray,<br />
backgroundoffset=3pt]}<br />
<br />
\startformula<br />
\ln (1+x) =\, \graymath{x - {x^2\over2}} \,+ {x^3\over3}-\cdots.<br />
\stopformula<br />
</context><br />
<br />
In mkiv the code is slightly different: one may define {{cmd|graymath}} directly using {{cmd|definemathframed}}<br />
<br />
<texcode><br />
\setuppapersize[A5]<br />
\definemathframed[graymath]<br />
[<br />
frame=off,<br />
location=mathematics,<br />
background=color,<br />
backgroundcolor=lightgray,<br />
backgroundoffset=2pt<br />
]<br />
\starttext<br />
Since for $|x| < 1$ we have<br />
\startformula<br />
\log(1+x) = \graymath{x- \displaystyle{x^2\over2}} + {x^3 \over 3} + \cdots<br />
\stopformula<br />
we may write $\log(1+x) = x + O(x^2)$.<br />
\stoptext<br />
</texcode><br />
<br />
The result is shown below (possibly the framed part of the formula is not aligned correctly with the remainder of the formula because the mkiv engine on Context Garden is not up to date…).<br />
<br />
<context mode=mkiv><br />
\setuppapersize[A5]<br />
\definemathframed[graymath]<br />
[<br />
frame=off,<br />
location=mathematics,<br />
background=color,<br />
backgroundcolor=lightgray,<br />
backgroundoffset=2pt<br />
]<br />
<br />
Since for $|x| < 1$ we have<br />
\startformula<br />
\log(1+x) = \graymath{x- \displaystyle{x^2\over2}} + {x^3 \over 3} + \cdots<br />
\stopformula<br />
we may write $\log(1+x) = x + O(x^2)$.<br />
</context></div>Braslauhttps://wiki.contextgarden.net/index.php?title=Math/Display&diff=23034Math/Display2016-02-19T17:30:27Z<p>Braslau: removed RED tagged text.</p>
<hr />
<div>< [[Math]]|<br />
<br />
= Display Math =<br />
<br />
Display math is enclosed in a {{cmd|startformula}} / {{cmd|stopformula}} pair. Thus <br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
= Numbering Formulae =<br />
<br />
ConTeXt provides an easy way to number the display maths equations. Simply, put {{cmd|placeformula}} before {{cmd|startformula}} and you will get numbered equations. Thus,<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
The {{cmd|placeformula}} command is optional, and produces the equation number; leaving it off produces an unnumbered equation.<br />
<br />
== Changing format of numbers ==<br />
You can use {{cmd|setupformulas}} to change the format of numbers. For example to get bold numbers inside square brackets use<br />
<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
</texcode><br />
</td><br />
<br />
<td>which gives<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
To get equations also numbered by section, add the command:<br />
<texcode><br />
\setupnumber[formula][way=bysection] <br />
</texcode><br />
To the start of your document.<br />
<br />
To get alphabets instead of numbers, use<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[conversion=Character]<br />
</texcode><br />
</td><br />
<td>which gives<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\setupformulas[conversion=Character]<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
== Changing Formula alignment ==<br />
<br />
Normally a formula is centered, but in case you want to align it left or right, you can set up formulas to behave<br />
that way. Normally a formula will adapt its left indentation to the environment:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
This is a bit of text for purpose of example.\epar<br />
\startitemize<br />
\item This is some other example text.\epar<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\item This is yet other example text.\epar<br />
\stopitemize<br />
This is a bit more text for other purpose of example.\epar<br />
</context><br />
<br />
In the next examples we explicitly align formulas to the left ({{cmd|raggedleft}}), center and right ({{cmd|raggedright}}):<br />
<br />
<context source="yes" text="Or in print:"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=left]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
With formula numbers the code is:<br />
<br />
<context source="yes" text="And the formulas look like:"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=left]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
When tracing is turned on ({{cmd|tracemathtrue}}) you can visualize the bounding box of the formula,<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=left]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
As you can see, the dimensions are the natural ones, but if needed you can force a normalized line:<br />
<br />
<context source="yes" text="This time we get a more spacy result. [Ed. Note: For this example equation, there appears to be no visible change.]"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=middle,strut=yes]<br />
\tracemathtrue<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
We will now show a couple of more settings and combinations of settings. In centered formulas, the number takes no space<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=middle]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
You can influence the placement of the whole box with the parameters <tt>leftmargin</tt> and <tt>rightmargin</tt>.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
Some example text, again, to show where the right and left margins of the text block are.<br />
\tracemathtrue<br />
\setupformulas[align=right,leftmargin=3em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
<br />
\setupformulas[align=left,rightmargin=1em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
You can also inherit the margin from the environment.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
Some example text, again, to show where the right and left margins of the text block are.<br />
\tracemathtrue<br />
\setupformulas[align=right,margin=standard]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
The distance between the formula and the number is only applied when the formula is left or right aligned.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=left,distance=2em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
= Referencing formulae =<br />
Equations can be referred to by simply adding a label to {{cmd|placeformula}} and using {{cmd|ref}} to create the reference:<br />
<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (and again) is given by<br />
\placeformula[formulalabel]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
And now we can refer to formula \ref[][formulalabel].<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
The famous result (and again) is given by<br />
\placeformula[formulalabel]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
<br />
And now we can refer to formula \ref[][formulalabel].<br />
</context><br />
</td></tr></table><br />
<br />
Note, that {{cmd|ref}} expects two arguments, therefore you need the brackets twice.<br />
<br />
By default, only the formula number appears as a reference. This can be changed by using {{cmd|definereferenceformat}}. For example, to create a command <code>\eqref</code> which shows the formula number in brackets, use<br />
<texcode><br />
\definereferenceformat[eqref][left=(,right=)]<br />
</texcode><br />
See [[References]] for more examples of {{cmd|definereferenceformat}}.<br />
<br />
=Sub-Formula Numbering=<br />
<br />
== Automatic Sub-Formula Numbering ==<br />
<br />
To use subformula numbering, you can use {{cmd|startsubformulas}}/{{cmd|stopsubformulas}}. For example<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\startsubformulas[eq:1]<br />
\placeformula[eq:first]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placeformula[eq:second]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
\stopsubformulas<br />
Formula (\in[eq:1]) states <br />
the Pythagora's Theorem twice,<br />
once in (\in[eq:first]) and <br />
again in (\in[eq:second]).<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
Examples:<br />
\startsubformulas[eq:1]<br />
\placeformula[eq:first]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placeformula[eq:second]<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
\stopsubformulas<br />
Formula (\in[eq:1]) states the Pythagora's Theorem twice, once in (\in[eq:first]) and again in (\in[eq:second]).<br />
</context><br />
</td></tr></table><br />
<br />
<br />
== The Manual Method ==<br />
<br />
Sometimes, you need more fine grained control over numbering of subformulas. In that case one can make use of the optional agument of {{cmd|placeformula}} command and the related {{cmd|placesubformula}} commands which can be used to produce sub-formula numbering. For example:<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
What's going on here is simpler than it might appear at first glance. Both {{cmd|placeformula}} and {{cmd|placesubformula}} produce equation numbers with the optional tag added at the end; the sole difference is that the former increments the equation number first, while the latter does not (and thus can be used for the second and subsequent formulas that use the same formula number but presumably have different tags).<br />
<br />
This is sufficient for cases where the standard ConTeXt equation numbers suffice, and where only one equation number is needed per formula. However, there are many cases where this is insufficient, and {{cmd|placeformula}} defines {{cmd|formulanumber}} and {{cmd|subformulanumber}} commands, which provide hooks to allow the use of ConTeXt-managed formula numbers with plain TeX equation numbering. These, when used within a formula, simply return the formula number in properly formatted form, as can be seen in this simple example with plain TeX's {{cmd|eqno}}. Note that the optional tag is inherited from {{cmd|placeformula}}.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
In order for this to work properly, we need to turn off ConTeXt's automatic formula number placement; thus the {{cmd|let}} command to empty {{cmd|doplaceformulanumber}}, which must be placed <em>after</em> the start of the formula. In many practical examples, however, this is not necessary; ConTeXt redefines {{cmd|displaylines}} and {{cmd|eqalignno}} to do this automatically.<br />
<br />
For more control over sub-formula numbering, {{cmd|formulanumber}} and {{cmd|subformulanumber}} have an optional argument parallel to that of {{cmd|placeformula}}, as demonstrated in this use of plain TeX's {{cmd|eqalignno}}, which places multiple equation numbers within one formula.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
\placeformula<br />
\startformula<br />
\eqalignno{<br />
c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
c &= \left(a^2 + b^2\right)^{\vfrac{1}{2}} &\subformulanumber{b}\cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{c} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
\placeformula<br />
\startformula<br />
\eqalignno{<br />
c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
c &= \left(a^2 + b^2\right)^{\vfrac{1}{2}} &\subformulanumber{b}\cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{c} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
Note that both {{cmd|formulanumber}} and {{cmd|subformulanumber}} can be used within the same formula, and the formula number is incremented as expected. Also, if an optional argument is specified in both {{cmd|placefigure}} and {{cmd|formulanumber}}, the latter takes precedence.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples for left-located equation number:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=8cm]<br />
More examples for left-located equation no.:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
-- 23:46, 15 Aug 2005 (CEST) Prinse Wang<br />
<br />
=List of Formulas=<br />
<br />
You can have a list of the formulas contained in a document by using {{cmd|placenamedformula}} instead of {{cmd|placeformula}}. Only the formulas written with {{cmd|placenamedformula}} are not put in the list, so that you can control precisely the content of the list.<br />
<br />
{{cmd|placenamedformula}} takes as first parameter the name of the formula put in the list. The other {{cmd|placeformula}} features are still available. The list can be formatted like any other list.<br />
<br />
Example:<br />
<texcode><br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</texcode><br />
<br />
Gives:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setuplayout[width=13cm]<br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</context><br />
<br />
= Shaded background for part of a displayed equation =<br />
(see also [[Framed]])<br />
<br />
To highlight part of a formula, you can give it a gray background using {{cmd|mframed}}: the following is the code you can use in mkii (see below what one has to do in mkiv):<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setupcolors[state=start]<br />
\def\graymath{\mframed[frame=off,<br />
background=color,<br />
backgroundcolor=gray,<br />
backgroundoffset=3pt]}<br />
<br />
\startformula<br />
\ln (1+x) =\, \graymath{x - {x^2\over2}} \,+ {x^3\over3}-\cdots.<br />
\stopformula<br />
</context><br />
<br />
In mkiv the code is slightly different: one may define {{cmd|graymath}} directly using {{cmd|definemathframed}}<br />
<br />
<texcode><br />
\setuppapersize[A5]<br />
\definemathframed[graymath]<br />
[<br />
frame=off,<br />
location=mathematics,<br />
background=color,<br />
backgroundcolor=lightgray,<br />
backgroundoffset=2pt<br />
]<br />
\starttext<br />
Since for $|x| < 1$ we have<br />
\startformula<br />
\log(1+x) = \graymath{x- \displaystyle{x^2\over2}} + {x^3 \over 3} + \cdots<br />
\stopformula<br />
we may write $\log(1+x) = x + O(x^2)$.<br />
\stoptext<br />
</texcode><br />
<br />
The result is shown below (possibly the framed part of the formula is not aligned correctly with the remainder of the formula because the mkiv engine on Context Garden is not up to date…).<br />
<br />
<context mode=mkiv><br />
\setuppapersize[A5]<br />
\definemathframed[graymath]<br />
[<br />
frame=off,<br />
location=mathematics,<br />
background=color,<br />
backgroundcolor=lightgray,<br />
backgroundoffset=2pt<br />
]<br />
<br />
Since for $|x| < 1$ we have<br />
\startformula<br />
\log(1+x) = \graymath{x- \displaystyle{x^2\over2}} + {x^3 \over 3} + \cdots<br />
\stopformula<br />
we may write $\log(1+x) = x + O(x^2)$.<br />
</context></div>Braslauhttps://wiki.contextgarden.net/index.php?title=User_talk:Zenlima&diff=23033User talk:Zenlima2016-02-19T17:29:29Z<p>Braslau: Please do not RED tag other wiki pages.</p>
<hr />
<div><br />
<div style="border: 3px solid red; background: #ffaaaa; padding: 0.4em;"><br />
<div style="fontsize: 1.3em; fontweight: bold">Warning!</div><br />
If you consider using ConTeXt for a paper with a proper formula numbering please wait until it is implemented in mkiv. At the moment only a very limited formula numbering is possilbe:<br />
* number formula(s) with a plain number<br />
* number formula(s) with a subnumber<br />
Not possible is at the moment:<br />
* Table of formulas<br />
* Named subformulas<br />
* Mixure of formulas and subformulas in one block<br />
* Reference on a (sub-)formula without having it listed in the Table of formulas<br />
For more details and actual state see mailing list and [http://wiki.contextgarden.net/User_talk:Zenlima Summary of formula numbering problem].<br />
</div><br />
<br />
<br />
<br />
Hi, I use this page to support my question regarding context and summarize the result. Once a problem is solved I will move that text into the "normal" wiki pages.<br />
<br />
=Bug: Layoutchange inside page while duplexmode=<br />
<br />
A both sided document in which the layout has to switch inside a page works fine with text only content, but as soon "bigger" objects (like a table) are involved the textarea get messed<br />
up (shifted horizontally).<br />
<br />
In the following example inner and outer margin notes are added to make it more obvious.<br />
<br />
<texcode><br />
\setuppapersize[A4][A4]<br />
<br />
\definelayout[WithoutMarginnotes][location={duplex},grid=no,topspace=3cm,height=24cm,backspace=3cm,cutspace=0cm,leftmargin=1cm,leftmargindistance=0.4cm,width=16cm,rightmargindistance=0cm,rightmargin=0cm]<br />
<br />
\definelayout[WithMarginnotes][location={duplex},grid=no,topspace=3cm,height=24cm,backspace=3cm,cutspace=0cm,leftmargin=1cm,leftmargindistance=0.4cm,width=12.1cm,rightmargindistance=0.4cm,rightmargin=3.5cm]<br />
<br />
\setuppagenumbering[alternative=doublesided,location=]<br />
<br />
\starttext<br />
<br />
\setuplayout[WithMarginnotes]<br />
<br />
\dorecurse {6} {<br />
\ininner[stack=yes]{\expanded{\dorecurse{2}{IM\recurselevel\space}}}%<br />
\inouter[stack=yes]{\expanded{\dorecurse{3}{OM\recurselevel\space}}}%<br />
\input tufte \par<br />
}<br />
<br />
\setuplayout[WithoutMarginnotes]<br />
<br />
\placetable[split][]{Big table object}<br />
{<br />
\setupTABLE[row][1][width=\textwidth]<br />
\bTABLE[split=repeat]<br />
\bTABLEhead<br />
\bTR \bTD XXX \eTD \eTR<br />
\eTABLEhead<br />
\bTABLEbody<br />
\dorecurse{20}{<br />
\bTR \bTD XXX \eTD \eTR}<br />
\eTABLEbody<br />
\eTABLE<br />
}<br />
<br />
\setuplayout[WithMarginnotes]<br />
<br />
\dorecurse {3} {<br />
\ininner[stack=yes]{\expanded{\dorecurse{2}{IM\recurselevel\space}}}%<br />
\inouter[stack=yes]{\expanded{\dorecurse{3}{OM\recurselevel\space}}}%<br />
\input tufte \par<br />
}<br />
<br />
\stoptext<br />
</texcode><br />
<br />
=Bug: Formula numbering - subnumbers and list of formulas=<br />
<br />
All following example have following frame:<br />
<br />
<texcode><br />
\usemodule[newmath]<br />
<br />
\setupformulas[way=bytext,prefix=no]<br />
\setupsubformulas[conversion=romannumerals]<br />
<br />
\starttext<br />
...(example placed here)...<br />
\stoptext<br />
</texcode><br />
<br />
<br />
==What works==<br />
<br />
===formula===<br />
<br />
Expected formular number: (1)<br />
<br />
<texcode><br />
\placenamedformula[one]{Der einfache Test}<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
<br />
Result: (1) -> '''Works'''<br />
<br />
===align - formular [+]===<br />
<br />
Expected formular numbers: (1) and (2)<br />
<br />
<texcode><br />
\placeformula<br />
\startformula<br />
\startalign[n=3, align={right,middle,left}]<br />
\NC PM \xrightarrow \NC R_{PM} \NC \xrightarrow PM \NR[+]<br />
\NC R_{PM} \NC = \NC \{ A, B, C, D, E\} \NR[+]<br />
\stopalign<br />
\stopformula<br />
</texcode><br />
<br />
Result: (1) and (2) -> '''Works'''<br />
<br />
<br />
===align - subformular [+]===<br />
<br />
Expected numbers: (1.a), (1.b), (1.c), (1.d) and reference on (1) and (1.b)<br />
<texcode><br />
\startsubformulas[eq:ax=b]<br />
\placeformula<br />
\startformula \startalign<br />
\NC a \NC \eq b \NR[+]<br />
\NC c \NC \neq d \NR<br />
\NC \NC \neq f \NR[eq:sub]<br />
\NC \NC \geq g \NR[+]<br />
\NC \NC \leq h \NR[+]<br />
\NC \NC \eq i \NR<br />
\stopalign \stopformula<br />
\stopsubformulas<br />
</texcode><br />
<br />
Result: (1.a), (1.b), (1.c), (1.d) -> '''Works'''.<br />
<br />
BUT: Every formula with a reference is automatic listed in the table of formulas (nameless) - at the moment there is no possiblity to have a reference without listing the formula.<br />
<br />
===eqalignno - formula===<br />
<br />
Taken from wiki and removed the subformulanumber. Expected formular numbers: (1), (2), (3) and (4):<br />
<br />
<texcode><br />
\placeformula<br />
\startformula<br />
\eqalignno{<br />
c^2 &= a^2 + b^2 &\formulanumber \cr<br />
c &= \left(a^2 + b^2\right)^{\vfrac{1}{2}} &\formulanumber\cr<br />
a^2 + b^2 &= c^2 &\formulanumber \cr<br />
d^2 &= e^2 &\formulanumber \cr}<br />
\stopformula<br />
</texcode><br />
<br />
Result: (1), (2), (3) and (4) -> '''Works'''<br />
<br />
<br />
==What does not work==<br />
<br />
<br />
===List of formulas===<br />
<br />
<texcode><br />
\placelist[formula][criterium=all,alternative=c]<br />
</texcode><br />
<br />
The list of formulas seems to be totally out of order. Strange numbering and missing names. Needs more investigation once some of the named formulas constructions are fixed.<br />
<br />
<br />
===subformula===<br />
<br />
Expected formular numbers: (1a) and (1b)<br />
<br />
<texcode><br />
\startsubformulas[eq:1]<br />
\placeformula[eq:first]<br />
\startformula<br />
PM \xrightarrow R_{PM} \xrightarrow PM<br />
\stopformula<br />
<br />
\placeformula[eq:second]<br />
\startformula<br />
R_{PM} = \{ K, F, Z, U, I, J\}<br />
\stopformula<br />
\stopsubformulas<br />
</texcode><br />
<br />
Result: (1a) and nothing -> '''Does not work.'''<br />
<br />
<br />
===align - formula (subformulas->formulas->formula)===<br />
<br />
Expected formular numbers: (1a) and (1a) and a reference to formular (1b)<br />
<br />
<texcode><br />
\startsubformulas<br />
\startformulas<br />
\placeformula<br />
\startformula<br />
\startalign[n=3, align={right,middle,left}]<br />
\NC PM \xrightarrow \NC R_{PM} \NC \xrightarrow PM \NR[+]<br />
\NC R_{PM} \NC = \NC \{ A, B, C, D, E\} \NR[a]<br />
\stopalign<br />
\stopformula<br />
\stopformulas<br />
\stopsubformulas<br />
</texcode><br />
<br />
Result: nothing and nothing -> '''Does not work.'''<br />
<br />
<br />
===align - subformula===<br />
<br />
Expected formular numbers: (1.1), (1.2) and (1.c) plus reference on (1.1) and (1.2)<br />
<br />
<texcode><br />
\placesubformula<br />
\startformula<br />
\startalign[n=3, align={right,middle,left}]<br />
\NC PM \xrightarrow \NC R_{PM} \NC \xrightarrow PM \NR[gleichung1a][.1]<br />
\NC R_{PM} \NC = \NC \{ A, B, C, D, E\} \NR[gleichung1b][.2]<br />
\NC R_{PM} \NC = \NC \{ A, B, C, D, E\} \NR[+][c]<br />
\stopalign<br />
\stopformula<br />
</texcode><br />
<br />
Result: (1), (2) and (3) -> '''Does not work.'''<br />
<br />
<br />
Expected formular numbers: (1a) and (1b) plus reference on (1a) and (1b)<br />
<br />
<texcode><br />
\placesubformula<br />
\startformula<br />
\startalign[n=3, align={right,middle,left}]<br />
\NC PM \xrightarrow \NC R_{PM} \NC \xrightarrow PM \NR[gleichung1a][+]<br />
\NC R_{PM} \NC = \NC \{ A, B, C, D, E\} \NR[gleichung1b][]<br />
\stopalign<br />
\stopformula<br />
</texcode><br />
<br />
Result: (1) and (2) -> '''Does not work.'''<br />
<br />
<br />
===eqalignno - subformula===<br />
<br />
Directly taken form wiki. Expected formular numbers (1), (1a), (1b) and (2):<br />
<br />
<texcode><br />
\placeformula<br />
\startformula<br />
\eqalignno{<br />
c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
c &= \left(a^2 + b^2\right)^{\vfrac{1}{2}} &\subformulanumber{b}\cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{c} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
<br />
Result: Does not compile Does as the command type{subformularnumber} is unknown -> '''Does not work.'''<br />
<br />
==Suggestion for new syntax==<br />
<br />
'''Open for discussion :-)'''<br />
<br />
The needs out of existing syntax and my personal experience:<br />
* formulas and subformulas in the same block<br />
* referencing on a subformula does not include automaticly a entry in the list of formulas<br />
* simple, block and eqalignno<br />
<br />
===Simple===<br />
<br />
Expected formular number: (1) and list entry (1) -> "Der einfache Test"<br />
<br />
<texcode><br />
\placeformula[reference={one},listlabel={Der einfache Test}]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
<br />
<br />
Expected formular number: (1.3) and list entry (1.3) -> "Der einfache Test"<br />
<br />
<texcode><br />
\placeformula[sublevel={.3},reference={one},listlabel={Der einfache Test}]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
<br />
<br />
===Block notation: NR===<br />
<br />
No specific values -> [+] otherwise classic attribute/value [...]<br />
<br />
Expected numbers: (1.a), nothing, (1.b), (2), (2.a), nothing and (3); with reference on (1) and (1.b); with list entries of (1) -> "System of stuff", (2.a) -> "Great piece" and (3) -> "Last part"<br />
<br />
<texcode><br />
\placenamedformula[reference={eq:ax=b},listlabel={System of stuff}]<br />
\startformula \startalign<br />
\NC a \NC \eq b \NR[sublevel={.a}]<br />
\NC c \NC \neq d \NR<br />
\NC \NC \neq f \NR[reference={eq:sub},sublevel={.b}]<br />
\NC \NC \geq g \NR[+]<br />
\NC \NC \leq h \NR[listlabel={Great piece},sublevel={.a}]<br />
\NC \NC \eq i \NR<br />
\NC \NC \eq i \NR[listlabel={Last part}]<br />
\stopalign \stopformula<br />
\stopsubformulas<br />
</texcode><br />
<br />
<br />
===eqalignno===<br />
<br />
Expected formular numbers (1), (1a), (1.c) and (2); reference on (2); list entries (1.c) -> "Yea!" and (2) -> "Ups"<br />
<br />
<texcode><br />
\placeformula<br />
\startformula<br />
\eqalignno{<br />
c^2 &= a^2 + b^2 &\formulanumber \cr<br />
c &= \left(a^2 + b^2\right)^{\vfrac{1}{2}} &\formulanumber[sublevel={a}]\cr<br />
a^2 + b^2 &= c^2 &\formulanumber[sublevel={.c},listlabel={Yea!}] \cr<br />
d^2 &= e^2 &\formulanumber[listlabel={Ups},reference={eq:ups}]\cr}<br />
\stopformula<br />
</texcode><br />
<br />
<br />
===Summary===<br />
<br />
All three commands:<br />
* \NR<br />
* \placeformula<br />
* \formualanumber <br />
will share the same attributes:<br />
* sublevel (maybe better: formulalevel or just level?)<br />to define and concrete the (sub-)level of the formula<br />
* listlabel (maybe textlabel? the numberlabel is still needed)<br /> to add a entry in the list of formulas<br />
* reference<br />just a classic reference in order to link to it<br />
so that the syntax is more intuitive during writing.<br />
<br />
Also. this way the commands:<br />
* placesubformula<br />
* placenamedformula<br />
* placenamedsubformula<br />
* startstopsubformulas<br />
* subformulanumber<br />
will become needless.</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Math&diff=23032Math2016-02-19T17:22:52Z<p>Braslau: removed the RED flagged text</p>
<hr />
<div>< [[Main Page]] | [[Math with newmat]] | [[MathML]] | [[Math_structures]]><br />
<br />
== Introduction ==<br />
<br />
TeX was designed for ease of typesetting books that contained mathematics. As ConTeXt is built on top of TeX, it inherits all those features. In addition to these, ConTeXt adds lot of macros to make the typesetting of mathematics easier.<br />
<br />
There are '''two''' kinds of '''math modes''' --- '''inline math and display math'''. Mathematical expressions that are written with the running text are called inline math; while mathematical expressions that break the flow of the text (such as formulas or equations) are called display math. TeX takes care of proper spacing around expressions and provides macros to typeset most mathematical constructs.<br />
Complicated expressions can be built by working in steps---break down the expression into sub-expressions, build the sub-expressions and then combine them to get the complicated expression.<br />
<br />
The basics of typesetting math in ConTeXt is explained here.<br />
<br />
=== Display math mode ===<br />
Type<br />
<br />
<texcode><br />
\startformula ... \stopformula<br />
</texcode><br />
<br />
to get display math mode.<br />
<br />
=== Inline math mode ===<br />
There are four equivalent commands to get inline math mode:<br />
<br />
<texcode><br />
$ ... $ % TeX style.<br />
\m{ ... } <br />
\math{ ... } <br />
\mathematics{ ... }<br />
</texcode><br />
<br />
=== Note to Plain TeX Users ===<br />
ConTeXt is plain TeX compatible. So, if you have any old document written in plain TeX, it will work with ConTeXt. This does not mean that you will get pixel by pixel identical output with ConTeXt. For inline math, everything that you learnt for plain TeX is also true for ConTeXt. However, display math is significantly different. '''Do not use <code>$$ .... $$</code>''' to write display math formulas in ConTeXt, since you will not get the correct spacing around the formulas. Instead use <br />
<br />
<texcode><br />
\startformula ... \stopformula<br />
</texcode><br />
<br />
See [[Math/Display]] for more details on how to use display math in ConTeXt.<br />
<br />
=== Note to AMSTeX/LaTeX Users ===<br />
ConTeXt offers almost all the features that are present in AMSTeX and LaTeX. However, ConTeXt syntax is different. See this [http://dl.contextgarden.net/myway/context-latex-math.pdf My Way] for how to 'translate' from amsmath syntax to ConTeXt syntax. [[LaTeX_Math_in_ConTeXt]] gives some brief ideas on how to get the LaTeX syntax to run in ConTeXt.<br />
<br />
== The details ==<br />
<br />
=== Math symbols ===<br />
* [[Math/basic | How to input math]] (binary relations, greek letters, subscripts and superscripts)<br />
* Accents<br />
* underbrace, overbrace<br />
* [[Math/fractions | Fractions, Binomials, genfrac, continued fractions.]]<br />
* Delimiters (big, bigg, left, middle, right)<br />
* Integrals and Sums<br />
* ([[Math/functions|Log like]]) functions<br />
* dots<br />
* [[Multiline_equations#Cases|Cases]], matrices, bordermatrix<br />
* Arrows (see [http://dl.contextgarden.net/myway/matharrows.pdf Math Arrows])<br />
* [[Vectors]]<br />
* [[Product integral]]<br />
<br />
=== Display Math ===<br />
* [[Math/Display | Formula, formula number]]<br />
* [[Multiline equations]] (see [http://dl.contextgarden.net/myway/mathalign.pdf Using \mathalign and friends])<br />
* Math sub-alignment<br />
* [[Math spacing]]<br />
<br />
==Math Fonts==<br />
<br />
''See [[Math fonts]]'' for the main article about this subject.<br />
<br />
== Other Methods ==<br />
* There are two different math modules on [http://dante.ctan.org/tex-archive/macros/context/contrib/maths/ CTAN], [[Math with nath|nath]] and [[Math with amsl|amsl]]. And there's a [[Math with newmat|new math]] module in the distribution.<br />
* Context now has inbuilt support for [[Multiline equations]]<br />
* It is also possible to use most [[LaTeX Math in ConTeXt|LaTeX equations in ConTeXt]] with a relatively small set of supporting definitions.<br />
* The "native" ConTeXt way of math is [[MathML]], an application of [[XML]] - rather verbose but mighty.<br />
<br />
==Science==<br />
* Esp. for physics there’s the [[Units]] module.<br />
* Additions to [[MathML]] are PhysML and ChemML.<br />
* [[Chemistry]]<br />
* There's a module for chemical structure formulae: [[Chemistry|PPCHTeX]] (works also with LaTeX).<br />
<br />
==Number Formatting==<br />
There's a special command, <cmd>digits</cmd>, with its own manual about formatting numbers, see [http://www.pragma-ade.com/general/magazines/mag-0003.pdf Pasting digits together]<br />
<br />
==Evaluating expressions in ConTeXt==<br />
(i.e. ''doing'' math)<br />
* See also [[Expressions]].<br />
<br />
[[Category:Math]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Font_Switching&diff=23026Font Switching2016-02-13T10:25:01Z<p>Braslau: Added nesting table to Emphasizing text</p>
<hr />
<div>< [[Basic Text Formatting]] | [[Fonts]] ><br />
<br />
<br />
In ConTeXt there are four ways to switch fonts:<br />
<br />
* font style/alternative commands ({{cmd|rm}}, {{cmd|ss}}, etc.),<br />
* font size commands ({{cmd|tfa}}, {{cmd|tfb}}, etc.),<br />
* mnemonic command aliases ({{cmd|bold}}, {{cmd|sans}}, etc.),<br />
* a complete font change ({{cmd|setupbodyfont}}, {{cmd|switchtobodyfont}}).<br />
<br />
== Before you start ... ==<br />
<br />
1. Placing a font switch at the begin of a paragraph can sometimes generate unexpected side-effects. This can be avoided by forcing horizontal mode before any font change:<br />
<texcode><br />
\dontleavehmode{\bf Warning!} Care must be taken when a font switch is used at the beginning of a paragraph.\par<br />
</texcode><br />
<br />
2. It is usually a bad style to use explicit font switches in the text. It is better to define a semantic command that takes care of the font switching. For example, instead of using <code>{\bf\red important text}</code><br />
<texcode><br />
\definehighlight[important][style=bold, color=red]<br />
</texcode><br />
and then use <code>\important{important text}</code> in the text.<br />
<br />
== Font styles and alternatives ==<br />
<br />
There are three main types of font styles: serif, sans serif, and teletype. To<br />
switch between these styles, use {{cmd|rm}} for serif, {{cmd|ss}} for<br />
sans serif, and {{cmd|tt}} for teletype.<br />
<br />
Each of these styles comes in different alternatives: normal, bold, italic,<br />
slanted, bold-italic, bold-slanted, and small-capped. To switch to a different<br />
alternative, use {{cmd|tf}} ("typeface") for normal, {{cmd|bf}} for bold, {{cmd|it}}<br />
for italic, {{cmd|sl}} for slanted, {{cmd|bi}} for bold-italic,<br />
{{cmd|bs}} for bold-slanted, and {{cmd|sc}} for small-capped.<br />
<br />
You can generally combine font styles with alternatives, so if you want to<br />
switch to bold sans serif, you can use either <code>\bf\ss</code> or<br />
<code>\ss\bf</code>. The various combinations look like the following.<br />
<br />
<context mode="mkiv"><br />
\setupbodyfont[8pt]<br />
\setupcolors[rgb, state=start]<br />
\definecolor[one][c=0, m=.4, y=1, k=0]<br />
\definecolor[two][c=0, m=.2, y=.5, k=0]<br />
\setupTABLE[frame=off,offset=0.5em]<br />
<br />
\setupTABLE[c][2][style=\rm]<br />
\setupTABLE[c][3][style=\ss]<br />
\setupTABLE[c][4][style=\tt]<br />
\setupTABLE[r][1][background=color, backgroundcolor=one]<br />
\setupTABLE[c][1][background=color, backgroundcolor=one]<br />
<br />
\startTABLE<br />
\NC \NC \type{\rm} serif \NC \type{\ss} sans serif \NC \type{\tt} teletype \NC \NR<br />
\NC \type{\tf} \NC Normal \NC Normal \NC Normal \NC \NR<br />
\NC \type{\bf} \NC \bf Bold \NC \bf Bold \NC \bf Bold \NC \NR<br />
\NC \type{\it} \NC \it Italic \NC \it Italic \NC \it Italic \NC \NR<br />
\NC \type{\sl} \NC \sl Slanted \NC \sl Slanted \NC \sl Slanted\NC \NR<br />
\NC \type{\bi} \NC \bi Bold Italic \NC \bi Bold Italic \NC \bi Bold Italic\NC \NR<br />
\NC \type{\bs} \NC \bs Bold Slanted \NC \bs Bold Slanted \NC \bs Bold Slanted\NC \NR<br />
\NC \type{\sc} \NC \sc Smallcaps \NC \sc Smallcaps \NC \sc Smallcaps\NC \NR<br />
\stopTABLE<br />
<br />
</context><br />
<br />
A font switch remains valid for the rest of the ''group''. So, if you want to<br />
temporarily switch to a different font, use the font style command inside a<br />
group. The easiest way to start a group is to enclose the text within braces<br />
(also called curly brackets), for example<br />
<br />
<texcode><br />
This is serif text<br />
{\ss This is sans serif}<br />
This is serif again<br />
{\tt and this is typewriter}<br />
And serif again<br />
</texcode><br />
<br />
which gives (notice the braces in the above lines)<br />
<br />
<context><br />
This is serif text \crlf<br />
{\ss This is sans serif} \crlf<br />
This is serif again \crlf<br />
{\tt and this is typewriter} \crlf<br />
And serif again<br />
</context><br />
<br />
== Emphasizing text ==<br />
There is a font switch {{cmd|em}} to ''emphasize'' text. This is somewhat<br />
special: it does automatic italic correction and changes the alternative depending<br />
on the current alternative. For example, if the current font alternative is normal (i.e. upright),<br />
{{cmd|em}} switches to slanted; and if the current font alternative is slanted,<br />
{{cmd|em}} switches to normal.<br />
<br />
<context><br />
\starttabulate[|l|f{\tf}l|f{\it}l|f{\sl}l|f{\bf}l|f{\bi}l|f{\bs}l|]<br />
\NC \NC \tttf \tex{tf} \NC \tttf \tex{it} \NC \tttf \tex{sl} \NC<br />
\tttf \tex{bf} \NC \tttf \tex{bi} \NC \tttf \tex{bs} \NC\NR<br />
\NC \NC Text \NC Text \NC Text \NC<br />
Text \NC Text \NC Text \NC\NR<br />
\NC \tex{em} \NC \em Text \NC \em Text \NC \em Text \NC<br />
\em Text \NC \em Text \NC \em Text \NC\NR<br />
\NC \tex{boldface} \NC \boldface Text \NC \boldface Text \NC \boldface Text \NC<br />
\boldface Text \NC \boldface Text \NC \boldface Text \NC\NR<br />
\NC \tex{typeface} \NC \typeface Text \NC \typeface Text \NC \typeface Text \NC<br />
\typeface Text \NC \typeface Text \NC \typeface Text \NC\NR<br />
\NC \tex{swapface} \NC \swapface Text \NC \swapface Text \NC \swapface Text \NC<br />
\swapface Text \NC \swapface Text \NC \swapface Text \NC\NR<br />
\stoptabulate<br />
</context><br />
<br />
ConTeXt uses the Latin Modern fonts by default; these fonts look<br />
similar to the original Computer Modern fonts, but have a much larger<br />
character repertoire. As it happens, in the Latin Modern (and Computer<br />
Modern) fonts, the slanted font does not stand out from the<br />
upright font enough for some tastes; so, many people prefer to use the<br />
italic font for emphasis. To do that use <br />
<texcode><br />
\definebodyfontenvironment[default][em=italic]<br />
</texcode><br />
<br />
{{note| For Opentype fonts, italic correction needs to be set using<br />
<texcode>\definefontfeature[default][default][itlc=yes]</texcode>}}<br />
<br />
== Font sizes ==<br />
<br />
Occasionally one needs to use a font size different from the bodyfont. ConTeXt provides two series<br />
of commands for that. For a larger font size, you can use {{cmd|tfa}} to scale<br />
the font size by a factor of <code>1.2</code>, {{cmd|tfb}} to scale by a factor of<br />
<code>(1.2)^2 = 1.44</code>, {{cmd|tfc}} to scale by <code>(1.2)^3 = 1.728</code> and {{cmd|tfd}} to<br />
scale by <code>(1.2)^4 = 2.074</code>. The scale is relative to the current bodyfont size.<br />
<br />
<br />
To decrease the font size, you can use {{cmd|tfx}}<br />
to scale the font by a factor of <code>0.8</code> and {{cmd|tfxx}} to scale by a factor<br />
of <code>0.6</code>.<br />
<br />
The complete set of relative font sizes are listed below:<br />
{| style="border:1px solid #ffcc00; width:100%; padding: 0.5em;" <br />
|- align="right"<br />
!size||factor ||4pt||5pt||6pt||7pt||8pt||9pt||10pt||11pt||12pt||14.4pt||17.3pt||20.7pt<br />
|- align="right"<br />
|xx ||0.6 ||4 ||5 ||5 ||5 ||5 ||5 ||6 ||7 ||8 ||10 ||12 ||14.4<br />
|- align="right"<br />
|x ||0.8 ||4 ||5 ||5 ||6 ||6 ||7 ||8 ||9 ||10 ||12 ||14.4 ||17.3<br />
|- align="right" style="background-color: #ffeebb;"<br />
|tf ||1.0 ||4 ||5 ||6 ||7 ||8 ||9 ||10 ||11 ||12 ||14.4 ||17.3 ||20.7<br />
|- align="right"<br />
|a ||1.2 ||4.8||6.0||7.2||8.4||9.6||10.8||12.0||13.2||14.4||17.3 ||20.7 ||24.8<br />
|- align="right"<br />
|b ||1.44 ||5.8||7.2||8.6||10.1||11.5||13.0||14.4||15.8||17.3||20.7||24.9 ||29.8<br />
|- align="right"<br />
|c ||1.728 ||6.9||8.6||10.4||12.1||13.8||15.6||17.3||19.0||20.7||24.9||29.9||35.8<br />
|- align="right"<br />
|d ||2.074 ||8.3||10.4||12.4||14.5||16.6||18.7||20.7||22.8||24.9||29.9||35.9||42.9<br />
|- align="right"<br />
|e ||2.488 ||10.0||12.4||14.9||17.4||19.9||22.4||24.9||27.4||29.9||35.8||43.0||52.5<br />
|-<br />
| _<br />
|- align="right"<br />
|scriptscript|| 0.5 ||4 ||5 ||5 ||5 ||5 ||5 ||5 ||6 ||7 ||9 ||10 ||12<br />
|- align="right"<br />
|script|| 0.7 ||4 ||5 ||5 ||6 ||6 ||7 ||7 ||8 ||9 ||11 ||12 ||14.4<br />
|- align="right"<br />
|small|| 0.8 ||4 ||4 ||5 ||5 ||6 ||7 ||8 ||9 ||10 ||12 ||14.4||17.3<br />
|- align="right"<br />
|big || 1.2 ||6 ||7 ||8 ||9 ||10 ||11 ||12 ||12 ||14.4||17.3||20.7||20.7<br />
|}<br />
<br />
As defined in [[source:font-ini.mkiv|font-ini]]. All sizes in pt, except factor.<br />
<br />
<br />
The mapping of particular command suffixes (a, x, etc.) and current bodyfont size to effective font size can<br />
be changed by {{cmd|definebodyfontenvironment}}. The default values defined in [[source:font-ini.mkiv|font-ini]] are:<br />
<texcode><br />
\definebodyfontenvironment<br />
[\s!default]<br />
[ \s!text=1.0,<br />
\s!script=0.7,<br />
\s!scriptscript=0.5,<br />
\c!a=1.200,<br />
\c!b=1.440,<br />
\c!c=1.728,<br />
\c!d=2.074,<br />
*=\currentfontscale, % wildcard<br />
\c!x=0.8,<br />
\c!xx=0.6,<br />
\c!big=1.2,<br />
\c!small=0.8,<br />
\c!interlinespace=,<br />
\c!em=\v!slanted]<br />
</texcode><br />
'''N.B.''': <code>scirpt</code> and <code>scriptsize</code> are used in math mode.<br />
<br />
It is also possible to set the scaling factors for specific font sizes. For example, if you want {{cmd|tfa}} to set the effective font size to 12pt when the bodyfont size is 10pt, and to set the effective font size to <br />
14pt when the bodyfont size is 11pt, then add<br />
<texcode><br />
\definebodyfontenvironment [10pt] [a=12pt]<br />
\definebodyfontenvironment [11pt] [a=14pt]<br />
</texcode><br />
<br />
'''Note:''' When the first parameter is <code>default</code>, the scaling factors ''must'' have numerical values. When the first parameter is a font size (e.g., <code>12pt</code>), the scaling factors can either be numerical value or a dimension. <br />
<br />
{{cmd|definebodyfontenvironment}} is described in detail in <br />
the ConTeXt manual and the [[source:font-ini.mkiv|font-ini]] source file.<br />
<br />
Font size can be combined with font styles. As a shortcut, you can use<br />
{{cmd|bfa}} to get bold font scaled by <code>1.2</code>, {{cmd|bfx}} to get a bold font<br />
scaled by <code>0.8</code> and similar commands for other font styles.<br />
<br />
These quick font switches are meant for changing the font style, alternative, or size of a few<br />
words: they do not change the bodyfont, so they don't affect interline spacing or math font sizes. So, if<br />
you want to change the font size of an entire paragraph, use<br />
{{cmd|switchtobodyfont}} described below in [[Font_Switching#Complete_font_change|Complete Font Change]]. However, it<br />
is fine to use them as style directives in setup commands, that is, using them<br />
as an option for <code>[[Style_and_Color_Parameters|style=]]...</code> in any setup command that accepts<br />
<code>style</code> option.<br />
<br />
== Mnemonic font switches ==<br />
<br />
While learning a document markup language like ConTeXt, it can be hard to<br />
remember all the commands. ConTeXt provides other, easy-to-remember font<br />
switches. So for bold you can use {{cmd|bold}}, for italic you can use<br />
{{cmd|italic}}, for slanted you can use {{cmd|slanted}}, and so on. You can<br />
probably guess what the following do:<br />
<br />
{|<br />
| {{cmd|normal}} <br />
| {{cmd|slanted}}<br />
|-<br />
| {{cmd|boldslanted}}<br />
| {{cmd|slantedbold}}<br />
|-<br />
| {{cmd|bolditalic}}<br />
| {{cmd|italicbold}}<br />
|-<br />
| {{cmd|small}}<br />
| {{cmd|smallnormal}}<br />
|-<br />
| {{cmd|smallbold}}<br />
| {{cmd|smallslanted}}<br />
|-<br />
| {{cmd|smallboldslanted}}<br />
| {{cmd|smallslantedbold}}<br />
|-<br />
| {{cmd|smallbolditalic}}<br />
| {{cmd|smallitalicbold}}<br />
|-<br />
| {{cmd|sans}}<br />
| {{cmd|sansserif}}<br />
|-<br />
| {{cmd|sansbold}}<br />
| {{cmd|smallcaps}} <br />
|}<br />
<br />
In addition, the commands {{cmd|smallbodyfont}} and<br />
{{cmd|bigbodyfont}} can be used to change the font size. The relative size depends on the value of <code>big</code> and <code>small</code> in {{cmd|definebodyfontenvironment}}.<br />
<br />
These mnemonic font switches are pretty smart. You can either use them as<br />
font style switches inside a { ''group'' }, or as a font changing command that takes an<br />
argument. For example,<br />
<br />
<context source="yes"><br />
This is {\bold bold} and so is \bold{this}. But this is not.<br />
</context><br />
<br />
These mnemonic font switches can also be used for all <code>style=...</code><br />
options, and while using them as style options, you can just give the command<br />
name without the backslash. For example:<br />
<texcode><br />
\setuphead[section][style=bold] <br />
</texcode><br />
<br />
(<code>\boldface</code> shown above is also defined to parallel the<br />
<code>\typeface</code> and <code>\swapface</code> switches.)<br />
<br />
== Complete font (bodyfont) change ==<br />
<br />
If you need to change to a different font size and take care of interline<br />
spacing, you can change the bodyfont by using {{cmd|switchtobodyfont}}. For example, to switch to 12pt<br />
you can use <code>\switchtobodyfont[12pt]</code>.<br />
<br />
<br />
ConTeXt provides two relative sizes, called ''big'' and ''small''. So, to increase the bodyfont size, use <code>\switchtobodyfont[big]</code> (or <code>\setbigbodyfont</code>), and to decrease the bodyfont size, use <code>\switchtobodyfont[small]</code> (or <code>\setsmallbodyfont</code>). The exact<br />
size used for big and small can be set using <br />
{{cmd|definebodyfontenvironment}}.<br />
<br />
The {{cmd|setupbodyfont}} command accepts all the same arguments as<br />
{{cmd|switchtobodyfont}}. The difference between the two is that<br />
{{cmd|setupbodyfont}} also changes the font for headers, footers and other<br />
page markings, while {{cmd|switchtobodyfont}} does not. So you should use<br />
{{cmd|setupbodyfont}} for global font definitions to apply to the whole document, and<br />
{{cmd|switchtobodyfont}} for local font changes (i.e. changes to the running text only). The effect of<br />
{{cmd|switchtobodyfont}} can be localized within a group as usual.<br />
<br />
== Switching typefaces ==<br />
<br />
So far we have discussed style and size changes within a given typeface<br />
family. If you want to use a different typeface altogether, such as Times or<br />
Palatino, see the following articles.<br />
<br />
<br />
* [[Simple Typescript Example]]<br />
* [[Example with normal and condensed font variants]]<br />
* [[Linux Libertine on mkiv]]<br />
<br />
<br />
<br />
<br />
[[Category:Fonts]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=PDF_Print_Options&diff=23009PDF Print Options2015-12-24T18:14:13Z<p>Braslau: </p>
<hr />
<div>== Duplex Printing ==<br />
<br />
It is possible to specify the options for duplex printing in ConTeXt (beginning with beta from 2015.12.22 10:50) in the PDF document itself.<br />
<br />
Duplex printing can be specified using the key <code>option=</code> from the <code>\setupinteractionscreen</code> command.<br />
<br />
Possible values are:<br />
<br />
* <code>page</code>: enables single--sided printing (mandatory to disable duplex printing in a printer in which is set by default).<br />
* <code>portrait</code> enables portrait duplex printing (the paper long side is flipped).<br />
* <code>landscape</code> enables landscape duplex printing (the paper short side is flipped).<br />
<br />
=== Important Warning ===<br />
<br />
For now, any form of duplex printing (included single--sided printing) disables the zoomed printing fit to page.<br />
<br />
== Conformant PDF Readers ==<br />
<br />
To the best of my knowledge, only Adobe (Reader or not) from version 9 supports this feature.<br />
<br />
evince allows duplex options in its printing dialog, but it cannot read these from the PDF document. There is an open issue in poppler to [https://bugs.freedesktop.org/show_bug.cgi?id=92779 implement this feature].</div>Braslauhttps://wiki.contextgarden.net/index.php?title=ConTeXt_Standalone&diff=23003ConTeXt Standalone2015-12-21T22:10:55Z<p>Braslau: Added section on installing the tree by project in a production environment;Also corrected the ownership command</p>
<hr />
<div>{{Installation navbox}}<br />
<br />
The '''ConTeXt suite''' is a complete, up-to-date ConTeXt distribution that can be upgraded efficiently. It can also be used in parallel with existing TeX installations such as MikTeX, TeXLive, and so forth. The suite does not include LaTeX packages and binaries.<br />
<br />
Sometimes ConTeXt beta releases have issues. The ConTeXt suite allows you to test the latest ConTeXt release without worrying whether upgrading will corrupt a critical project. Multiple ConTeXt suite installations are possible. This allows, for example, a stable version and a beta version to run in parallel on the same computer.<br />
<br />
ConTeXt is also included in TeXlive. The ConTeXt suite is updated continuously, whereas ConTeXt in TeXlive is updated less often. In particular, <code>luatex</code> and <code>metapost</code> are under active development and their binaries are updated frequently. ConTeXt follows these developments, indeed often drives development. As the binaries included in the TeXlive distribution are only updated yearly, ConTeXt on TeXlive will necessarily be less current than the ConTeXt suite. (ConTeXt on TeXlive can be kept somewhat more current using the http://tlcontrib.metatex.org repository.) The ConTeXt suite is self-contained and can happily coexist alongside another installed TeX distribution.<br />
<br />
{{TOClimit|limit=1}}<br />
<br />
= General Information =<br />
<br />
== Supported platforms ==<br />
<br />
{| style="border:1px solid #DDDDDD;"<br />
|- align="left" <br />
! Platform<br />
! Short name<br />
! Binaries by<br />
! Notes<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Windows<br />
| mswin<br />
| Akira Kakuto ([http://w32tex.org W32TeX])<br />
|<br />
|- align="left"<br />
! Linux<br />
| linux<br />
| Hans Hagen, Mojca Miklavec, Alan Braslau<br />
| compiled with glibc 2.3.6<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Linux, 64-bit<br />
| linux-64<br />
| Alan Braslau<br />
|<br />
|- align="left"<br />
! Linux, PowerPC<br />
| linux-ppc<br />
| Piotr Kopszak<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Linux, Arm (low end.)<br />
| linux-armel<br />
| Boris Veytsman<br />
| in progress<br />
|- align="left"<br />
! Mac OS X, Intel (32-bit)<br />
| osx-intel<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Mac OS X, Intel (64-bit)<br />
| osx-64<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left"<br />
! Mac OS X, PowerPC<br />
| osx-ppc<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Mac OS X, Universal Binaries<br />
| osx-universal<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left"<br />
! FreeBSD<br />
| freebsd<br />
| Alan Braslau<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! FreeBSD, 64-bit<br />
| freebsd-amd64<br />
| Alan Braslau<br />
| <br />
|- align="left"<br />
! kFreeBSD<br />
| kfreebsd-i386<br />
| Alan Braslau<br />
| FreeBSD + glibc (Debian)*<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! kFreeBSD, 64-bit<br />
| kfreebsd-amd64<br />
| Alan Braslau<br />
| FreeBSD + glibc (Debian)*<br />
|- align="left"<br />
! Solaris, Intel<br />
| solaris-intel<br />
| Marco Patzer<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Solaris, Sparc<br />
| solaris-sparc<br />
| Mojca Miklavec<br />
| Solaris 10 on [http://www.opencsw.org/about/ OpenCSW]<br />
|}<br />
<br />
*Note: we have stopped distributing binaries for kfreebsd. However, this system is still supported, and natively-compiled binaries can be installed from the Debian distribution.<br />
<br />
We need volunteers for providing binaries for other platforms. If you want to support a platform, please write to [[ConTeXt Mailing Lists]]<br />
<br />
== Dependencies ==<br />
* [http://www.ruby-lang.org Ruby] 1.8 or newer (used for MKII)<br />
* Rsync (The windows binary of rsync is distributed within the suite)<br />
<br />
<br />
The following programs are not required for running ConTeXt, but their installation adds additional functionality.<br />
<br />
* curl : for including remote content<br />
* ghostscript : for converting PostScript images to PDF<br />
* graphicsmagick (convert) : for converting GIF and TIFF images<br />
* inkscape : for converting SVG and compressed SVG<br />
* mupdf (mudraw) : for converting PDF to PNG (used for ePub covers)<br />
* pstoedit : for converting PostScript to MetaPost outlines<br />
* zint : for providing barcodes<br />
* zip or 7zip : for EPUB generation<br />
<br />
== Disc space required ==<br />
ConTeXt macro files are small (less than 10MB), but the suite comes with various free fonts which considerably increase the size of the distribution to around 200MB).<br />
<br />
== Multiple instances of the installation ==<br />
Please note from the start that we recommend installing a complete ConTeXt installation for each project in a production environment. The installation tree is portable (see Moving the Installation Around, below) and can be located under the project's own directory. The advantage is to allow each project to use an instance of ConTeXt that is adapted to its coding and that only gets updated purposely. Since the ConTeXt Standalone is "bleading edge" and subject to developement, certain details in commands, syntax or rendering may evolve slightly. Having a vintage ConTeXt tree for each production project insures that one can come back years later and produce identical results.<br />
<br />
So as not to get carried away under this approach, one can eventually group projects by vintage, period or season, according to cycles of productivity.<br />
<br />
== Standalone ==<br />
<br />
* [[ConTeXt Standalone/FAQ|Standalone/FAQ]] <br />
* [[ConTeXt Standalone/Structure|Standalone/Structure]] <br />
* [[ConTeXt Standalone/Implementation|Standalone/Implementation]]<br />
* [[ConTeXt Standalone/TODO|Standalone/TODO]] <br />
* [[ConTeXt Standalone/Contents|Standalone/Contents]] <br />
* [[ConTeXt Standalone/TeX Live|Standalone/TeX Live]]<br />
* Browse the [http://minimals.contextgarden.net installation tree]<br />
<br />
<br />
<br />
= Unix-like platforms (Linux/MacOS X/FreeBSD/Solaris) =<br />
<br />
For Mac installation see also [http://wiki.contextgarden.net/Mac_Installation Mac installation page].<br />
<br />
== Single user installation ==<br />
<br />
Select a folder where you want to install ConTeXt. We recommend that you can use your <code>$HOME/context</code> directory. Create this folder. Then download and place it in <code>$HOME/context</code> directory. Open a terminal, then:<br />
<br />
<pre><br />
mkdir ~/context<br />
cd ~/context<br />
wget http://minimals.contextgarden.net/setup/first-setup.sh<br />
<br />
# Install the latest beta of ConTeXt<br />
# This takes a long time, so go have a coffee<br />
# Flags you can add to the first-setup.sh call:<br />
# --modules=all # Install all third-party modules<br />
# --context=current # Install latest stable version<br />
# --engine=luatex # Install only MkIV, leave out MkII<br />
# # This shrinks the install from 270 MB to 200 MB<br />
<br />
sh ./first-setup.sh --modules=all<br />
</pre><br />
<br />
== System-wide installation ==<br />
<br />
A system wide installation is recommended for users who are comfortable with the command line. Only the location of installing ConTeXt is different for a system wide installation.<br />
<br />
* on Linux you can use <code>/opt/context</code><br />
* on MacOS X you can use <code>/Applications/ConTeXt</code><br />
<br />
Note that, at present, while ''using'' MkIV, you need to have write permissions for the <code>$TEXMFCACHE</code> directory. This effectively means that only one user will be able to generate the formats unless you set the group permissions appropriately.<br />
<br />
* <code>chmod -R g+w $TEXMFCACHE</code><br />
<br />
<pre><br />
# Create the /opt/context directory -- change as appropriate or desired if you <br />
# want a different installation directory.<br />
cd /opt<br />
mkdir context<br />
<br />
cd context<br />
<br />
# Fetch the install script<br />
wget http://minimals.contextgarden.net/setup/first-setup.sh<br />
<br />
# Install the latest beta of ConTeXt<br />
# This takes a long time, so go have a coffee<br />
# Flags you can add to the first-setup.sh call:<br />
# --modules=all # Install all third-party modules<br />
# --context=current # Install latest stable version<br />
# --engine=luatex # Install only MkIV, leave out MkII<br />
# # This shrinks the install from 270 MB to 200 MB<br />
<br />
sh ./first-setup.sh --modules=all<br />
<br />
# change ownership to real rather than effective id<br />
chown -R `id -r -u`:`id -r -g` .<br />
</pre><br />
<br />
===Cache===<br />
<br />
To customize the cache directory and other options, see the [[Custom_Configuration|Custom Configuration]] page.<br />
<br />
===Font Directory===<br />
<br />
Add the OSOFONTDIR into ./tex/setuptex. Go to under the line:<br />
<br />
# TODO: we could set OSFONTDIR on Mac for example<br />
<br />
(if you don't have the line above, go to the end of the file) and add there:<br />
<br />
export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts"<br />
<br />
For more information: [[Fonts in LuaTeX]]<br />
<br />
==Arch Linux==<br />
There’s a [http://aur.archlinux.org/packages.php?ID=30398 PKGBUILD] in<br />
the AUR, provided by Aditya [https://github.com/adityam/context-pkgbuild].<br />
Install it using your favorite AUR frontend, e.g.<br />
<br />
<pre><br />
yaourt -S context-minimals-git<br />
</pre><br />
<br />
This will get you a fresh, up-to-date Context tree in<br />
<tt>/opt/context-minimals</tt>.<br />
<br />
== The funtoo way ==<br />
<br />
If you are using [http://funtoo.org funtoo] there are ebuilds that will make an installation as easy as installing any other package from portage. Take a look at the [[ConTeXt Standalone Funtoo]] Howto. This might also work for [http://www.gentoo.org gentoo], but is untested right now.<br />
<br />
== Proxy settings ==<br />
<br />
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal or your startup script (<code>.bashrc</code> or the corresponding file for your shell). Replace username, password, proxyhost and proxyport with the correct information<br />
<br />
export RSYNC_PROXY=username:password@proxyhost:proxyport<br />
<br />
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).<br />
<br />
export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'<br />
<br />
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.<br />
<br />
== Usage ==<br />
<br />
ConTeXt suite works in a non-interfering manner because it does not put anything in your <code>$PATH</code> and does not set any system variables. This in turn means that in order to use it, you need to do some initialization. An intialization script called <code>setuptex</code> is provided in <code>installation-dir/tex/</code>. <br />
<br />
=== Terminal/Command line ===<br />
<br />
To run context from a terminal, source <code>setuptex</code>:<br />
<br />
source /installation-dir/tex/setuptex<br />
<br />
=== Exclusive usage ===<br />
<br />
If you always use ConTeXt suite and '''never''' use LaTeX or plain TeX provided by another TeX distribution, you can add the following line to the startup script of your shell (For bash, the startup script is <code>$HOME/.bashrc</code>; for zsh it is <code>HOME/.zshrc</code>).<br />
<br />
source /installation-dir/tex/setuptex<br />
<br />
Then <code>setuptex</code> will always be sourced in your terminal.<br />
<br />
=== Integrating with an editor ===<br />
<br />
The easiest way to run ConTeXt from an editor is to open a terminal, source {{code|setuptex}} in the terminal, and then open your editor '''from the same terminal'''. <br />
<br />
Another option is to add {{code|/installation-dir/tex/texmf-<platform>/bin}} to the {{code|$PATH}} that the editor searches. The details vary depending on the editor. See [[Text Editors]] for instructions on integrating ConTeXt with various editors. <br />
<br />
For information about configuring [http://smultron.sourceforge.net/ Smultron] and [http://www.uoregon.edu/~koch/texshop/obtaining.html TeXShop] (which are popular TeX editors on Mac) see [[ConTeXt Standalone/Mac Installation]].<br />
<br />
<br />
== Updating ==<br />
<br />
For updating the ConTeXt suite, <br />
first update <code>first-setup.sh</code>, then run it. You could<br />
also create an alias or a little script “ctx-update”<br />
with the following example contents:<br />
<pre><br />
cd /opt/context<br />
rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh .<br />
sh ./first-setup.sh --modules=all<br />
</pre><br />
<br />
== Uninstalling ==<br />
<br />
ConTeXt suite does not touch anything outside its installation folder. So to uninstall it, you can simply remove the installation folder.<br />
<br />
== Remaking formats ==<br />
<br />
Normally, the update script should create the formats for you. If for some reason you need to recreate the formats, you can do the following:<br />
<br />
* For making MKII format.<br />
<br />
mktexlsr<br />
texexec --make --all <br />
<br />
* For making XeTeX format<br />
<br />
mktexlsr<br />
texexec --make --xtx --all <br />
<br />
* For making MKIV format<br />
<br />
mtxrun --generate<br />
context --make<br />
<br />
= Windows =<br />
<br />
If you want to use ConTeXt suite alongside MikTeX/TeXLive (needed if you also run LaTeX), follow the command-line installation method. <br />
<br />
== Installation ==<br />
<br />
=== Command line method ===<br />
Download [http://minimals.contextgarden.net/setup/context-setup-mswin.zip context-setup-mswin.zip] or [http://minimals.contextgarden.net/setup/context-setup-win64.zip context-setup-win64.zip], and unzip to a directory where you want to install ConTeXt. It is recommended that you choose a directory that does not have a space in its full path. Then open <code>cmd.exe</code>, go to the installation directory and run<br />
<br />
first-setup.bat<br />
<br />
This takes a long time, so go have a coffee. <br />
<br />
By default, the suite installs ConTeXt beta. If you want the stable version of ConTeXt, you can use <br />
<br />
first-setup.bat --context=current<br />
<br />
By default, the suite does ''not'' install modules and other third party content. If you want the modules (and have the bandwidth), you can use<br />
<br />
first-setup.bat --modules=all<br />
<br />
<br />
If the above installation instructions don't seem to answer your questions, see page [[Windows_Installation:_ConTeXt_Suite_with_SciTe| Windows Installation: ConTeXt Suite with SciTe]] for more detailed information.<br />
<br />
<br />
== Proxy settings ==<br />
<br />
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal as (replace username, password, proxyhost and proxyport with the correct information)<br />
<br />
set RSYNC_PROXY=username:password@proxyhost:proxyport<br />
<br />
or set the variable permanently as a Windows environment variable.<br />
<br />
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).<br />
<br />
export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'<br />
<br />
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.<br />
<br />
== Usage ==<br />
<br />
Before running ConTeXt, you need to run <code>setuptex.bat</code> which is provided in <code>installation-dir\tex\</code>. This can be done by typing<br />
<br />
installation-dir\tex\setuptex.bat<br />
<br />
on cmd.exe before you run ConTeXt. To avoid always having to type this, you can create a shortcut to cmd.exe and edit the command line to read (assuming you installed the suite in <code>C:\Programs</code>; otherwise replace <code>C:\Programs\</code> with your installation directory)<br />
<br />
C:\WINDOWS\System32\cmd.exe /k C:\Programs\context\tex\setuptex.bat<br />
<br />
This starts up a new command shell with the environment pre-loaded. Within the new shell you can just type <code>context</code> to run ConTeXt. E.g.<br />
<br />
C:\> context --version<br />
<br />
to check that you are running the version you think you're running.<br />
<br />
=== Use ConTeXt with Cygwin ===<br />
After installing the ConTeXt suite, you can run it under Cygwin. With Cygwin, you may use gmake and other Unix tools for your automated workflow.<br />
<br />
# Run <code>setuptex.bat</code> in DOS command prompt<br />
# In the same DOS prompt, enter Cygwin by running <code>cygwin.bat</code> (in your Cygwin installation directory)<br />
# Under Cygwin prompt, run <code> context.cmd test.tex </code>. Note that the <code>.cmd</code> extension is needed under Cygwin.<br />
<br />
== Updating ==<br />
<br />
If you used the command line method, just run <code>first-setup.bat</code> again to update the suite.<br />
<br />
<br />
== Uninstallation ==<br />
<br />
If you used the command-line installer, you can just delete the installation directory to uninstall the suite.<br />
<br />
<br />
== Troubleshooting ==<br />
<br />
* rsync sometimes has problems with paths with uppercase letters (like <code>c:\Temp</code> or <code>C:\Documents and Settings</code>). Installing into all-lowercase paths without spaces sometimes helps.<br />
* Directory-name length may also have an effect, due to Windows's 8.3 filename conventions. An indicator is if running "texexec --lua" on a file produces missing-file warnings containing Windows-created 8-character directory names, such as "C:\CONTEX~1\tex", where your ConTeXt directory is really "C:\context_minimals\tex". Be conservative and choose a short name like "C:\ctm\tex". Also, this may even work when an 8-character-or-less directory name like "C:\ctexmin\tex" doesn't.<br />
* If you're behind firewall and rsync times out, you need to open port 873 for outgoing TCP connections.<br />
* If you update luaTeX occasionally you may get something like <br />
<br />
<code>engine mismatch (luv: This is LuaTeX, Version beta-<version>-<date1> (TeX Live 2013/dev)(rev <number1>) <> bin: This is LuaTeX, Version beta-<version>-<date1> (TeX Live 2012/W32TeX)(rev <number2>)), forcing remake</code><br />
<br />
In which case your format will be remade every time you compile a file. In /texmf-mswin make sure that luatex.exe and texlua.exe have the same date; then also delete luatex.dll. This usually solves the problem.<br />
<br />
= Installing third party modules =<br />
<br />
The ConTeXt suite only comes with Taco's [[Bibliography|t-bib]] module. If you want to install [http://modules.contextgarden.net/ a new module], say Wolfgang's [[Letter|t-letter]] module, you can use<br />
first-setup.sh --modules="t-letter"<br />
<br />
If you want to install more than one extra module, you can separate them by commas. So, to install the t-letter and t-mathsets module, do<br />
sh ./first-setup.sh --modules="t-letter,t-mathsets"<br />
<br />
If you want to install all extra modules at once, do<br />
sh ./first-setup.sh --modules=all<br />
<br />
= Reverting to an older installation =<br />
<br />
If, for some reason, you want to revert to an older installation, you can do that by<br />
<br />
sh ./first-setup.sh --context=date<br />
<br />
where <code>date</code> is the date of one of the stable releases of ConTeXt. The complete list of old releases that are available is [http://minimals.contextgarden.net/current/context/ here].<br />
<br />
<br />
= Moving the installation tree around = <br />
<br />
According to this post, http://archive.contextgarden.net/message/20101129.144331.d721372f.en.html it's safe to move the installation tree across directory or machines (say you don't have broadband access). You just have to clean and regenerate the cache (./tex/texmf-cache/luatex-cache) with <br />
mtxrun --generate<br />
<br />
= Notes =<br />
<references/><br />
<br />
{{Getting started navbox}}<br />
[[Category:Installation]]<br />
[[Category:Standalone]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=TABLE&diff=22996TABLE2015-12-02T16:55:01Z<p>Braslau: Added section on Row Offset/Gap</p>
<hr />
<div>< [[Tables Overview]] | [[XML]] ><br />
<br />
=Introduction=<br />
<br />
The preferred way to typeset tables is to use what are called &ldquo;natural tables&rdquo; (also known as &ldquo;automatic tables&rdquo; or &ldquo;HTML tables&rdquo;). They are especially suited for [[XML]] conversions. See the [[manual:enattab.pdf|enattab.pdf]] manual for many examples.<br />
<br />
To place a table use:<br />
<br />
<texcode><br />
\placetable{Caption}<br />
{\bTABLE<br />
\bTR \bTD One \eTD \bTD two \eTD \eTR<br />
\bTR \bTD One \eTD \bTD two \eTD \eTR<br />
\eTABLE}<br />
</texcode><br />
<br />
A more elaborate example:<br />
<br />
<context source=yes><br />
This is our red-coloured table.<br />
\setupcolors[state=start]<br />
<br />
\setupTABLE[row][odd][background=color,backgroundcolor=red, width=.2\textwidth]<br />
\bTABLE[split=yes] % allow splitting over page boundaries<br />
\bTR \bTD[nr=3] 1 \eTD \bTD[nc=2] 2/3 \eTD \bTD[nr=3] 4 \eTD \eTR<br />
\bTR \bTD 2 \eTD \bTD 3 \eTD \eTR<br />
\bTR \bTD 2 \eTD \bTD 3 \eTD \eTR<br />
\bTR \bTD[nc=3] 1/2/3 \eTD \bTD 4 \eTD \eTR<br />
\bTR \bTD 1 \eTD \bTD 2 \eTD \bTD 3 \eTD \bTD 4 \eTD \eTR<br />
\eTABLE<br />
</context><br />
<br />
Note that every element must use <tt>\b</tt> ... <tt>\e</tt>.<br />
<br />
Willi Egger wrote a [[My Way]] how he set a typesetter's lead type case: [http://dl.contextgarden.net/myway/NaturalTables.pdf Use of natural tables]<br />
<br />
= Multipage TABLEs =<br />
<br />
Try to divide your table into...<br />
* {{cmd|bTABLEhead}} (table header)<br />
* {{cmd|bTABLEnext}} (alternate table header on following pages)<br />
* {{cmd|bTABLEbody}} (table body)<br />
* {{cmd|bTABLEfoot}} (table footer)<br />
and {{cmd|setupTABLE}}<tt>[split=yes]</tt> or <tt>[split=repeat]</tt><br />
<br />
see also [[source:tabl-ntb.mkiv|tabl-ntb.mkiv]]<br />
<br />
If you must <b>split</b> a natural table over several pages, you can<br />
simply do this by adding <tt>\setupTABLE[split=yes]</tt> to your TABLE<br />
definition. Another way is to define it right at the TABLE start<br />
by adding the parameter <tt>[split=yes]</tt> (see example).<br />
However,<br />
{{cmd|startlinecorrection}}<br />
can lead to unpredictable vertical spaces between rows [http://archive.contextgarden.net/message/20100912.112605.8a1aaf13.en.html].<br />
<br />
In this case the <b>table head</b><br />
(all between {{cmd|bTABLEhead}} and {{cmd|eTABLEhead}})<br />
is printed only once at the beginning of the table. But if you use <tt>[split=repeat]</tt>,<br />
it is printed on top of every new page, that contains parts of<br />
your multipage table. Please take account of the fact, that the<br />
head cells are enclosed by {{cmd|bTH}} and {{cmd|eTH}} (and not \[be]TC).<br />
<br />
If you want to use an alternative table header for all following pages,<br />
you can do this by defining an additional header. Just add the second header<br />
between {{cmd|bTABLEnext}}...{{cmd|eTABLEnext}},<br />
right after your normal head definition.<br />
Now every additional page of the multipage table starts with the<br />
<b>next table head</b>.<br />
<br />
The <b>table foot</b> is declared between {{cmd|bTABLEfoot}} and<br />
{{cmd|eTABLEfoot}}. It defines the concluding row of your natural table.<br />
<br />
'''Beware:''' Split tables often begin not on the page (or in the column, if you use them) where they ''could'' start, but on/in the next one.<br />
This is a known limitation due to the complicated calculation of remaining space on the page.<br />
That won't become better before this calculations are newly written in Lua. (Said Hans on 2010-09-24.)<br />
<br />
The following standalone example deals with all the mentioned aspects of natural tables.<br />
Just <i>copy&paste</i> it as a starting point for further experiments...<br />
<br />
<texcode><br />
\starttext<br />
<br />
\setupcolors[state=start]<br />
<br />
% setup for all cells<br />
\setupTABLE[r][each][style=\tfx\it, align=center]<br />
<br />
% setup table head<br />
\setupTABLE[r][first]<br />
[background=color,<br />
backgroundcolor=yellow]<br />
% setup table footer<br />
\setupTABLE[r][last]<br />
[style=bold,<br />
background=color,<br />
backgroundcolor=green]<br />
<br />
\bTABLE[split=repeat,option=stretch]% head on every page, stretch columns<br />
%<br />
% IMPORTANT: use \bTH ... \eTH to enclose the head|next cells<br />
\bTABLEhead<br />
\bTR<br />
\bTH head1 \eTH<br />
\bTH head2 \eTH<br />
\bTH head3 \eTH<br />
\eTR<br />
\eTABLEhead<br />
% <br />
\bTABLEnext % setup for next table head<br />
\bTR [background=color,backgroundcolor=cyan]<br />
\bTH next1 \eTH<br />
\bTH next2 \eTH<br />
\bTH next3 \eTH<br />
\eTR<br />
\eTABLEnext<br />
%<br />
% the table body (main part)<br />
%<br />
\bTABLEbody<br />
%<br />
\dorecurse{100}{% 100 rows<br />
\bTR<br />
\bTC body body body body body \eTC<br />
\bTC body body body body body \eTC<br />
\bTC body body body body body \eTC<br />
\eTR<br />
}%<br />
%<br />
\eTABLEbody<br />
%<br />
% the table foot<br />
%<br />
\bTABLEfoot<br />
\bTR<br />
\bTC foot1 \eTC<br />
\bTC foot2 \eTC<br />
\bTC foot3 \eTC<br />
\eTR<br />
\eTABLEfoot<br />
%<br />
\eTABLE<br />
<br />
\stoptext<br />
</texcode><br />
<br />
= Tables in multiple columns =<br />
<br />
... just work (at least in luaTeX and not here...). See the following example.<br />
<br />
<texcode><br />
\starttext<br />
\startcolumns[n=3]<br />
\bTABLE<br />
\dorecurse{21}<br />
{\bTR \bTD a\eTD \bTD b \eTD \eTR}<br />
\eTABLE<br />
\stopcolumns<br />
\stoptext<br />
</texcode><br />
<br />
= Creating tables from CSV data (Comma Separated Values) =<br />
<br />
See also [[m-database|the database module]]!<br />
<br />
and [http://dl.contextgarden.net/myway/csv.pdf Creating Tables using CSV (Comma-separated values)] by Mojca Miklavec<br />
<br />
<br />
<!-- Maybe some other place or a separate page is more appropriate for this section --><br />
<br />
An interesting example of creating a table using comma separated values was posted to the [http://archive.contextgarden.net/message/20050923.193302.f2110c93.en.html mailing list] by [[User:ChristopherCreutzig|Christopher Creutzig]]<br />
<br />
The following macros take care of processing CSV data:<br />
<texcode><br />
% Iterate over all the lines of text captured with \obeylines active<br />
% command to call is first argument, is not called for empty lines<br />
\bgroup<br />
\obeylines<br />
\gdef\ProcessLines#1#2{\doProcessLines{#1}#2^^M\doProcessLines}%<br />
\gdef\doProcessLines#1#2^^M#3\doProcessLines{%<br />
\doifnotempty{#2}{#1{#2}}%<br />
\doifnotempty{#3}{\doProcessLines{#1}#3\doProcessLines}%<br />
}%<br />
\egroup<br />
<br />
\def\startCSV{\bgroup\obeylines\dostartCSV}<br />
</texcode><br />
<br />
The next lines are an example of transforming the data into a natural table, but can be easily adapted to any type of the table or perhaps (mis)used in even more strange ways:<br />
<br />
<texcode><br />
\def\TBLentry#1{\bTD#1\eTD}<br />
\def\TBLline#1{\bTR\processcommalist[#1]\TBLentry}<br />
<br />
\def\dostartCSV#1\stopCSV{%<br />
\bTABLE<br />
\ProcessLines\TBLline{#1}%<br />
\eTABLE<br />
\egroup<br />
}<br />
</texcode><br />
<br />
The following lines will then finally result in a desired table:<br />
<br />
<texcode><br />
% some additional settings for the table may be made as well<br />
\setupTABLE[c][2][style=\tt]<br />
\setupTABLE[c][3][align=middle]<br />
\setupTABLE[r][1][style=bold] % how to override the \tt in the second column?<br />
<br />
\startCSV<br />
Name,Email,Accepted<br />
\CONTEXT,worth@trying.to,Yes<br />
Hans,main@developer.of,Yes<br />
Bug,get@rid.of,No<br />
\stopCSV<br />
</texcode><br />
<br />
<context><br />
\setuppapersize[A5]<br />
<br />
% Iterate over all the lines of text captured with \obeylines active<br />
% command to call is first argument, is not called for empty lines<br />
\bgroup<br />
\obeylines<br />
\gdef\ProcessLines#1#2{\doProcessLines{#1}#2^^M\doProcessLines}%<br />
\gdef\doProcessLines#1#2^^M#3\doProcessLines{%<br />
\doifnotempty{#2}{#1{#2}}%<br />
\doifnotempty{#3}{\doProcessLines{#1}#3\doProcessLines}%<br />
}%<br />
\egroup<br />
<br />
\def\startCSV{\bgroup\obeylines\dostartCSV}<br />
<br />
\def\TBLentry#1{\bTD#1\eTD}<br />
\def\TBLline#1{\bTR\processcommalist[#1]\TBLentry}<br />
<br />
\def\dostartCSV#1\stopCSV{%<br />
\bTABLE<br />
\ProcessLines\TBLline{#1}%<br />
\eTABLE<br />
\egroup<br />
}<br />
<br />
\setupTABLE[c][2][style=\tt]<br />
\setupTABLE[c][3][align=middle]<br />
\setupTABLE[r][1][style={\rm\bf}]<br />
\startCSV<br />
Name,Email,Accepted<br />
\CONTEXT,worth@trying.to,Yes<br />
Hans,main@developer.of,Yes<br />
Bug,get@rid.of,No<br />
\stopCSV<br />
</context><br />
<br />
Some remarks: the (tentative) code ignores the fact that<br />
* csv data may optionally be enclosed in "" quotes that have to be removed (to be done in \TBLentry) <br />
* quoted strings may contain commas themselves (which means writing a custom version of \processcommalist instead).<br />
<br />
See also {{cmd|processseparatedlist}}.<br />
<br />
= Designing complex TABLEs =<br />
<br />
Everything is easy when a simple grid is enough. Unfortunately, this<br />
is not the case most of the time, tables tend to have information<br />
which should flow accross cell boundaries either vertically<br />
or horizontally. One of the reasons to use TABLE instead of the<br />
table environment is that TABLE provides an easy (relatively speaking, <br />
at least) way to make merged cells to both directions.<br />
<br />
There are probably as many ways to design TABLEs as there are<br />
users, but a simple one to begin with is to start with a<br />
grid:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setupTABLE[r][each][height=0.5cm]<br />
\setupTABLE[c][each][width=1cm]<br />
\bTABLE<br />
\bTR \bTD r1c1 \eTD \bTD r1c2 \eTD \bTD r1c3 \eTD \bTD r1c4 \eTD \bTD r1c5 \eTD \bTD r1c6 \eTD \eTR<br />
\bTR \bTD r2c1 \eTD \bTD r2c2 \eTD \bTD r2c3 \eTD \bTD r2c4 \eTD \bTD r2c5 \eTD \bTD r2c6 \eTD \eTR<br />
\bTR \bTD r3c1 \eTD \bTD r3c2 \eTD \bTD r3c3 \eTD \bTD r3c4 \eTD \bTD r3c5 \eTD \bTD r3c6 \eTD \eTR<br />
\bTR \bTD r4c1 \eTD \bTD r4c2 \eTD \bTD r4c3 \eTD \bTD r4c4 \eTD \bTD r4c5 \eTD \bTD r4c6 \eTD \eTR<br />
\bTR \bTD r5c1 \eTD \bTD r5c2 \eTD \bTD r5c3 \eTD \bTD r5c4 \eTD \bTD r5c5 \eTD \bTD r5c6 \eTD \eTR<br />
\bTR \bTD r6c1 \eTD \bTD r6c2 \eTD \bTD r6c3 \eTD \bTD r6c4 \eTD \bTD r6c5 \eTD \bTD r6c6 \eTD \eTR<br />
\eTABLE<br />
</context><br />
<br />
The desired table layout is then drawn onto this grid, and the top left corner cell<br />
of each cell in the final layout identified:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setupTABLE[r][each][height=0.5cm]<br />
\setupTABLE[c][each][width=1cm]<br />
\setupTABLE[r][1][height=0cm,frame=off]<br />
\bTABLE<br />
\bTR \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \eTR<br />
\bTR \bTD[nc=2,nr=2] r1c1 \eTD \bTD r1c3 \eTD \bTD[nr=2] r1c4 \eTD \bTD[nc=2,nr=2] r1c5 \eTD \eTR<br />
\bTR \bTD[nr=2] r2c3 \eTD \eTR<br />
\bTR \bTD[nc=2] r3c1 \eTD \bTD[nc=2] r3c4 \eTD \bTD r3c6 \eTD \eTR<br />
\bTR \bTD r4c1 \eTD \bTD[nc=2] r4c2 \eTD \bTD[nr=2] r4c4 \eTD \bTD[nc=2] r4c5 \eTD \eTR<br />
\bTR \bTD[nr=2,nc=2] r5c1 \eTD \bTD[nr=2] r5c3 \eTD \bTD[nr=2,nc=2] r5c5 \eTD \eTR<br />
\bTR \bTD r6c4 \eTD \eTR<br />
\eTABLE<br />
</context><br />
<br />
The cells are listed from left to right and up to down. Each larger cell is then given<br />
it size by using <tt>nc=...</tt> and <tt>nr=...</tt> parameters with <tt>\bTD</tt>. The<br />
code producing the table above is:<br />
<br />
<texcode><br />
\setupTABLE[r][each][height=1cm]<br />
\setupTABLE[c][each][width=1cm]<br />
\setupTABLE[r][1][height=0cm,frame=off]<br />
\bTABLE<br />
\bTR \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \eTR<br />
\bTR \bTD[nc=2,nr=2] r1c1 \eTD \bTD r1c3 \eTD \bTD[nr=2] r1c4 \eTD \bTD[nr=2,nc=2] r1c5 \eTD \eTR<br />
\bTR \bTD[nr=2] r2c3 \eTD \eTR<br />
\bTR \bTD[nc=2] r3c1 \eTD \bTD[nc=2] r3c4 \eTD \bTD r3c6 \eTD \eTR<br />
\bTR \bTD r4c1 \eTD \bTD[nc=2] r4c2 \eTD \bTD[nr=2] r4c4 \eTD \bTD[nc=2] r4c5 \eTD \eTR<br />
\bTR \bTD[nr=2,nc=2] r5c1 \eTD \bTD[nr=2] r5c3 \eTD \bTD[nr=2,nc=2] r5c5 \eTD \eTR<br />
\bTR \bTD r6c4 \eTD \eTR<br />
\eTABLE<br />
</texcode><br />
<br />
N.B. There is an ugly hack in the code. An empty first row with zero height and no borders<br />
is added. If the row is omitted, then something odd happens to the number of<br />
columns. The table should have all cells, so this may be a bug. (Or then I have<br />
blundered something with this example, possibly.)<br />
<br />
Everything rectangular can be done with TABLE, as long as it can be fit in the grid. The grid<br />
does not have to be equidistant, and if its dimensions are omitted, the program<br />
will fit the data in. L-shaped or other complex cell shapes are not possible.<br />
Using them would be a bit odd, in any case, as alignment and text flow problems<br />
would be quite interesting.<br />
<br />
<br />
== Cell Addressing and Frames ==<br />
<br />
The setup commands for TABLE do not seem to be very verbosedly commented.<br />
There are, however, a few shorthands, which are useful to understand.<br />
First of all, there are several ways to address cells. This is a brief<br />
summary of some of them:<br />
<br />
<texcode><br />
\setupTABLE[r][(list of rows)][...]<br />
\setupTABLE[c][(list of columns)][...]<br />
\setupTABLE[(list of columns)][(list of rows)][...]<br />
</texcode><br />
<br />
A list contains one or more numbers separated by commas.<br />
Word "last" is equivalent to the number of the last row or<br />
column. The complete list can be replaced by the word "each"<br />
to address all cells on the row/column.<br />
<br />
Let us consider the following table:<br />
<br />
<texcode><br />
\setupTABLE[c][each][align={middle,lohi},frame=off]<br />
\setupTABLE[r][2,3,4,5,6][height=1.0cm]<br />
\setupTABLE[r][2,4][topframe=on]<br />
\setupTABLE[c][1,2,3][rightframe=on]<br />
...<br />
</texcode><br />
<br />
In plain language the rows are interpreted as follows:<br />
<br />
* Align each cell in each column (i.e. all cells) horizontally in the middle<br />
and vertically in the middle (lohi), and remove all frames (borders)<br />
* The height of rows 2 -- 6 is 1.0 cm<br />
* Draw a line on top of rows 2 and 4<br />
* Draw a line to the right side of columns 1 -- 3<br />
<br />
In this case the table is slightly complicated, there are some split cells,<br />
as shown below:<br />
<br />
<table><tr valign="top"><td><br />
<texcode><br />
\bTABLE<br />
\bTR<br />
\bTD \bf r1c1 \eTD<br />
\bTD \bf r1c2 \eTD<br />
\bTD \bf r1c3 \eTD<br />
\bTD \bf r1c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r2c1 \eTD<br />
\bTD r2c2 \eTD<br />
\bTD[nr=2] r2c3 \eTD<br />
\bTD r2c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r3c1 \eTD<br />
\bTD r3c2 \eTD<br />
\bTD r3c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r4c1 \eTD<br />
\bTD r4c2 \eTD<br />
\bTD[nr=3] r4c3 \eTD<br />
\bTD[nr=3] r4c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r5c1 \eTD<br />
\bTD r5c2 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r6c1 \eTD<br />
\bTD r6c2 \eTD<br />
\eTR<br />
\eTABLE<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setupTABLE[c][each][align={middle,lohi},frame=off]<br />
\setupTABLE[r][2,3,4,5,6][height=0.5cm]<br />
\setupTABLE[r][2,4][topframe=on]<br />
\setupTABLE[c][1,2,3][rightframe=on]<br />
\bTABLE<br />
\bTR<br />
\bTD \bf r1c1 \eTD<br />
\bTD \bf r1c2 \eTD<br />
\bTD \bf r1c3 \eTD<br />
\bTD \bf r1c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r2c1 \eTD<br />
\bTD r2c2 \eTD<br />
\bTD[nr=2] r2c3 \eTD<br />
\bTD r2c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r3c1 \eTD<br />
\bTD r3c2 \eTD<br />
\bTD r3c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r4c1 \eTD<br />
\bTD r4c2 \eTD<br />
\bTD[nr=3] r4c3 \eTD<br />
\bTD[nr=3] r4c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r5c1 \eTD<br />
\bTD r5c2 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r6c1 \eTD<br />
\bTD r6c2 \eTD<br />
\eTR<br />
\eTABLE<br />
</context><br />
</td></tr></table><br />
<br />
The cell numbering is well worth noting. It is very logical (upper<br />
leftmost part of a combined cell), but sometimes the results are<br />
surprising in the beginning.<br />
<br />
The important point about cell numbering is that there is really<br />
a difference between "bottom border of row 3" and "top border of<br />
row 4". To illustrate this, let us change the frame setups:<br />
<br />
<texcode><br />
\setupTABLE[r][2,4][topframe=on]<br />
</texcode><br />
<br />
is changed to<br />
<br />
<texcode><br />
\setupTABLE[r][1,3][bottomframe=on]<br />
</texcode><br />
<br />
At first sight this is exactly the same thing. But...<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setupTABLE[c][each][align={middle,lohi},frame=off]<br />
\setupTABLE[r][2,3,4,5,6][height=0.5cm]<br />
\setupTABLE[r][1,3][bottomframe=on]<br />
\setupTABLE[c][1,2,3][rightframe=on]<br />
\bTABLE<br />
\bTR<br />
\bTD \bf r1c1 \eTD<br />
\bTD \bf r1c2 \eTD<br />
\bTD \bf r1c3 \eTD<br />
\bTD \bf r1c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r2c1 \eTD<br />
\bTD r2c2 \eTD<br />
\bTD[nr=2] r2c3 \eTD<br />
\bTD r2c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r3c1 \eTD<br />
\bTD r3c2 \eTD<br />
\bTD r3c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r4c1 \eTD<br />
\bTD r4c2 \eTD<br />
\bTD[nr=3] r4c3 \eTD<br />
\bTD[nr=3] r4c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r5c1 \eTD<br />
\bTD r5c2 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r6c1 \eTD<br />
\bTD r6c2 \eTD<br />
\eTR<br />
\eTABLE<br />
</context><br />
<br />
Where did the horizontal line in column 3 disappear? Nowhere. There is no<br />
row 3 in column 3, so there cannot be a frame under it. This problem<br />
can be overcome by using topframe and leftframe instead of bottom and<br />
right, as the cells below and to the right of a border have to exist.<br />
<br />
However, this solution leaves the problem of bottom and rightmost borders.<br />
How to draw a line in the bottom of the table? Using <br />
<tt>\setupTABLE[r][6][bottomframe=on]</tt> will leave the gap in columns 3 and 4, <br />
and <tt>\setupTABLE[r][7][topframe=on]</tt> is not possible, as there is no <br />
row 7. The clever idea of using "last" instead of the row number (6) will fail, <br />
as "last" seems to behave exactly the same way as number 6.<br />
<br />
One useful method is to switch on the borders cell by<br />
cell by adding <tt>\setupTABLE[3,4][4][bottomframe=on]</tt>, i.e.<br />
draw a border under cells r4c3 and r4c4.<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setupTABLE[c][each][align={middle,lohi},frame=off]<br />
\setupTABLE[r][2,3,4,5,6][height=0.5cm]<br />
\setupTABLE[r][2,4][topframe=on]<br />
\setupTABLE[c][1,2,3][rightframe=on]<br />
\setupTABLE[r][6][bottomframe=on]<br />
\setupTABLE[3,4][4][bottomframe=on]<br />
\bTABLE<br />
\bTR<br />
\bTD \bf r1c1 \eTD<br />
\bTD \bf r1c2 \eTD<br />
\bTD \bf r1c3 \eTD<br />
\bTD \bf r1c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r2c1 \eTD<br />
\bTD r2c2 \eTD<br />
\bTD[nr=2] r2c3 \eTD<br />
\bTD r2c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r3c1 \eTD<br />
\bTD r3c2 \eTD<br />
\bTD r3c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r4c1 \eTD<br />
\bTD r4c2 \eTD<br />
\bTD[nr=3] r4c3 \eTD<br />
\bTD[nr=3] r4c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r5c1 \eTD<br />
\bTD r5c2 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r6c1 \eTD<br />
\bTD r6c2 \eTD<br />
\eTR<br />
\eTABLE<br />
</context><br />
<br />
== Column Offset/Gap ==<br />
<br />
From the mailing list at 2005-11-09 by Vit Zyka, modified by Hans Hagen:<br />
<br />
<texcode><br />
\starttext<br />
<br />
% distance mechanism, per column (H)<br />
<br />
\start<br />
\setupTABLE[c][1][distance=2em]<br />
\setupTABLE[c][2][distance=3em]<br />
<br />
\bTABLE<br />
\bTR \bTD test \eTD \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD[nx=2] test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD[nx=2] test \eTD \eTR<br />
\eTABLE<br />
<br />
\bTABLE[option=stretch]<br />
\bTR \bTD test \eTD \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD[nx=2] test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD[nx=2] test \eTD \eTR<br />
\eTABLE<br />
\stop<br />
<br />
% distance mechanism, per table (V)<br />
<br />
\framed[offset=none]{%<br />
\setupTABLE[column][2][align=left]<br />
\setupTABLE[column][3][align=right]<br />
\bTABLE[columndistance=2cm,leftmargindistance=.3cm,rightmargindistance=.5cm]<br />
\bTR<br />
\bTH[nc=3] Table head\eTH<br />
\eTR<br />
\bTR\bTD[nc=2] AB\eTD\bTD C\eTD\eTR<br />
\bTR\bTD[nc=2,align=left] AB\eTD\bTD C\eTD\eTR<br />
\bTR\bTD[nc=2,align=middle] AB\eTD\bTD C\eTD\eTR<br />
\bTR\bTD A\eTD\bTD B\eTD\bTD C\eTD\eTR<br />
\bTR\bTD Aa\eTD\bTD Bb\eTD\bTD Cccc\eTD\eTR<br />
\bTR\bTD[nc=3,align=middle] ABC\eTD\eTR<br />
\eTABLE<br />
}<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== Row Offset/Gap ==<br />
<br />
Rows, just like columns, can be drawn with a gap.<br />
As above, this can be achieved using:<br />
<texcode><br />
\bTABLE[spaceinbetween=2cm]<br />
...<br />
\eTABLE<br />
</texcode><br />
<br />
A gap differs from an offset as can be seen when drawing<br />
cells using a background and/or a frame.<br />
<br />
Note that offsets can be uniform <tt>[offset=dimension]</tt>,<br />
or asymmetric<br />
<tt>[toffset=dimension,boffset=dimension,loffset=dimension,roffset=dimension]</tt><br />
<br />
=== Gaps for individual cells ===<br />
<br />
One might want to produce gaps between specific rows and/or specific columns.<br />
This can be achieved using a white frame, for example,<br />
as shown in the following (incomplete) fragment:<br />
<br />
<texcode><br />
\bTABLE[frame=off,columndistance=.5em]<br />
...<br />
\bTR[topframe=on,framecolor=white,rulethickness=.5em]<br />
...<br />
\eTR<br />
...<br />
\eTABLE<br />
</texcode><br />
<br />
Note that the <tt>rulethickness</tt> was set for the particular row<br />
and not for the entire table; otherwise, it would enter into the<br />
calculation of the cell dimensions (and interplay with other parameters<br />
such as <tt>columndistance</tt>).<br />
<br />
More complicated situations, for example, mixing frames, colored cell backgrounds, special gaps, ..., can be achieved using MetaPost graphics as a <tt>background</tt>.<br />
<br />
== Make a cell bold ==<br />
<br />
Drawing bold lines around a cell is done using the<br />
<tt>[rulethickness=''dim'']</tt> key on a cell. The thicker rules will<br />
offset the text inside the cell both downwards and sideways, so care<br />
should be taken that the cell's increased rulethickness is offset by an<br />
equal decrease in offset.<br />
<br />
<context source="yes" text="produces"><br />
\setupTABLE[row][each][rulethickness=.25pt,offset=\dimexpr1mm+1.75pt] <br />
\bTABLE<br />
\bTR \bTD 1 \eTD \bTD 1 \eTD \bTD 2/3 \eTD \eTR<br />
\bTR \bTD 2 \eTD \bTD 2 \eTD \bTD 3 \eTD \eTR<br />
\bTR \bTD 2 \eTD \bTD[rulethickness=2pt,offset=1mm] 2 \eTD \bTD 3 \eTD \eTR<br />
\bTR \bTD 1 \eTD \bTD 1 \eTD \bTD 4 \eTD \eTR<br />
\bTR \bTD 1 \eTD \bTD 1 \eTD \bTD 2 \eTD \eTR<br />
\eTABLE<br />
</context><br />
<br />
== Rules ==<br />
<br />
=== Example: an invoice with thick rules ===<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
{\bfa Invoice}<br />
\switchtobodyfont[6pt]<br />
\blank<br />
\bTABLE<br />
\setupTABLE[frame=off,offset=1mm]<br />
\setupTABLE[row][*][height=7.25mm]<br />
\setupTABLE[column][1,2] [width=20mm,offset=\dimexpr1mm+2pt,align=flushleft]<br />
\setupTABLE[column][3,4,5][width=20mm,offset=\dimexpr1mm+2pt,align=flushright]<br />
\bTR[bottomframe=on, rulethickness=2pt,offset=1mm]<br />
\bTD\bf Date \eTD<br />
\bTD\bf Description \eTD<br />
\bTD\bf Quantity \eTD<br />
\bTD\bf Price \eTD<br />
\bTD\bf Total \eTD<br />
\eTR<br />
\bTR[bottomframe=on,rulethickness=.25pt]<br />
\bTD 05-01-2010 \eTD<br />
\bTD Element 1 \eTD<br />
\bTD 10.0 \eTD<br />
\bTD 6.00 \eTD<br />
\bTD 60.00 \eTD<br />
\eTR<br />
\bTR[bottomframe=on,rulethickness=.25pt]<br />
\bTD 05-01-2010 \eTD<br />
\bTD Element 2 \eTD<br />
\bTD 2.0 \eTD<br />
\bTD 3.00 \eTD<br />
\bTD 6.00 \eTD<br />
\eTR<br />
\bTR[topframe=on,rulethickness=2pt,offset=1mm]<br />
\bTD[nx=3] \eTD<br />
\bTD[align=flushleft] Subtotal \eTD<br />
\bTD 66.00 \eTD<br />
\eTR<br />
\bTR[offset=\dimexpr1mm+2pt]<br />
\bTD[nx=3] \eTD<br />
\bTD[align=flushleft] VAT 19\% \eTD<br />
\bTD 12.54 \eTD<br />
\eTR<br />
\bTR<br />
\bTD[nx=3] \eTD<br />
\bTD[align=flushleft] \bf Total \eTD<br />
\bTD 78.54 \eTD<br />
\eTR<br />
\eTABLE<br />
</context><br />
<br />
=== Rules with different thickness ===<br />
<br />
There is only one value for all four borders. However, MetaPost can be used as a workaround until the separate "rulethickness" values are implemented.<br />
<br />
The following example (mkiv only!) by Wolfgang Schuster shows a table using MetaPost for the rules:<br />
<br />
<context source=yes mode=mkiv text="gives:"><br />
\startuseMPgraphic{tableborders}<br />
<br />
draw leftboundary OverlayBox withpen pensquare scaled \frameddimension {leftrulethickness} ;<br />
draw rightboundary OverlayBox withpen pensquare scaled \frameddimension {rightrulethickness} ;<br />
draw topboundary OverlayBox withpen pensquare scaled \frameddimension {toprulethickness} ;<br />
draw bottomboundary OverlayBox withpen pensquare scaled \frameddimension{bottomrulethickness} ;<br />
<br />
clip currentpicture to OverlayBox<br />
leftenlarged (\frameddimension {leftrulethickness}/2)<br />
rightenlarged (\frameddimension {rightrulethickness}/2)<br />
topenlarged (\frameddimension {toprulethickness}/2)<br />
bottomenlarged (\frameddimension{bottomrulethickness}/2) ;<br />
<br />
setbounds currentpicture to OverlayBox ;<br />
<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[tableborders][\useMPgraphic{tableborders}]<br />
<br />
\startsetups tableborders<br />
<br />
\setupTABLE<br />
[ background={color,tableborders},<br />
frame=off,<br />
backgroundoffset=0pt,<br />
leftrulethickness=\framedparameter{rulethickness},<br />
rightrulethickness=\framedparameter{rulethickness},<br />
toprulethickness=\framedparameter{rulethickness},<br />
bottomrulethickness=\framedparameter{rulethickness}]<br />
<br />
\setupTABLE[row] [odd] [backgroundcolor=lightgray]<br />
\setupTABLE[row] [first][backgroundcolor=gray,bottomrulethickness=2pt]<br />
\setupTABLE[row] [last] [toprulethickness=2pt,bottomrulethickness=2pt]<br />
\setupTABLE[first][last] [leftrulethickness=2pt]<br />
\setupTABLE[last] [last] [rightrulethickness=2pt]<br />
<br />
\stopsetups<br />
<br />
\starttext<br />
<br />
\bTABLE<br />
\dorecurse{7}{\bTR\dorecurse{3}{\bTD#1-##1\eTD}\eTR}<br />
\eTABLE<br />
<br />
\blank<br />
<br />
\bTABLE[setups=tableborders]<br />
\dorecurse{7}{\bTR\dorecurse{3}{\bTD#1-##1\eTD}\eTR}<br />
\eTABLE<br />
<br />
\stoptext<br />
</context><br />
<br />
See the corresponding thread on the list: [http://www.ntg.nl/pipermail/ntg-context/2011/058549.html rules with different thickness]<br />
<br />
=== Thick bottom rules ===<br />
<br />
This is a simplified version of the example above (corresponding mailing thread - [http://www.ntg.nl/pipermail/ntg-context/2012/069541.html TABLE: header with a thick bottom line]).<br />
<br />
<context source=yes mode=mkiv text="Gives:"><br />
\startuseMPgraphic{MP:thickBtm}<br />
draw bottomboundary OverlayBox withpen pensquare scaled \frameddimension{bottomrulethickness};<br />
clip currentpicture to OverlayBox;<br />
setbounds currentpicture to OverlayBox;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[OL:thickBtm][\useMPgraphic{MP:thickBtm}]<br />
<br />
\starttext<br />
\bTABLE<br />
\setupTABLE[align=middle]<br />
\setupTABLE[header][background={OL:thickBtm},bottomrulethickness=4pt]<br />
\setupTABLE[row][4][background={OL:thickBtm},bottomrulethickness=2pt]<br />
%<br />
\bTABLEhead\bTR\dorecurse{3}{\bTH#1\eTH}\eTR\eTABLEhead<br />
\bTABLEbody\dorecurse{6}{\bTR\dorecurse{3}{\bTD#1-##1\eTD}\eTR}\eTABLEbody<br />
\eTABLE<br />
\stoptext<br />
</context><br />
<br />
=== Diagonal rules ===<br />
<br />
Sometimes a diagonal rule is required in the top left corner cell of a table to create two fields, one for the left column and one for the top row.<br />
<br />
<br />
<context mode="mkiv" source="yes" text="Gives:"><br />
\startuseMPgraphic{DiagonalRule}<br />
rulethickness := \frameddimension{rulethickness};<br />
<br />
drawoptions(<br />
withpen pencircle scaled rulethickness<br />
withcolor \MPcolor{\framedparameter{framecolor}});<br />
<br />
pair leftcorner, rightcorner;<br />
leftcorner := (rulethickness, \overlayheight-rulethickness);<br />
rightcorner := (\overlaywidth-rulethickness, rulethickness);<br />
<br />
draw leftcorner -- rightcorner;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay<br />
[DiagonalRule]<br />
[\useMPgraphic{DiagonalRule}]<br />
<br />
\define[2]\DiagonalLabel{%<br />
\setuptabulate [after={\blank[\frameddimension{offset}]}]<br />
\starttabulate [|p|r|]<br />
\NC \NC #2 \NC\NR<br />
\NC #1 \NC \NC\NR<br />
\stoptabulate<br />
}<br />
<br />
\starttext<br />
\setupTABLE [row] [1] [width=2cm]<br />
\bTABLE<br />
\bTR<br />
\bTD [background=DiagonalRule]<br />
\DiagonalLabel{Foo}{Bar}<br />
\eTD<br />
\bTD Second \eTD<br />
\bTD Third \eTD<br />
\eTR<br />
\bTR<br />
\bTD Alpha \eTD<br />
\bTD Beta \eTD<br />
\bTD Gamma \eTD<br />
\eTR<br />
\eTABLE<br />
\stoptext<br />
</context><br />
<br />
This solution has (at least) one caveat: Because the first<br />
tabulate column is set in paragraph mode, it will eat up as much<br />
space as <em>possible</em>, in contrast to occupying as much space as<br />
</em>necessary</em>. That is why the width of the column has to be set<br />
explicitly.<br />
<br />
== Using character alignment ==<br />
<br />
ConTeXt can align columns of numbers on a character (often a decimal point to align accounting data) automatically, removing the need to add fixed spaces into your document. For any such column you need to specify the character on which to align. You use the <tt>aligncharacter=yes</tt> parameter to set up character alignment, <tt>alignmentcharacter={.}</tt> to say what the character should be (in this case a full stop) and <tt>align=middle</tt> to set the overall alignment of the column.<br />
<br />
<table><tr valign="top"><td><br />
<texcode><br />
\bTABLE<br />
\setupTABLE[column][1][align=right]<br />
\setupTABLE[column][2][alignmentcharacter={.},<br />
aligncharacter=yes,align=middle]<br />
\bTR \bTH Category \eTH \bTH Data entry \eTH \eTR<br />
\bTR \bTD First \eTD \bTD 71.3 \eTD \eTR<br />
\bTR \bTD Second \eTD \bTD 43.7 \eTD \eTR<br />
\bTR \bTD Total \eTD \bTD 115 \eTD \eTR<br />
\eTABLE<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\bTABLE<br />
\setupTABLE[column][1][align=right]<br />
\setupTABLE[column][2][alignmentcharacter={.},aligncharacter=yes,align=middle]<br />
\bTR \bTH Category \eTH \bTH Data entry \eTH \eTR<br />
\bTR \bTD First \eTD \bTD 71.3 \eTD \eTR<br />
\bTR \bTD Second \eTD \bTD 43.7 \eTD \eTR<br />
\bTR \bTD Total \eTD \bTD 115 \eTD \eTR<br />
\eTABLE<br />
</context><br />
</td></tr></table><br />
<br />
You'll note that the final line, because it has no <code>.</code> in the number, gets aligned under the right-hand side of the numbers. In most circumstances you would want such a number aligned with the left-hand set of digits. To so do, issue the following command in your preamble:<br />
<br />
<texcode><br />
\chardef\characteralignmentmode=2<br />
</texcode><br />
<br />
and now the table above will turn out like this:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\chardef\characteralignmentmode=2<br />
\bTABLE<br />
\setupTABLE[column][1][align=right]<br />
\setupTABLE[column][2][alignmentcharacter={.},aligncharacter=yes,align=middle]<br />
\bTR \bTH Category \eTH \bTH Data entry \eTH \eTR<br />
\bTR \bTD First \eTD \bTD 71.3 \eTD \eTR<br />
\bTR \bTD Second \eTD \bTD 43.7 \eTD \eTR<br />
\bTR \bTD Total \eTD \bTD 115 \eTD \eTR<br />
\eTABLE<br />
</context><br />
<br />
If there's no <code>alignmentcharacter</code> in the cell, the content will be aligned in the following way depending on the value of <code>\characteralignmentmode</code>:<br />
<table style="border:1px solid #DDDDDD;"><br />
<tr style="background-color:#DDDDDD; font-weight: bold;"><td>mode</td><td width="200"></td><td>.</td><td width="200"></td></tr><br />
<tr><td style="background-color:#DDDDDD" align="center">0</td><td colspan="3" align="center">centered</td></tr><br />
<tr style="background-color:#EEEEEE;"><td style="background-color:#DDDDDD" align="center">1</td><td align="left">left in before</td><td style="background-color:#DDDDDD">.</td><td></td></tr><br />
<tr><td style="background-color:#DDDDDD" align="center">2</td><td align="right">right in before</td><td style="background-color:#DDDDDD">.</td><td></td></tr><br />
<tr style="background-color:#EEEEEE;"><td style="background-color:#DDDDDD" align="center">3</td><td></td><td style="background-color:#DDDDDD">.</td><td align="left">left in after</td></tr><br />
<tr><td style="background-color:#DDDDDD" align="center">4</td><td></td><td style="background-color:#DDDDDD">.</td><td align="right">right in after</td></tr><br />
</table><br />
<br />
=== Character alignment methods ===<br />
MkIV (starting in late June 2014) offers two methods for character alignment. The first, "number", attempts to identify the number from preceding and trailing text, align the number on the separator and separately vertically align preceding or trailing text by paddind in-between the number and the preceding/trailing text. This looks very nice when the preceding or trailing text is all of the same width (for example, a currency symbol or % sign), but will mis-align if the preceding or trailing text has varying widths. Number mode is the default for most separators, but can be forced by specifying <code>alignmentcharacter={number->-}</code>.<br />
<br />
Note that the below examples will not render properly until the wiki supports this feature; this file shows the expected output. [[File:character_alignment_methods_example.pdf]]<br />
<br />
<context source="yes" mode="mkiv"><br />
% mode=mkiv<br />
\setuppapersize[A5]<br />
\bTABLE<br />
\setupTABLE[c][1,2,3,4][alignmentcharacter={number->.},aligncharacter=yes,align=middle]<br />
\bTABLEhead<br />
\bTR<br />
\bTH Same-Width Prefix \eTH \bTH Varying-Width Prefix \eTH<br />
\bTH Same-Width Suffix \eTH \bTH Varying-Width Suffix \eTH<br />
\eTR<br />
\eTABLEhead<br />
\bTABLEbody<br />
\bTR \bTD \$1.00 \eTD \bTD \$1.00 \eTD \bTD 1.00\% \eTD \bTD 1.00\% \eTD \eTR<br />
\bTR \bTD \$10.00 \eTD \bTD \$\$10.00 \eTD \bTD 10.00\% \eTD \bTD 10.00\%\% \eTD \eTR<br />
\bTR \bTD \$1.0 \eTD \bTD \$1.0 \eTD \bTD 1.0\% \eTD \bTD 1.0\% \eTD \eTR<br />
\bTR \bTD \$10.0 \eTD \bTD \$\$10.0 \eTD \bTD 10.0\% \eTD \bTD 10.0\%\% \eTD \eTR<br />
\eTABLEbody<br />
\eTABLE<br />
</context><br />
<br />
In the above example the "varying-width" columns do not align on the alignment character. For these cases the "text" method is provided. The logic simpler&mdash;it does not attempt to pad space in-between the number and any preceding or trailing text, so the text will always align on the alignment character, but forgoes the attempt to vertically align preceding and trailing text. This is the default mode for the "-" separator, but can be forced by specifying <code>alignmentcharacter={text->.}</code>. The below example shows that all four columns align on the ".", but the "$" and "%" are no longer stacked.<br />
<br />
<context source="yes" mode="mkiv"><br />
% mode=mkiv<br />
\setuppapersize[A5]<br />
\bTABLE<br />
\setupTABLE[c][1,2,3,4][alignmentcharacter={text->.},aligncharacter=yes,align=middle]<br />
\bTABLEhead<br />
\bTR<br />
\bTH Same-Width Prefix \eTH \bTH Varying-Width Prefix \eTH<br />
\bTH Same-Width Suffix \eTH \bTH Varying-Width Suffix \eTH<br />
\eTR<br />
\eTABLEhead<br />
\bTABLEbody<br />
\bTR \bTD \$1.00 \eTD \bTD \$1.00 \eTD \bTD 1.00\% \eTD \bTD 1.00\% \eTD \eTR<br />
\bTR \bTD \$10.00 \eTD \bTD \$\$10.00 \eTD \bTD 10.00\% \eTD \bTD 10.00\%\% \eTD \eTR<br />
\bTR \bTD \$1.0 \eTD \bTD \$1.0 \eTD \bTD 1.0\% \eTD \bTD 1.0\% \eTD \eTR<br />
\bTR \bTD \$10.0 \eTD \bTD \$\$10.0 \eTD \bTD 10.0\% \eTD \bTD 10.0\%\% \eTD \eTR<br />
\eTABLEbody<br />
\eTABLE<br />
</context><br />
<br />
Entering <code>\nocharacteralign</code> disables character alignment in a cell.<br />
<br />
== Specifying the cell column ==<br />
<br />
When writing a table you can omit empty cells and define only cells for specified columns. To have this feature fully available you need to have a beta or a quite fresh ConTeXt version.<br />
<br />
Two methods are available:<br />
<br />
* With the TD "n" option, the undefined cells are merged into a single spanned cell.<br />
* With the TD "m" option, the undefined cells appear as empty normal cells.<br />
<br />
Here is an example using the "n" option:<br />
<br />
<context source=yes><br />
\setuppapersize[A5]<br />
\bTABLE[width=3em]<br />
\bTR\bTD d1 \eTD\bTD[n=2] d2 \eTD\bTD[n=5] d5 \eTD\bTD[n=7] d7 \eTD\eTR<br />
\bTR\bTD f1 \eTD\bTD[n=4] f4 \eTD\bTD[n=5] f5 \eTD\bTD[n=7] f7 \eTD\eTR<br />
\eTABLE<br />
</context><br />
<br />
Here is an example using the "m" option:<br />
<br />
<context source=yes><br />
\setuppapersize[A5]<br />
\bTABLE[width=3em]<br />
\bTR\bTD d1 \eTD\bTD[m=2] d2 \eTD\bTD[m=5] d5 \eTD\bTD[m=7] d7 \eTD\eTR<br />
\bTR\bTD f1 \eTD\bTD[m=4] f4 \eTD\bTD[m=5] f5 \eTD\bTD[m=7] f7 \eTD\eTR<br />
\eTABLE<br />
</context><br />
<br />
== Round corners ==<br />
<br />
For a different approach for round corners and colored background follow the text after this example.<br />
<br />
It is possible to round the corners of the table if you turn off the main frame of the table and frame the table in {{cmd|framed}}. Compare two different approaches in the first and second example.<br />
<br />
You can't color the background of the table with round corners unless the frame rulethickness is not big enough to cover the rectangular corners of the background (second example). Well, you can if you frame the table twice. Once in the thick white frame and then in the thin frame with negative offset and slightly smaller corner radius (third example). Be aware of other complications -- notice that the thick white frame is still visible in the text above it.<br />
<br />
<context source="yes"><br />
\starttext<br />
\setupcolors[state=start] <br />
%\showstruts<br />
\setupTABLE[background=color,backgroundcolor=yellow]<br />
\setupframed[framecolor=darkgreen]<br />
<br />
\defineparagraphs[ThreeCols]<br />
<br />
\startThreeCols<br />
<br />
First<br />
<br />
\def\StartTable<br />
{\setupTABLE[row] [first][topframe=off]%<br />
\setupTABLE[row] [last] [bottomframe=off]%<br />
\setupTABLE[column][first][leftframe=off]%<br />
\setupTABLE[column][last] [rightframe=off]%<br />
\framed[strut=no,corner=round,offset=.5\linewidth]<br />
\bgroup}<br />
<br />
\def\StopTable<br />
{\egroup}<br />
<br />
\StartTable<br />
\bTABLE<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\eTABLE<br />
\StopTable<br />
<br />
\nextThreeCols<br />
<br />
Second<br />
<br />
\setupTABLE[row] [first][topframe=off]<br />
\setupTABLE[row] [last] [bottomframe=off]<br />
\setupTABLE[column][first][leftframe=off]<br />
\setupTABLE[column][last] [rightframe=off]<br />
\framed[strut=no,corner=round,offset=.5\linewidth,,rulethickness=1mm]\bgroup<br />
\bTABLE<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\eTABLE<br />
\egroup<br />
<br />
\nextThreeCols<br />
<br />
Third<br />
<br />
\setupTABLE[row] [first][topframe=off]<br />
\setupTABLE[row] [last] [bottomframe=off]<br />
\setupTABLE[column][first][leftframe=off]<br />
\setupTABLE[column][last] [rightframe=off]<br />
\framed[strut=no,corner=round,<br />
radius=1.4mm,offset=-1mm,,rulethickness=.1mm]\bgroup<br />
\framed[strut=no,corner=round,<br />
radius=1.5mm,offset=0mm,,rulethickness=1mm,framecolor=white]\bgroup<br />
\bTABLE<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\eTABLE<br />
\egroup<br />
\egroup<br />
<br />
\stopThreeCols<br />
<br />
\stoptext<br />
</context><br />
<br />
From 2006-10-11 on, ConTeXt contains one more mechanism for round corners. Watch the example:<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\starttext<br />
\setupcolors[state=start]<br />
\setupTABLE [y] [first][background=color,backgroundcolor=blue,frame=off,bottomframe=on,topframe=on,framecolor=white]<br />
\setupTABLE [first][first][backgroundcorner=2,corner=10,frame=on]<br />
\setupTABLE [last] [first][backgroundcorner=4,corner=12,frame=on]<br />
\setupTABLE [row] [each] [background=color,backgroundcolor=blue,frame=on,framecolor=white]<br />
\setupTABLE [first][2] [corner=8]<br />
\setupTABLE [last] [2] [corner=5]<br />
\setupTABLE [first][last] [corner=7]<br />
\setupTABLE [last] [last] [corner=6]<br />
<br />
\bTABLE[frame=off,align=middle]<br />
\bTR \bTD one \eTD \bTD two \eTD \bTD three \eTD \eTR<br />
\bTR \bTD first \eTD \bTD second \eTD \bTD third \eTD \eTR<br />
\bTR \bTD alpha \eTD \bTD beta \eTD \bTD gamma \eTD \eTR<br />
\eTABLE<br />
\stoptext<br />
</context><br />
<br />
== Other options ==<br />
<br />
Some other useful options that were not covered above:<br />
* <tt>align=yes</tt> will align the text both left and right justified<br />
* <tt>loffset</tt>, <tt>roffset</tt>, <tt>toffset</tt>, <tt>boffset</tt> can be used in addition to <tt>offset</tt> to specify cell content offsets in each direction separately, see also {{cmd|framed}}<br />
<br />
= TABLEs with old table syntax =<br />
<br />
From the mailing list in March 2009, by Wolfgang Schuster and Hans Hagen:<br />
<br />
<texcode><br />
\def\startTABLE<br />
{\dosingleempty\dostartTABLE}<br />
<br />
\def\dostartTABLE[#1]%<br />
{\bgroup<br />
\bTABLE[#1]%<br />
\let\NC\doTABLENC<br />
\let\NR\doTABLENR<br />
\let\bTR\relax<br />
\let\bTD\relax<br />
\let\bTH\relax<br />
\let\bTN\relax}<br />
<br />
\def\stopTABLE<br />
{\eTABLE<br />
\egroup}<br />
<br />
\newconditional\inTABLEnc<br />
<br />
\unexpanded\def\doTABLENR<br />
{\eTR<br />
\setfalse\inTABLEnc}<br />
<br />
\unexpanded\def\doTABLENC<br />
{\futurelet\next\dodoTABLENC}<br />
<br />
\def\dodoTABLENC<br />
{\ifx\next\doTABLENR \else<br />
\expandafter\dododoTABLENC<br />
\fi}<br />
<br />
\long\def\dododoTABLENC#1\NC<br />
{\ifconditional\inTABLEnc\else\settrue\inTABLEnc\parseTR[][]\fi<br />
\dodoubleempty\parseTD#1\eTD\NC}<br />
</texcode><br />
<br />
This is now part of the core as the [[source:tabl-nte.tex|NTE module]]. Quoting its internal documentation:<br />
<br />
This module is suggested by Wolfgang Schuster who also prototyped it and came up with the rationale:<br />
<br />
This module provides an easy way to use natural in a similiar way as the older table module (based on the [[TABLE]] macros) and the newer [[tabulate]] module.<br />
<br />
You can see the advantage in the following table, once created with the new macros and once with the normal macros provided with the natural table module.<br />
<br />
Let us start with the original macros:<br />
<br />
<texcode><br />
\bTABLE<br />
\bTR<br />
\bTD Text 1 \eTD<br />
\bTD Text 2 \eTD<br />
\eTR<br />
\bTR<br />
\bTD Text 3 \pasteeTD<br />
\bTD Text 4 \eTD<br />
\eTR<br />
\eTABLE<br />
</texcode><br />
<br />
Watch how the new macros use less code:<br />
<br />
<texcode><br />
\startTABLE<br />
\NC Text 1 \NC Text 2 \NC\NR<br />
\NC Text 3 \NC Text 4 \NC\NR<br />
\stopTABLE<br />
</texcode><br />
<br />
The actual code differs from the prototype that it does not need to collect whole rows and parse them but looks ahead instead.<br />
<br />
= Get current row/column number =<br />
See for example here: [[Command/currentTABLErow]]<br />
<br />
[[Category:Tables]]<br />
[[Category:XML]]<br />
tt>\bTD<br />
<br />
= An alignment issue =<br />
<br />
In some cases the alignment of cell contents may not behave as you might expect. Here is an illustrative example. The following code<br />
<br />
<context source=yes mode=mkiv text="gives us:"><br />
\define[3]\Glyphbox<br />
{\framed[frame=on,align=middle]\bgroup<br />
#1\\<br />
#2\\<br />
#3%<br />
\egroup}<br />
<br />
\starttext<br />
\setupTABLE[frame=on,align=middle]<br />
\bTABLE<br />
\bTR \bTD \Glyphbox{I}{a}{1} \eTD <br />
\bTD \Glyphbox{I}{a}{1} \eTD <br />
\eTR<br />
\bTR \bTD \Glyphbox{III}{aaa}{111} \eTD<br />
\bTD \Glyphbox{III}{aaa}{111} \eTD<br />
\eTR<br />
\eTABLE<br />
\stoptext <br />
</context><br />
<br />
Note that in the first row the cells are not middle-aligned. As Wolfgang Schuster pointed out on the list, we need *two* things to fix this:<br />
<br />
1. You need <tt>\dontleavehmode</tt> in front of the <tt>\framed</tt>.<br />
<br />
2. You need <tt>\setupTABLE[start][..,..=..,..]</tt> because <tt>\bTABLE</tt> sets a default value for the align key which can’t be overwritten with a simple <tt>\setupTABLE[..,..=..,..]</tt>.<br />
<br />
Implementing this <context source=yes mode=mkiv text="we now get the following correct output with centered cells in the first row:"><br />
\define[3]\Glyphbox<br />
{\dontleavehmode<br />
\framed[frame=on,align=middle]\bgroup<br />
#1\\<br />
#2\\<br />
#3%<br />
\egroup}<br />
<br />
\starttext<br />
\setupTABLE[start][frame=on,align=middle]<br />
\bTABLE<br />
\bTR \bTD \Glyphbox{I}{a}{1} \eTD <br />
\bTD \Glyphbox{I}{a}{1} \eTD <br />
\eTR<br />
\bTR \bTD \Glyphbox{III}{aaa}{111} \eTD<br />
\bTD \Glyphbox{III}{aaa}{111} \eTD<br />
\eTR<br />
\eTABLE<br />
\stoptext <br />
</context></div>Braslauhttps://wiki.contextgarden.net/index.php?title=ConTeXt_Standalone&diff=22994ConTeXt Standalone2015-11-03T01:13:56Z<p>Braslau: added note about not distributing kfreebsd binaries.</p>
<hr />
<div>{{Installation navbox}}<br />
<br />
The '''ConTeXt suite''' is a complete, up-to-date ConTeXt distribution that can be upgraded efficiently. It can also be used in parallel with existing TeX installations such as MikTeX, TeXLive, and so forth. The suite does not include LaTeX packages and binaries.<br />
<br />
Sometimes ConTeXt beta releases have issues. The ConTeXt suite allows you to test the latest ConTeXt release without worrying whether upgrading will corrupt a critical project. Multiple ConTeXt suite installations are possible. This allows, for example, a stable version and a beta version to run in parallel on the same computer.<br />
<br />
ConTeXt is also included in TeXlive. The ConTeXt suite is updated continuously, whereas ConTeXt in TeXlive is updated less often. In particular, <code>luatex</code> and <code>metapost</code> are under active development and their binaries are updated frequently. ConTeXt follows these developments, indeed often drives development. As the binaries included in the TeXlive distribution are only updated yearly, ConTeXt on TeXlive will necessarily be less current than the ConTeXt suite. (ConTeXt on TeXlive can be kept somewhat more current using the http://tlcontrib.metatex.org repository.) The ConTeXt suite is self-contained and can happily coexist alongside another installed TeX distribution.<br />
<br />
{{TOClimit|limit=1}}<br />
<br />
= General Information =<br />
<br />
== Supported platforms ==<br />
<br />
{| style="border:1px solid #DDDDDD;"<br />
|- align="left" <br />
! Platform<br />
! Short name<br />
! Binaries by<br />
! Notes<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Windows<br />
| mswin<br />
| Akira Kakuto ([http://w32tex.org W32TeX])<br />
|<br />
|- align="left"<br />
! Linux<br />
| linux<br />
| Hans Hagen, Mojca Miklavec, Alan Braslau<br />
| compiled with glibc 2.3.6<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Linux, 64-bit<br />
| linux-64<br />
| Alan Braslau<br />
|<br />
|- align="left"<br />
! Linux, PowerPC<br />
| linux-ppc<br />
| Piotr Kopszak<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Linux, Arm (low end.)<br />
| linux-armel<br />
| Boris Veytsman<br />
| in progress<br />
|- align="left"<br />
! Mac OS X, Intel (32-bit)<br />
| osx-intel<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Mac OS X, Intel (64-bit)<br />
| osx-64<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left"<br />
! Mac OS X, PowerPC<br />
| osx-ppc<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Mac OS X, Universal Binaries<br />
| osx-universal<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left"<br />
! FreeBSD<br />
| freebsd<br />
| Alan Braslau<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! FreeBSD, 64-bit<br />
| freebsd-amd64<br />
| Alan Braslau<br />
| <br />
|- align="left"<br />
! kFreeBSD<br />
| kfreebsd-i386<br />
| Alan Braslau<br />
| FreeBSD + glibc (Debian)*<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! kFreeBSD, 64-bit<br />
| kfreebsd-amd64<br />
| Alan Braslau<br />
| FreeBSD + glibc (Debian)*<br />
|- align="left"<br />
! Solaris, Intel<br />
| solaris-intel<br />
| Marco Patzer<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Solaris, Sparc<br />
| solaris-sparc<br />
| Mojca Miklavec<br />
| Solaris 10 on [http://www.opencsw.org/about/ OpenCSW]<br />
|}<br />
<br />
*Note: we have stopped distributing binaries for kfreebsd. However, this system is still supported, and natively-compiled binaries can be installed from the Debian distribution.<br />
<br />
We need volunteers for providing binaries for other platforms. If you want to support a platform, please write to [[ConTeXt Mailing Lists]]<br />
<br />
== Dependencies ==<br />
* [http://www.ruby-lang.org Ruby] 1.8 or newer (used for MKII)<br />
* Rsync (The windows binary of rsync is distributed within the suite)<br />
<br />
<br />
The following programs are not required for running ConTeXt, but their installation adds additional functionality.<br />
<br />
* curl : for including remote content<br />
* ghostscript : for converting PostScript images to PDF<br />
* graphicsmagick (convert) : for converting GIF and TIFF images<br />
* inkscape : for converting SVG and compressed SVG<br />
* mupdf (mudraw) : for converting PDF to PNG (used for ePub covers)<br />
* pstoedit : for converting PostScript to MetaPost outlines<br />
* zint : for providing barcodes<br />
* zip or 7zip : for EPUB generation<br />
<br />
== Disc space required ==<br />
ConTeXt macro files are small (less than 10MB), but the suite comes with various free fonts which considerably increase the size of the distribution to around 200MB).<br />
<br />
== Standalone ==<br />
<br />
* [[ConTeXt Standalone/FAQ|Standalone/FAQ]] <br />
* [[ConTeXt Standalone/Structure|Standalone/Structure]] <br />
* [[ConTeXt Standalone/Implementation|Standalone/Implementation]]<br />
* [[ConTeXt Standalone/TODO|Standalone/TODO]] <br />
* [[ConTeXt Standalone/Contents|Standalone/Contents]] <br />
* [[ConTeXt Standalone/TeX Live|Standalone/TeX Live]]<br />
* Browse the [http://minimals.contextgarden.net installation tree]<br />
<br />
<br />
<br />
= Unix-like platforms (Linux/MacOS X/FreeBSD/Solaris) =<br />
<br />
For Mac installation see also [http://wiki.contextgarden.net/Mac_Installation Mac installation page].<br />
<br />
== Single user installation ==<br />
<br />
Select a folder where you want to install ConTeXt. We recommend that you can use your <code>$HOME/context</code> directory. Create this folder. Then download and place it in <code>$HOME/context</code> directory. Open a terminal, then:<br />
<br />
<pre><br />
mkdir ~/context<br />
cd ~/context<br />
wget http://minimals.contextgarden.net/setup/first-setup.sh<br />
<br />
# Install the latest beta of ConTeXt<br />
# This takes a long time, so go have a coffee<br />
# Flags you can add to the first-setup.sh call:<br />
# --modules=all # Install all third-party modules<br />
# --context=current # Install latest stable version<br />
# --engine=luatex # Install only MkIV, leave out MkII<br />
# # This shrinks the install from 270 MB to 200 MB<br />
<br />
sh ./first-setup.sh --modules=all<br />
</pre><br />
<br />
== System-wide installation ==<br />
<br />
A system wide installation is recommended for users who are comfortable with the command line. Only the location of installing ConTeXt is different for a system wide installation.<br />
<br />
* on Linux you can use <code>/opt/context</code><br />
* on MacOS X you can use <code>/Applications/ConTeXt</code><br />
<br />
Note that, at present, while ''using'' MkIV, you need to have write permissions for the <code>$TEXMFCACHE</code> directory. This effectively means that only one user will be able to generate the formats.<br />
<br />
<pre><br />
# Create the /opt/context directory -- change as appropriate or desired if you <br />
# want a different installation directory.<br />
cd /opt<br />
mkdir context<br />
<br />
# change ownership<br />
chown `whoami`:`whoami` context<br />
cd context<br />
<br />
# Fetch the install script<br />
wget http://minimals.contextgarden.net/setup/first-setup.sh<br />
<br />
# Install the latest beta of ConTeXt<br />
# This takes a long time, so go have a coffee<br />
# Flags you can add to the first-setup.sh call:<br />
# --modules=all # Install all third-party modules<br />
# --context=current # Install latest stable version<br />
# --engine=luatex # Install only MkIV, leave out MkII<br />
# # This shrinks the install from 270 MB to 200 MB<br />
<br />
sh ./first-setup.sh --modules=all<br />
<br />
</pre><br />
<br />
===Cache===<br />
<br />
To customize the cache directory and other options, see the [[Custom_Configuration|Custom Configuration]] page.<br />
<br />
===Font Directory===<br />
<br />
Add the OSOFONTDIR into ./tex/setuptex. Go to under the line:<br />
<br />
# TODO: we could set OSFONTDIR on Mac for example<br />
<br />
(if you don't have the line above, go to the end of the file) and add there:<br />
<br />
export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts"<br />
<br />
For more information: [[Fonts in LuaTeX]]<br />
<br />
==Arch Linux==<br />
There’s a [http://aur.archlinux.org/packages.php?ID=30398 PKGBUILD] in<br />
the AUR, provided by Aditya [https://github.com/adityam/context-pkgbuild].<br />
Install it using your favorite AUR frontend, e.g.<br />
<br />
<pre><br />
yaourt -S context-minimals-git<br />
</pre><br />
<br />
This will get you a fresh, up-to-date Context tree in<br />
<tt>/opt/context-minimals</tt>.<br />
<br />
== The funtoo way ==<br />
<br />
If you are using [http://funtoo.org funtoo] there are ebuilds that will make an installation as easy as installing any other package from portage. Take a look at the [[ConTeXt Standalone Funtoo]] Howto. This might also work for [http://www.gentoo.org gentoo], but is untested right now.<br />
<br />
== Proxy settings ==<br />
<br />
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal or your startup script (<code>.bashrc</code> or the corresponding file for your shell). Replace username, password, proxyhost and proxyport with the correct information<br />
<br />
export RSYNC_PROXY=username:password@proxyhost:proxyport<br />
<br />
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).<br />
<br />
export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'<br />
<br />
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.<br />
<br />
== Usage ==<br />
<br />
ConTeXt suite works in a non-interfering manner because it does not put anything in your <code>$PATH</code> and does not set any system variables. This in turn means that in order to use it, you need to do some initialization. An intialization script called <code>setuptex</code> is provided in <code>installation-dir/tex/</code>. <br />
<br />
=== Terminal/Command line ===<br />
<br />
To run context from a terminal, source <code>setuptex</code>:<br />
<br />
source /installation-dir/tex/setuptex<br />
<br />
=== Exclusive usage ===<br />
<br />
If you always use ConTeXt suite and '''never''' use LaTeX or plain TeX provided by another TeX distribution, you can add the following line to the startup script of your shell (For bash, the startup script is <code>$HOME/.bashrc</code>; for zsh it is <code>HOME/.zshrc</code>).<br />
<br />
source /installation-dir/tex/setuptex<br />
<br />
Then <code>setuptex</code> will always be sourced in your terminal.<br />
<br />
=== Integrating with an editor ===<br />
<br />
The easiest way to run ConTeXt from an editor is to open a terminal, source {{code|setuptex}} in the terminal, and then open your editor '''from the same terminal'''. <br />
<br />
Another option is to add {{code|/installation-dir/tex/texmf-<platform>/bin}} to the {{code|$PATH}} that the editor searches. The details vary depending on the editor. See [[Text Editors]] for instructions on integrating ConTeXt with various editors. <br />
<br />
For information about configuring [http://smultron.sourceforge.net/ Smultron] and [http://www.uoregon.edu/~koch/texshop/obtaining.html TeXShop] (which are popular TeX editors on Mac) see [[ConTeXt Standalone/Mac Installation]].<br />
<br />
<br />
== Updating ==<br />
<br />
For updating the ConTeXt suite, <br />
first update <code>first-setup.sh</code>, then run it. You could<br />
also create an alias or a little script “ctx-update”<br />
with the following example contents:<br />
<pre><br />
cd /opt/context<br />
rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh .<br />
sh ./first-setup.sh --modules=all<br />
</pre><br />
<br />
== Uninstalling ==<br />
<br />
ConTeXt suite does not touch anything outside its installation folder. So to uninstall it, you can simply remove the installation folder.<br />
<br />
== Remaking formats ==<br />
<br />
Normally, the update script should create the formats for you. If for some reason you need to recreate the formats, you can do the following:<br />
<br />
* For making MKII format.<br />
<br />
mktexlsr<br />
texexec --make --all <br />
<br />
* For making XeTeX format<br />
<br />
mktexlsr<br />
texexec --make --xtx --all <br />
<br />
* For making MKIV format<br />
<br />
mtxrun --generate<br />
context --make<br />
<br />
= Windows =<br />
<br />
If you want to use ConTeXt suite alongside MikTeX/TeXLive (needed if you also run LaTeX), follow the command-line installation method. <br />
<br />
== Installation ==<br />
<br />
=== Command line method ===<br />
Download [http://minimals.contextgarden.net/setup/context-setup-mswin.zip context-setup-mswin.zip] or [http://minimals.contextgarden.net/setup/context-setup-win64.zip context-setup-win64.zip], and unzip to a directory where you want to install ConTeXt. It is recommended that you choose a directory that does not have a space in its full path. Then open <code>cmd.exe</code>, go to the installation directory and run<br />
<br />
first-setup.bat<br />
<br />
This takes a long time, so go have a coffee. <br />
<br />
By default, the suite installs ConTeXt beta. If you want the stable version of ConTeXt, you can use <br />
<br />
first-setup.bat --context=current<br />
<br />
By default, the suite does ''not'' install modules and other third party content. If you want the modules (and have the bandwidth), you can use<br />
<br />
first-setup.bat --modules=all<br />
<br />
<br />
If the above installation instructions don't seem to answer your questions, see page [[Windows_Installation:_ConTeXt_Suite_with_SciTe| Windows Installation: ConTeXt Suite with SciTe]] for more detailed information.<br />
<br />
<br />
== Proxy settings ==<br />
<br />
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal as (replace username, password, proxyhost and proxyport with the correct information)<br />
<br />
set RSYNC_PROXY=username:password@proxyhost:proxyport<br />
<br />
or set the variable permanently as a Windows environment variable.<br />
<br />
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).<br />
<br />
export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'<br />
<br />
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.<br />
<br />
== Usage ==<br />
<br />
Before running ConTeXt, you need to run <code>setuptex.bat</code> which is provided in <code>installation-dir\tex\</code>. This can be done by typing<br />
<br />
installation-dir\tex\setuptex.bat<br />
<br />
on cmd.exe before you run ConTeXt. To avoid always having to type this, you can create a shortcut to cmd.exe and edit the command line to read (assuming you installed the suite in <code>C:\Programs</code>; otherwise replace <code>C:\Programs\</code> with your installation directory)<br />
<br />
C:\WINDOWS\System32\cmd.exe /k C:\Programs\context\tex\setuptex.bat<br />
<br />
This starts up a new command shell with the environment pre-loaded. Within the new shell you can just type <code>context</code> to run ConTeXt. E.g.<br />
<br />
C:\> context --version<br />
<br />
to check that you are running the version you think you're running.<br />
<br />
=== Use ConTeXt with Cygwin ===<br />
After installing the ConTeXt suite, you can run it under Cygwin. With Cygwin, you may use gmake and other Unix tools for your automated workflow.<br />
<br />
# Run <code>setuptex.bat</code> in DOS command prompt<br />
# In the same DOS prompt, enter Cygwin by running <code>cygwin.bat</code> (in your Cygwin installation directory)<br />
# Under Cygwin prompt, run <code> context.cmd test.tex </code>. Note that the <code>.cmd</code> extension is needed under Cygwin.<br />
<br />
== Updating ==<br />
<br />
If you used the command line method, just run <code>first-setup.bat</code> again to update the suite.<br />
<br />
<br />
== Uninstallation ==<br />
<br />
If you used the command-line installer, you can just delete the installation directory to uninstall the suite.<br />
<br />
<br />
== Troubleshooting ==<br />
<br />
* rsync sometimes has problems with paths with uppercase letters (like <code>c:\Temp</code> or <code>C:\Documents and Settings</code>). Installing into all-lowercase paths without spaces sometimes helps.<br />
* Directory-name length may also have an effect, due to Windows's 8.3 filename conventions. An indicator is if running "texexec --lua" on a file produces missing-file warnings containing Windows-created 8-character directory names, such as "C:\CONTEX~1\tex", where your ConTeXt directory is really "C:\context_minimals\tex". Be conservative and choose a short name like "C:\ctm\tex". Also, this may even work when an 8-character-or-less directory name like "C:\ctexmin\tex" doesn't.<br />
* If you're behind firewall and rsync times out, you need to open port 873 for outgoing TCP connections.<br />
* If you update luaTeX occasionally you may get something like <br />
<br />
<code>engine mismatch (luv: This is LuaTeX, Version beta-<version>-<date1> (TeX Live 2013/dev)(rev <number1>) <> bin: This is LuaTeX, Version beta-<version>-<date1> (TeX Live 2012/W32TeX)(rev <number2>)), forcing remake</code><br />
<br />
In which case your format will be remade every time you compile a file. In /texmf-mswin make sure that luatex.exe and texlua.exe have the same date; then also delete luatex.dll. This usually solves the problem.<br />
<br />
= Installing third party modules =<br />
<br />
The ConTeXt suite only comes with Taco's [[Bibliography|t-bib]] module. If you want to install [http://modules.contextgarden.net/ a new module], say Wolfgang's [[Letter|t-letter]] module, you can use<br />
first-setup.sh --modules="t-letter"<br />
<br />
If you want to install more than one extra module, you can separate them by commas. So, to install the t-letter and t-mathsets module, do<br />
sh ./first-setup.sh --modules="t-letter,t-mathsets"<br />
<br />
If you want to install all extra modules at once, do<br />
sh ./first-setup.sh --modules=all<br />
<br />
= Reverting to an older installation =<br />
<br />
If, for some reason, you want to revert to an older installation, you can do that by<br />
<br />
sh ./first-setup.sh --context=date<br />
<br />
where <code>date</code> is the date of one of the stable releases of ConTeXt. The complete list of old releases that are available is [http://minimals.contextgarden.net/current/context/ here].<br />
<br />
<br />
= Moving the installation tree around = <br />
<br />
According to this post, http://archive.contextgarden.net/message/20101129.144331.d721372f.en.html it's safe to move the installation tree across directory or machines (say you don't have broadband access). You just have to clean and regenerate the cache (./tex/texmf-cache/luatex-cache) with <br />
mtxrun --generate<br />
<br />
= Notes =<br />
<references/><br />
<br />
{{Getting started navbox}}<br />
[[Category:Installation]]<br />
[[Category:Standalone]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Tabulate&diff=22767Tabulate2015-03-21T21:02:48Z<p>Braslau: modified \HL -> \FL and \LL for headers</p>
<hr />
<div>< [[Tables Overview]] | [[Table]] ><br />
<br />
<br />
=Summary=<br />
<br />
{{cmd|starttabulate}} is a versatile table environment.<br />
It supports ''paragraphs'' in cells, ''vertical rules'' (for<br />
those typographically less demanding jobs&nbsp;…), and<br />
''colorization'' of those rules, the background of fields as well<br />
as the text itself.<br />
<br />
'''Warning''': When you want to use tables with macros use \starttable and \stoptable. \starttabulate and \stoptabulate does not work correctly with macros.<br />
<br />
=Basic commands=<br />
<br />
The control sequence <tt>\starttabulate[#1]</tt> takes a layout<br />
string as optional argument.<br />
As is common with tables in TeX-based typesetting, this string<br />
(in its basic variant) consists primarily of the ''bar''<br />
character (“<tt>|</tt>”) as delimiter for columns,<br />
and of the letters <tt>c</tt>, <tt>l</tt>, as well as <tt>r</tt>,<br />
denoting the ''alignment'' within cells of this row.<br />
<br />
For instance consider a two-column table: if any text in the<br />
first column should be right aligned (''real''<br />
[[right and left|<tt>flushright</tt>]]) and the second column<br />
left aligned, the corresponding format string would be<br />
<tt>|l|r|</tt>.<br />
''NB'': those bars, as stated above, denote cell limits only<br />
&ndash; ''not'' vertical lines.<br />
<br />
<!--<br />
- wtf this listing was full of <tab> chars‽ Was this supposed<br />
- to be a bad pun on *tabulate*?<br />
- - No, I formatted it readably in my text editor. --HR<br />
--><br />
{|<br />
! width="55%"|<br />
! width="10%"|<br />
! width="35%"|<br />
|-<br />
| <texcode><br />
\starttabulate[|r|l|lB|]<br />
\HL<br />
\NC {\bf format} \NC {\bf meaning} \NC Mk \NC\NR<br />
\HL<br />
\NC c \NC centered \NC \NC\NR<br />
\NC l \NC left aligned \NC \NC\NR<br />
\NC r \NC right aligned \NC \NC\NR<br />
\NC w(1cm) \NC one line, fixed width \NC \NC\NR<br />
\NC p(2cm) \NC paragraph, lines broken to fixed width \NC \NC\NR<br />
\NC cg(.) \NC align on a character \NC IV: cg{.} \NC\NR<br />
\NC m \NC math mode \NC IV only \NC\NR<br />
\NC b \NC before e.g. b{\star} \NC IV only \NC\NR<br />
\NC a \NC after, e.g. a{\percent} \NC IV only \NC\NR<br />
\HL<br />
\stoptabulate<br />
</texcode><br />
|<br />
|<context><br />
\setuppapersize[A5]<br />
\starttabulate[|r|l|lB|]<br />
\HL<br />
\NC {\bf format} \NC {\bf meaning}\NC Mk \NC\NR<br />
\HL<br />
\NC c \NC centered \NC\NR<br />
\NC l \NC left aligned \NC\NR<br />
\NC r \NC right aligned \NC\NR<br />
\NC w(1cm) \NC one line, fixed width \NC\NR<br />
\NC p(2cm) \NC paragraph, lines broken to fixed width \NC\NR<br />
\NC cg(.) \NC align on a character \NC\NR<br />
\HL<br />
\stoptabulate<br />
</context><br />
|}<br />
<br />
* <tt>HL</tt> draws a horizontal rule,<br />
* <tt>NC</tt> marks a new column (or new cell),<br />
* <tt>NN</tt> marks a new math column/cell (see below),<br />
* <tt>NR</tt> starts a new row,<br />
* <tt>NB</tt> starts a new row as a block (avoids page breaking inside of a block, to keep some lines together; available since beta of 2011-12-21);<br />
* <tt>TB</tt> (= "Table Blank") adds some vertical space between rows -- see an example bellow.<br />
<br />
<br />
When using fixed width, you can use values relative to the<br />
current page-width. For example: if you want the previous table<br />
take up all the width and having the second column taking three<br />
quarters of the space, change the starttabulate to:<br />
<texcode><br />
\starttabulate[|rw(.25\textwidth)|lw(.75\textwidth)|]<br />
</texcode><br />
<br />
=Horizontal centering table on the page=<br />
<br />
(Solution from the mailing list)<br />
<br />
<context source=yes><br />
This is a very long text, longer than the width of the table.<br />
It must be long enough to flow to the next line to see the effect.<br />
<br />
\placetable[force,none]{}{%<br />
\starttabulate[|r|l|]<br />
\HL<br />
\NC I want this table \NC aligned in the center.\NC\NR<br />
\HL<br />
\stoptabulate<br />
}</context><br />
<br />
This can also be done with the start/stop syntax (showing only source here, since it does not compile on the wiki):<br />
<br />
<context source=yes><br />
This is a very long text, longer than the width of the table.<br />
It must be long enough to flow to the next line to see the effect.<br />
<br />
\startplacetable[location=force,number=no]<br />
\starttabulate[|r|l|]<br />
\HL<br />
\NC I want this table \NC aligned in the center.\NC\NR<br />
\HL<br />
\stoptabulate<br />
\stopplacetable<br />
</context><br />
<br />
=Spanning Multiple Pages=<br />
<br />
Tabulate may extend to adjacient pages if needed.<br />
To achieve this the argument <tt>split</tt> must be set to<br />
''true''.<br />
''NB'': the difference between setting and unsetting this<br />
argument may not be visible on the first few pages. Rather, it<br />
seems to affect the ''end'' of the environment.<br />
<br />
<context source=yes><br />
\setuppapersize[A10, landscape][A8, landscape]<br />
\setuppaper[nx=2,ny=2]<br />
\setuparranging[XY]<br />
<br />
\switchtobodyfont[5pt]<br />
\setuppagenumbering[location={header,inright}]<br />
\showframe[edge]<br />
<br />
\setuptabulate<br />
[split=yes,<br />
header=text,<br />
title={\color[red] Fenchurch St. Paul},<br />
frame=on]<br />
<br />
\starttabulate[|p(1.2cm)|p(1.2cm)|]<br />
\dorecurse{6}{<br />
\NC Bells: \NC Tin tan din dan bim bam bom bo \NC\NR<br />
\HL<br />
\NC Name: \NC Tailor Paul \NC \NR <br />
\HL<br />
}<br />
\stoptabulate<br />
</context><br />
<br />
<br />
==Titles==<br />
<br />
A tabulating environment can have an optional name which will be<br />
repeated above at every page break that occurs inside the table.<br />
This name needs to be specified as the argument of the<br />
<tt>title</tt> key of <tt>\setuptabulate</tt>.<br />
The <tt>header</tt> key has to be set to <em>text</em> for this<br />
to work.<br />
<br />
<context source=yes><br />
\setuppapersize[A10, landscape][A8, landscape]<br />
\setuppaper[nx=2,ny=2]<br />
\setuparranging[XY]<br />
<br />
\switchtobodyfont[5pt]<br />
\setuppagenumbering[location={header,inright}]<br />
\showframe[edge]<br />
<br />
\setuptabulate<br />
[split=yes,<br />
header=text,<br />
title={\color[red] Fenchurch St. Paul},<br />
frame=on]<br />
<br />
\starttabulate[|p(1.2cm)|p(1.2cm)|]<br />
\dorecurse{6}{<br />
\NC Bells: \NC Tin tan din dan bim bam bom bo \NC\NR<br />
\HL<br />
\NC Name: \NC Tailor Paul \NC \NR <br />
\HL<br />
}<br />
\stoptabulate<br />
</context><br />
<br />
<!--<br />
- ==Headers and Footers==<br />
- As I couldn’t get footers running I just comment this and<br />
- leave it to whoever discovers the trick to activate them.<br />
- (The <tt>footer=</tt> key seems to be implemented for<br />
- “\setuptabulate” but I couldn’t notice any effect.<br />
--><br />
<br />
==Headers==<br />
Tabulate supports header rows that can be repeated over new table<br />
pages instead of the title.<br />
There is a separate environment <tt>\starttablehead</tt> where<br />
this header row has to be specified in advance of its use in a<br />
tabulation.<br />
<br />
{|<br />
! width="55%"|<br />
! width="10%"|<br />
! width="35%"|<br />
|-<br />
| <texcode><br />
\setuptabulate[split=yes,header=repeat]<br />
<br />
\starttabulatehead<br />
\FL<br />
\NC {\bf format char} \NC {\bf meaning} \NC \AR<br />
\LL<br />
\stoptabulatehead<br />
<br />
\starttabulate[|r|l|]<br />
\NC c \NC centered \NC \AR<br />
\NC l \NC left aligned \NC \AR<br />
\NC r \NC right aligned \NC \AR<br />
\stoptabulate<br />
</texcode><br />
|<br />
| <context><br />
\setuppapersize[A5]<br />
<br />
\setuptabulate[split=yes,header=repeat]<br />
<br />
\starttabulatehead<br />
\FL<br />
\NC {\bf format char} \NC {\bf meaning} \AR<br />
\LL<br />
\stoptabulatehead<br />
<br />
\starttabulate[|r|l|]<br />
\NC c \NC centered \AR<br />
\NC l \NC left aligned \AR<br />
\NC r \NC right aligned \AR<br />
\stoptabulate<br />
</context><br />
|}<br />
<br />
Note the use of <tt>\FL</tt> and <tt>\LL</tt> in the tabulate header rather than <tt>\HL</tt> which is a standard rule command (see below) that tries to guess automatically its position.<br />
<br />
=Individualizing the Tabulate Look=<br />
<br />
Hans initially announced support for vertical lines and colors on<br />
the mailing list.[http://archive.contextgarden.net/message/20101117.123950.739657a7.en.html]<br />
<br />
==Rules==<br />
<br />
===Horizontal Rules===<br />
<br />
As already demonstrated above, the <tt>\HL</tt> statement inserts<br />
a hairline after the current line.<br />
This particularly useful when demarking header and footer rows or<br />
separated parts of a table that should not be as closely<br />
associated as the rows between the rules.<br />
<br />
{|<br />
! width="55%"|<br />
! width="10%"|<br />
! width="35%"|<br />
|-<br />
| <texcode><br />
\starttabulate[|r|c|l|] <br />
\NC test \NC test \NC test \NC\NR <br />
\HL<br />
\NC test \NC test \NC test \NC\NR <br />
\NC test \NC test \NC test \NC\NR <br />
\HL<br />
\NC test \NC test \NC test \NC\NR <br />
\HL<br />
\stoptabulate<br />
</texcode><br />
| <context><br />
\starttabulate[|r|c|l|] <br />
\NC test \NC test \NC test \NC\NR <br />
\HL<br />
\NC test \NC test \NC test \NC\NR <br />
\NC test \NC test \NC test \NC\NR <br />
\HL<br />
\NC test \NC test \NC test \NC\NR <br />
\HL<br />
\stoptabulate<br />
</context><br />
|}<br />
<br />
Context supports different categories of rules that can be<br />
configured individually in order to discern various applications.<br />
Their behaviour accounts for the designated use, e.&nbsp;g.<br />
<tt>\ML</tt> (mid rules) are intended to be deployed between<br />
ordinary rows of the table body and will prevent page breaks<br />
&ndash; no way you’d end up with a rogue hairline desecrating<br />
the bottom of your page’s text area.<br />
{|cellpadding="10" style="border:2px solid #addeff"<br />
! style="background:#addeff;" | Type !! Description<br />
|-<br />
|<tt>\HL</tt> || standard horizontal rule;<br />
|-<br />
|<tt>\FL</tt> || first rule;<br />
|-<br />
|<tt>\ML</tt> || mid rule;<br />
|-<br />
|<tt>\LL</tt> || bottom rule;<br />
|-<br />
|<tt>\LL</tt> and <tt>\TL</tt> || bottom rule;<br />
|-<br />
|<tt>\BL</tt> || last rule.<br />
|}<br />
<br />
Additionally, there is an options <tt>rulecolor</tt> for<br />
<tt>\setuptabulate</tt> that allows for those rules to be tinted.<br />
<br />
<texcode><br />
\setuptabulate[rulecolor=red]<br />
<br />
\starttabulate[|r|c|l|] <br />
\FL<br />
\NC first row \NC test \NC test \NC\NR <br />
\ML<br />
\NC rows in \NC test \NC test \NC\NR <br />
\NC between \NC test \NC test \NC\NR <br />
\LL <br />
\NC last row \NC test \NC test \NC\NR <br />
\BL<br />
\stoptabulate<br />
</texcode><br />
<br />
Other types can be discovered in the source<br />
([[source:tabl-tbl.mkiv|tabl-tbl.mkiv]]).<br />
<br />
===Vertical Rules===<br />
<br />
The <tt>\VL</tt> command serves as a replacement for <tt>\NC</tt><br />
to mark a cell border wherever a vertical rule may be desired (if<br />
they are to be desired at all from a typographical point of<br />
view).<br />
<br />
<texcode><br />
\starttabulate[||||] <br />
\NC test \VL test \VL test \VL\NR <br />
\VL test \NC test \VL test \VL\NR <br />
\VL test \VL test \NC test \VL\NR <br />
\VL test \VL test \VL test \NC\NR <br />
\stoptabulate<br />
</texcode><br />
<br />
==Coloring==<br />
<br />
The following elements can be colorized: rules, cell backgrounds,<br />
and, obviously, common text.<br />
<br />
===Colorizing Rules===<br />
<br />
For ''horizontal rules'' see above.<br />
<br />
For ''vertical rules'', <tt>\VL</tt> takes a defined color as an<br />
optional argument.<br />
<br />
<texcode><br />
\starttabulate[|r|c|l|] <br />
\VL test \VL[red] red rule \VL test \VL \NR <br />
\VL test \VL[green] green rule \VL test \VL \NR <br />
\VL test \VL[blue] blue rule \VL test \VL \NR <br />
\stoptabulate<br />
</texcode><br />
<br />
===Colorizing Backgrounds & Text===<br />
Backgrounds and text can be colorized either on column basis or<br />
individually by cell.<br />
<br />
There are five color-specific control sequences:<br />
{|<br />
|<tt>CR</tt> || color is applied to the background of the text and the remaining space on the right.<br />
|-<br />
|<tt>CC</tt> || color is applied to the background of the text only.<br />
|-<br />
|<tt>CM</tt> || color is applied to the background of the text and the remaining space on both sides.<br />
|-<br />
|<tt>CL</tt> || color is applied to the background of the text and the remaining space on the left.<br />
|-<br />
|<tt>CT</tt> || color is applied to the text itself - in other words, the "foreground color."<br />
|}<br />
These are to complement the normal table layout expression (the<br />
first argument to <tt>\starttabulate</tt>.<br />
Thus, in order to colorize a four column table with the initial<br />
layout <tt>|c|c|c|c|</tt> it will have to be modified as follows:<br />
<texcode><br />
\starttabulate[|CR{red}c|CC{yellow}c|CM{green}c|CL{blue}c|] <br />
\NC test \NC test \NC test \NC test \NC \NR <br />
\NC test \NC test \NC test \NC test \NC \NR <br />
\NC test \NC test \NC test \NC test \NC \NR <br />
\NC test \NC test \NC test \NC test \NC \NR <br />
\stoptabulate<br />
</texcode><br />
<br />
Those control sequences, if applied within the table body, can<br />
replace the ordinary <tt>\NC</tt>, allowing individual cells to<br />
be colorized.<br />
<texcode><br />
\starttabulate[|c|c|c|c|c|c|]<br />
\NC g \NC l \NC i \NC d \NC e \NC r \NC \NR <br />
\NC g \NC l \NC i \CM[blue] d \NC e \NC r \NC \NR <br />
\NC g \NC l \NC i \NC d \CM[blue] e \NC r \NC \NR <br />
\NC g \NC l \CM[blue] i \CM[blue] d \CM[blue] e \NC r \NC \NR <br />
\NC g \NC l \NC i \NC d \NC e \NC r \NC \NR <br />
\stoptabulate<br />
</texcode><br />
<br />
'''caveat emptor'''! The background coloring does apply only to<br />
the ''first'' row of a paragraph cell. Any other cell will come<br />
out colorless. If you need to color an entire multi-line cell,<br />
you will need to switch to another<br />
[[Tables Overview|tabulation variant]].<br />
<br />
===Colorizing Cell Text===<br />
''Normal text'' inside cells gets its color via the<br />
[[Color|standard coloring commands]], or by the <br />
shorter variant described above.<br />
<br />
<texcode><br />
\starttabulate[|r|c|l|] <br />
\NC test \NC {\colored[red] test} \NC test \NC\NR <br />
\NC test \NC {\colored[green] test} \NC test \NC\NR <br />
\NC test \NC {\colored[blue] test} \NC test \NC\NR <br />
\NC test \NC {\colored[cyan] test} \NC test \NC\NR <br />
\stoptabulate<br />
</texcode><br />
<br />
== Vertical Distance Between Rows ==<br />
<br />
<!--<br />
There does not seem to be an official interface for<br />
vertical skips.<br />
Manually placed <code>\blank</code>s are<br />
<code>\unskipped</code> on purpose.<br />
However, as expected there is a token list<br />
<code>\t_tabl_tabulate_every_after_row</code> that is<br />
placed after a line is finished.<br />
So, in order to get a vertical spacing of half a baseline<br />
distance you can use this code:<br />
<br />
<texcode><br />
\unprotect<br />
\appendtoks<br />
\blank[halfline]<br />
\to \t_tabl_tabulate_every_after_row<br />
\protect<br />
</texcode><br />
<br />
--><br />
<br />
<context mode=mkiv source=yes><br />
\starttabulate<br />
\NC one \NC two \NC\NR <br />
\NC two \NC three \NC\NR <br />
\TB[halfline]<br />
\NC four \NC five \NC\NR <br />
\TB[line]<br />
\NC four \NC five \NC\NR <br />
\TB[1cm]<br />
\NC eight \NC nine \NC\NR <br />
\stoptabulate<br />
</context><br />
<br />
=Using math mode=<br />
<br />
If you want to display numerics, you can simply use <cmd>NN</cmd> for a new column instead of <cmd>NC</cmd>. This command works similar to the [http://www.pragma-ade.com/general/magazines/mag-0003.pdf digit-module]. Therefore you can also abbreviate:<br />
<br />
<texcode>\starttabulate[|l|l|]<br />
\HL<br />
\NN 10e-3 \NN 10e+3 \NR<br />
\HL<br />
\stoptabulate<br />
</texcode><br />
<br />
instead of<br />
<br />
<texcode><br />
\starttabulate[|l|l|]<br />
\HL<br />
\NC $10\cdot 10^{-3}$ \NC $10 \cdot 10^3$ \NR<br />
\HL<br />
\stoptabulate<br />
</texcode><br />
<br />
although both variants do work.<br />
<br />
If you always need math in one column, consider math mode columns:<br />
<br />
<texcode>\starttabulate[|m|m|]<br />
\HL<br />
\NC 10e-3 \NC 10e+3 \NR<br />
\HL<br />
\stoptabulate<br />
</texcode><br />
<br />
<br />
=Itemization inside a tabulation=<br />
<br />
<!--(added by Willi Egger 04-08-2011)--><br />
<br />
The following issue is related to MkIV:<br />
<br />
When using an itemization inside a tabulation where one uses also the <br />
<tt>\head</tt> command, there occurs a snapping problem. This is related to penalties which force a twoline split whereas the snapping mechanism prevents this. As a result two lines are typeset on top of each other. The solution is to add the following statement to the preamble:<br />
<texcode>\tabulatesplitlinemode \plustwo</texcode><br />
<br />
The following code provided by Wolfgang Schuster demonstrates the problem: Compile with and without the line <tt>\tabulatesplitlinemode\plustwo</tt><br />
<br />
<texcode><br />
\tabulatesplitlinemode \plustwo<br />
\starttabulate[|p|]<br />
\NC<br />
one \par<br />
\blank[penalty:10000]<br />
two \par<br />
\blank[penalty:10000]<br />
three<br />
\NC\NR<br />
\stoptabulate<br />
</texcode><br />
<br />
<br />
=See also=<br />
<br />
* More features are constantly added and documented in the {{src|tabl-tbl.mkiv|source}}.<br />
* {{cmd|starttabulate}}<br />
* [[TABLE|Natural Tables]]<br />
* {{cmd|starttable}}<br />
<br />
[[Category:Tables]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Footnotes&diff=22762Footnotes2015-03-13T16:09:22Z<p>Braslau: Footnotes at the end of each chapter example</p>
<hr />
<div>< [[Structurals]] | [[References]] ><br />
<br />
{{todo|This page needs to be reorganized: progression from simple to more complex use is a bit circular..}}<br />
<br />
==First View==<br />
<br />
<texcode><br />
\section{First}<br />
<br />
Way to \ConTeXt\footnote{First footnote.} is painful.<br />
<br />
\section{Second}<br />
<br />
But \ConTeXt\ is amazing.\footnote{Second footnote}<br />
<br />
\placetable<br />
{Complex Table\footnote{A table head footnote.}}<br />
{\startlocalfootnotes<br />
\placelegend<br />
{\starttable[|l|l|]<br />
\HL<br />
\NC First Column \NC Second Column \NC \FR<br />
\HL<br />
\NC East\footnote{Footnote inside graphic.} \NC North \NC \FR<br />
\NC West \NC South \NC \LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes}<br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\strut\vfill\<br />
\section{First}<br />
<br />
Way to \ConTeXt\footnote{First footnote.} is painful.<br />
<br />
\section{Second}<br />
<br />
But \ConTeXt\ is amazing.\footnote{Second footnote}<br />
<br />
\placetable<br />
{Complex Table\footnote{A table head footnote.}}<br />
{\startlocalfootnotes<br />
\placelegend<br />
{\starttable[|l|l|]<br />
\HL<br />
\NC First Column \NC Second Column \NC \FR<br />
\HL<br />
\NC East\footnote{Footnote inside graphic.} \NC North \NC \FR<br />
\NC West \NC South \NC \LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes}<br />
\stoptext<br />
</context><br />
<br />
Here we have footnotes of two outer ones, a local one (in the table) and a postponed one (in the graphic).<br />
<br />
==Basic Footnotes==<br />
<br />
For basic footnotes, simply use <cmd>footnote</cmd><tt>[reference]{footnote text}</tt>.<br />
The reference is optional, and can be used to refer to the same footnote again. Footnotes can be referenced with the usual <cmd>in</cmd> and <cmd>at</cmd> macros (see [[References]]), or the note itself can be reproduced with <cmd>note</cmd><tt>[reference]</tt>. For example:<br />
<br />
<texcode><br />
This\footnote[footA](Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and \in{footnote}[footA] on \at{page}[footA], denoted by \note[footA].}. <br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote[footA](Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and \in{footnote}[footA] on \at{page}[footA], denoted by \note[footA].}. <br />
\stoptext<br />
</context><br />
<br />
<br />
Thanks to Oblomov, it's also possible to use footnotes in footnotes, as in this example.<br />
<br />
<texcode><br />
This\footnote(Or that\footnote{Or possibly even the other.}, if you prefer.} is a sentence<br />
with a footnote. <br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote(Or that\footnote{Or possibly even the other.}, if you prefer.} is a sentence<br />
with a footnote. <br />
\stoptext<br />
</context><br />
<br />
<br />
==Footnote Numbering==<br />
<br />
You can setup the exact behaviour of footnotes as usual with <cmd>setupfootnotes</cmd>. For example, to use footnotes with standard footnote symbols (which ConTeXt has defined as the conversion "set 2"), with the footnote counter resetting on each page, one would use the following:<br />
<br />
<texcode><br />
\setupfootnotes[way=bypage, conversion=set 2]<br />
</texcode><br />
<br />
Beware, in MkIV this became<br />
<br />
<texcode><br />
\setupnotation[footnote][way=bypage,numberconversion=set 2]<br />
</texcode><br />
<br />
This produces the following footnotes, using the text of the previous example.<br />
<br />
<context><br />
\setupfootnotes[way=bypage, conversion=set 2]<br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote[footA](Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and \in{footnote}[footA] on \at{page}[footA], denoted by \note[footA].}. <br />
\stoptext<br />
</context><br />
<br />
==Alternate Footnote Locations==<br />
<br />
The <cmd>setupfootnotes</cmd> command offers some options for the placement of footnotes; for instance, the <code>location=columns</code> option places the footnotes in a single column (of a multicolumn page) rather than across the whole page. The <code>location=text</code> option places the footnotes in text at a location specified by <cmd>placefootnotes</cmd>; this can be easily used to create endnotes, or even to place footnotes after each paragraph or subsection.<br />
<br />
<texcode><br />
\setupfootnotes[location=text]<br />
This\footnote[footA]{Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and footnote \note[footA].}. <br />
\placefootnotes<br />
This is some more text, with more footnotes\footnote{Specifically, this one.}.<br />
\placefootnotes<br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\setupfootnotes[location=text]<br />
This\footnote[footA]{Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and footnote \note[footA].}. <br />
\placefootnotes<br />
This is some more text, with more footnotes\footnote{Specifically, this one.}.<br />
\placefootnotes<br />
\stoptext<br />
</context><br />
<br />
==== Footnotes at the end of each chapter ====<br />
<br />
Another elegant example (given by Hans on the mailing list) places all footnotes in a subject (unnumbered section) at the end of each chapter. It is intelligent and will not create an empty subject when there are no footnotes to be placed. At no extra cost, the subject title "Footnote" will be singular or plural depending if there is only one or several footnotes to be placed:<br />
<br />
<texcode><br />
\startsetups chapter:after<br />
\ifcase\rawcountervalue[footnote]\relax<br />
\or<br />
\startsubject[title=Footnote]<br />
\placefootnotes<br />
\stopsubject<br />
\else<br />
\startsubject[title=Footnotes]<br />
\placefootnotes<br />
\stopsubject<br />
\fi<br />
\stopsetups<br />
<br />
\setupnotes[location=none]<br />
\setupnotation[way=bychapter]<br />
<br />
\setuphead[chapter][aftersection=\setups{chapter:after}]<br />
</texcode><br />
<br />
==Footnote Formatting==<br />
<br />
You can change the font used in the footnotes with<br />
<cmd>setupfootnotedefinition</cmd><code>[before=\MyFontCommand]</code>.<br />
<br />
Footnotes can be placed in multiple columns, using the <tt>n=<i>number</i></tt> option in <cmd>setupfootnotes</cmd> (in latest betas it should be added to <cmd>setupnotes</cmd> or <cmd>setupnote</cmd> instead).<br />
<br />
<texcode><br />
\setupfootnotes[n=3]<br />
This\footnote[footA](Or that\footnote{Or the other.}, if you prefer.} is a sentence<br />
with a footnote\footnote{Actually, two footnotes; this one and \in{footnote}[footA]<br />
on \at{page}[footA], denoted by \note[footA].}. <br />
</texcode><br />
<br />
<context><br />
\setupfootnotes[n=3]<br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote[footA](Or that\footnote{Or the other.}, if you prefer.} is a sentence<br />
with a footnote\footnote{Actually, two footnotes; this one and \in{footnote}[footA]<br />
on \at{page}[footA], denoted by \note[footA].}. <br />
\stoptext<br />
</context><br />
<br />
{{todo|This is ugly, and points up some ConTeXt bugs that need to be fixed.}}<br />
<br />
====Footnotes in pagraph form====<br />
<br />
When enabling footnotes (actually notes and linenotes) in pagraph form, there is some risk in having no right separation between body and the notes. This can be partially avoided using <code>width=broad</code> ([http://www.ntg.nl/pipermail/ntg-context/2013/073650.html Hans dixit]).<br />
<br />
<texcode><br />
\setupbodyfont<br />
[pagella]<br />
<br />
\setupnote<br />
[footnote]<br />
[paragraph=yes]<br />
<br />
\setupnotation<br />
[footnote]<br />
[alternative=serried,<br />
width=broad,<br />
distance=.5em,<br />
display=no]<br />
<br />
\starttext<br />
\dorecurse{500}{text text text\footnote{note} }<br />
\stoptext<br />
</texcode><br />
<br />
==Footnotes in Floats==<br />
<br />
[[Floating Objects|Floats]] cannot include normal footnotes, because they are likely to float to another page from the page on which they were defined, thus getting the footnotes out of order. Thus, to include footnotes in a float, one must use local footnotes. This table, which uses the <cmd>placelegend</cmd> command to create a place for the footnotes, illustrates the process:<br />
<br />
<texcode><br />
\startlocalfootnotes[n=2]<br />
\placetable{A table with footnotes.}<br />
\placelegend<br />
{\starttable[|l|r|]<br />
\HL<br />
\VL One\footnote{First} \VL Two\footnote{Second} \VL\FR<br />
\VL Three\footnote{Third} \VL Four\footnote{Fourth} \VL\LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes<br />
</texcode><br />
<br />
<context><br />
\startlocalfootnotes[n=2]<br />
\placetable{A table with footnotes.}<br />
\placelegend<br />
{\strut\starttable[|l|r|]<br />
\HL<br />
\VL One\footnote{First} \VL Two\footnote{Second} \VL\FR<br />
\VL Three\footnote{Third} \VL Four\footnote{Fourth} \VL\LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes<br />
</context><br />
<br />
When using natural tables, the above leads to alignment problems. An alternative is to use:<br />
<br />
<texcode><br />
\defineframed[noteframed]<br />
\setupframed[noteframed]<br />
[width=\hsize,<br />
frame=off,<br />
align=right,<br />
%height=fit,<br />
top=\hbox\bgroup,<br />
bottom=\egroup]<br />
<br />
\starttext<br />
<br />
\startlocalfootnotes[n=0]<br />
\placetable<br />
{Caption}<br />
{\placelegend<br />
{\bTABLE<br />
\bTR\bTD One\footnote{First} \eTD\bTD Two\footnote{Second} \eTD\eTR<br />
\bTR\bTD Three\footnote{Third} \eTD\bTD Four\footnote{Fourth} \eTD\eTR<br />
\eTABLE}<br />
{\noteframed{\placelocalfootnotes}}}<br />
\stoplocalfootnotes<br />
<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
\defineframed[noteframed]<br />
\setupframed[noteframed]<br />
[width=\hsize,<br />
frame=off,<br />
align=right,<br />
%height=fit,<br />
top=\hbox\bgroup,<br />
bottom=\egroup]<br />
<br />
\starttext<br />
<br />
\startlocalfootnotes[n=0]<br />
\placetable<br />
{Caption}<br />
{\placelegend<br />
{\bTABLE<br />
\bTR\bTD One\footnote{First} \eTD\bTD Two\footnote{Second} \eTD\eTR<br />
\bTR\bTD Three\footnote{Third} \eTD\bTD Four\footnote{Fourth} \eTD\eTR<br />
\eTABLE}<br />
{\noteframed{\placelocalfootnotes}}}<br />
\stoplocalfootnotes<br />
<br />
\stoptext<br />
</context><br />
<br />
==Footnotes in a box==<br />
<br />
Note that it is necessary to add the command <cmd>automigrateinserts</cmd><br />
(for example before <cmd>starttext</cmd>)<br />
in order to correctly handle the placement of footnotes within a box such as <cmd>framed</cmd> or <cmd>placeongrid</cmd>...<br />
<br />
==Placing Footnotes Manually==<br />
<br />
In some cases, ConTeXt's footnoting system may not be able to do exactly what you want. For instance, you may want to place a footnote in a table so that the footnote appears with the rest of the footnotes on the page, or you may want to create a footnote to a footnote to a footnote. Many of these cases can be handled by using the <cmd>footnotetext</cmd> command (which creates a footnote without placing the corresponding symbol in the text) and the <cmd>note</cmd> command (which places the footnote symbol in the text, but does not create a footnote).<br />
<br />
For example, to create a footnote to a footnote to a footnote, all but the first footnotes are created with <cmd>footnotetext</cmd> commands, which are placed in the main text -- thereby ensuring that the footnotes are numbered and appear in the correct order. Then, these footnotes are referenced by <cmd>note</cmd> commands within the relevant footnotes. In this example, the lines are broken for clarity; note the <tt>%</tt> at the end of each line to prevent spurious spaces in the text.<br />
<br />
<texcode><br />
This%<br />
\footnote{Or that\note[footB], if you prefer.}%<br />
\footnotetext[footB]{Or possibly even the other\note[footC].}%<br />
\footnotetext[footC]{It could be something entirely different.}<br />
is a sentence with nested footnotes.<br />
</texcode><br />
<br />
<context><br />
\strut\vfill<br />
This%<br />
\footnote{Or that\note[footB], if you prefer.}%<br />
\footnotetext[footB]{Or possibly even the other\note[footC].}%<br />
\footnotetext[footC]{It could be something entirely different.}<br />
is a sentence with nested footnotes.<br />
</context><br />
<br />
== Suppressing Footnotes Entirely ==<br />
<br />
The boolean {{cmd|link=no|notesenabled}} controls whether footnotes are processed at all.<br />
If set to ''false'', invocations of {{cmd|footnote}} will be ignored.<br />
After it is set to ''true'' again Context will pick up the footnote counters at their<br />
previous state, so numbering will continuous.<br />
<br />
<context source="yes" mode="mkiv"><br />
\setuppapersize [A7]<br />
\starttext<br />
<br />
\dorecurse {2} { foo \footnote {bar} baz \par }<br />
<br />
\notesenabledfalse<br />
<br />
\dorecurse {3} { foo \footnote {bar} baz \par }<br />
<br />
\notesenabledtrue<br />
<br />
\dorecurse {2} { foo \footnote {bar} baz \par }<br />
<br />
\stoptext<br />
</context><br />
<br />
== Color of Footnote Links that Refer to the Same Page ==<br />
<br />
If you have set footnotes to be interactive and have noticed that your footnote links become red, it is because they are linked to content on the same page on which they appear. This means they are governed by the \setupinteraction attribute of 'contrastcolor', rather than 'color'.<br />
<br />
To fix the redness (or change it to a different color), try:<br />
<br />
<texcode><br />
\setupinteraction[state=start,color=black,contrastcolor=black]<br />
</texcode><br />
<br />
== Special Needs ==<br />
There are numerous ways to display and format footnotes. The following section gathers solutions to some special tasks asked on the mailing list.<br />
<br />
* Is there a way to turn off hyphenation for the main body of my text, but enable it for the footnotes?<br />
<br />
<texcode><br />
\starttext<br />
<br />
\setupnote[footnote][align={normal,hyphenated}]<br />
<br />
\setupalign[hyphenated] \input tufte \footnote{\input tufte \relax} \par<br />
<br />
\setupalign[nothyphenated,stretch,tolerant] \input tufte<br />
\footnote{\input tufte \relax} \par<br />
<br />
\stoptext<br />
</texcode><br />
<br />
* Currently, footnotes are set so that the left end of the text of the footnote is aligned with the left edge of the text, and the footnote number hangs out into the margin. Is it possible to change this? (For instance, suppose I would like the number aligned to the text-edge, and then a fixed-width space, and then the text?)<br />
<br />
This behavior is controlled by the <code>location</code> key in the <code>\setupnotation</code> command. Here are some examples:<br />
<br />
Note number is typeset in an area with a width of 1cm, aligned at the left of the text area:<br />
<br />
<context source="yes" text="produces"><br />
\definepapersize[wiki][width=8cm,height=8cm]<br />
<br />
\setuppapersize[wiki][wiki]<br />
<br />
\starttext<br />
<br />
\showframe<br />
<br />
\setupnotation[footnote][location=left,width=1cm]<br />
\setupnote[footnote][location=page,numbercommand=]<br />
<br />
test \footnote{test}<br />
<br />
\stoptext <br />
</context><br />
<br />
<br />
Suppose that one wants a width of 1.5em. Then<br />
<br />
<texcode><br />
\setupnote[footnote][margindistance=0em,command=\myfootnotecommand]<br />
\setupnotation[footnote][location=left,hang=1]<br />
<br />
\def\myfootnotecommand#1{\hbox to 1.5em{#1.}}<br />
</texcode><br />
<br />
* Can I change the line spacing of a footnote independently of that of the main text?<br />
<br />
The way to do this is not obvious, but this is the code you need to use:<br />
<br />
<texcode><br />
\def\setnotebodyfont<br />
{\switchtobodyfont[your desired font size]\setupinterlinespace[your desired spacing]} <br />
</texcode></div>Braslauhttps://wiki.contextgarden.net/index.php?title=MWE&diff=22685MWE2014-11-05T15:24:29Z<p>Braslau: added new category: smallest pdf file</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Minimum WORKING Examples ==<br />
<br />
Here we launch a contest for the creation of the most minimal working examples. There shall be different categories:<br />
<br />
* shortest code<br />
<br />
* fastest execution<br />
<br />
* shortest code + fastest execution<br />
<br />
* smallest PDF file produced<br />
<br />
Rules: the example MUST compile and create a pdf!<br />
<br />
== ConTeXt ==<br />
<br />
* \starttext a\stoptext<br />
<br />
* \startTEXpage !\stopTEXpage<br />
<br />
== MetaPost ==<br />
<br />
* \startMPpage draworigin;\stopMPpage<br />
<br />
* \startMPpage draworigin\stopMPpage<br />
<br />
* \startMPpage draw(0,0)\stopMPpage</div>Braslauhttps://wiki.contextgarden.net/index.php?title=MWE&diff=22684MWE2014-11-05T14:24:58Z<p>Braslau: added Hans' correction to my MWE</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Minimum WORKING Examples ==<br />
<br />
Here we launch a contest for the creation of the most minimal working examples. There shall be different categories:<br />
<br />
* shortest code<br />
<br />
* fastest execution<br />
<br />
* shortest code + fastest execution<br />
<br />
Rules: the example MUST compile and create a pdf!<br />
<br />
== ConTeXt ==<br />
<br />
* \starttext a\stoptext<br />
<br />
* \startTEXpage !\stopTEXpage<br />
<br />
== MetaPost ==<br />
<br />
* \startMPpage draworigin;\stopMPpage<br />
<br />
* \startMPpage draworigin\stopMPpage<br />
<br />
* \startMPpage draw(0,0)\stopMPpage</div>Braslauhttps://wiki.contextgarden.net/index.php?title=MWE&diff=22683MWE2014-11-05T14:20:20Z<p>Braslau: added Hans' entry</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Minimum WORKING Examples ==<br />
<br />
Here we launch a contest for the creation of the most minimal working examples. There shall be different categories:<br />
<br />
* shortest code<br />
<br />
* fastest execution<br />
<br />
* shortest code + fastest execution<br />
<br />
Rules: the example MUST compile and create a pdf!<br />
<br />
== ConTeXt ==<br />
<br />
* \starttext a\stoptext<br />
<br />
* \startTEXpage !\stopTEXpage<br />
<br />
== MetaPost ==<br />
<br />
* \startMPpage draworigin;\stopMPpage<br />
<br />
* \startMPpage draw(0,0)\stopMPpage</div>Braslauhttps://wiki.contextgarden.net/index.php?title=MWE&diff=22682MWE2014-11-05T14:10:54Z<p>Braslau: added rules</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Minimum WORKING Examples ==<br />
<br />
Here we launch a contest for the creation of the most minimal working examples. There shall be different categories:<br />
<br />
* shortest code<br />
<br />
* fastest execution<br />
<br />
* shortest code + fastest execution<br />
<br />
Rules: the example MUST compile and create a pdf!<br />
<br />
== ConTeXt ==<br />
<br />
* \starttext a\stoptext<br />
<br />
* \startTEXpage !\stopTEXpage<br />
<br />
== MetaPost ==<br />
<br />
* \startMPpage draworigin;\stopMPpage</div>Braslauhttps://wiki.contextgarden.net/index.php?title=MWE&diff=22681MWE2014-11-05T14:07:54Z<p>Braslau: Created the contest</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Minimum WORKING Examples ==<br />
<br />
Here we launch a contest for the creation of the most minimal working examples. There shall be different categories:<br />
<br />
* shortest code<br />
<br />
* fastest execution<br />
<br />
* shortest code + fastest execution<br />
<br />
== ConTeXt ==<br />
<br />
* \starttext a\stoptext<br />
<br />
* \startTEXpage !\stopTEXpage<br />
<br />
== MetaPost ==<br />
<br />
* \startMPpage draworigin;\stopMPpage</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Common_errors&diff=22680Common errors2014-11-03T12:26:38Z<p>Braslau: added textdefinition</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Common ConTeXt Errors ==<br />
<br />
Here, we collect a list of your favorite, common ConTeXt coding errors. Look carefully to see what is wrong...<br />
<br />
* \startext<br />
<br />
* \stopMPage<br />
<br />
* \startchapter[title=Space, the final frontier]<br />
<br />
* \somecommand[parameter,key=value]<br />
<br />
* \starttexdefinition ... \stoptextdefinition<br />
<br />
* \śtart (try to guess how this comes about...)<br />
<br />
* context text (after editing test.tex)<br />
<br />
Creative users are invited to add some real puzzlers here!<br />
<br />
== Common MetaPost Errors ==<br />
<br />
* i = i + 1 ;<br />
<br />
* z := (a, b) ;<br />
<br />
* if foo then ... end<br />
<br />
* if x > 10 and y < 20 :<br />
<br />
* string s ; s := "here" .. "there"<br />
<br />
* local p<br />
<br />
== Common Lua Errors ==<br />
<br />
* save p</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Common_errors&diff=22678Common errors2014-10-29T10:07:12Z<p>Braslau: a few suggestions from Hans (and my own along the same lines)</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Common ConTeXt Errors ==<br />
<br />
Here, we collect a list of your favorite, common ConTeXt coding errors. Look carefully to see what is wrong...<br />
<br />
* \startext<br />
<br />
* \stopMPage<br />
<br />
* \startchapter[title=Space, the final frontier]<br />
<br />
* \somecommand[parameter,key=value]<br />
<br />
* \śtart (try to guess how this comes about...)<br />
<br />
* context text (after editing test.tex)<br />
<br />
Creative users are invited to add some real puzzlers here!<br />
<br />
== Common MetaPost Errors ==<br />
<br />
* i = i + 1 ;<br />
<br />
* z := (a, b) ;<br />
<br />
* if foo then ... end<br />
<br />
* if x > 10 and y < 20 :<br />
<br />
* string s ; s := "here" .. "there"<br />
<br />
* local p<br />
<br />
== Common Lua Errors ==<br />
<br />
* save p</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Common_errors&diff=22677Common errors2014-10-28T10:47:13Z<p>Braslau: added another favorite!</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Common ConTeXt Errors ==<br />
<br />
Here, we collect a list of your favorite, common ConTeXt coding errors. Look carefully to see what is wrong...<br />
<br />
* \startext<br />
<br />
* \stopMPage<br />
<br />
* \startchapter[title=Space, the final frontier]<br />
<br />
* \somecommand[parameter,key=value]<br />
<br />
* \śtart (try to guess how this comes about...)<br />
<br />
* context text (after editing test.tex)<br />
<br />
Creative users are invited to add some real puzzlers here!<br />
<br />
== Common MetaPost Errors ==<br />
<br />
* i = i + 1 ;<br />
<br />
* z := (a, b) ;<br />
<br />
* local p<br />
<br />
== Common Lua Errors ==<br />
<br />
* save p</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Common_errors&diff=22676Common errors2014-10-28T09:31:59Z<p>Braslau: added Lua errors section</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Common ConTeXt Errors ==<br />
<br />
Here, we collect a list of your favorite, common ConTeXt coding errors. Look carefully to see what is wrong...<br />
<br />
* \startext<br />
<br />
* \stopMPage<br />
<br />
* \startchapter[title=Space, the final frontier]<br />
<br />
* \somecommand[parameter,key=value]<br />
<br />
* context text (after editing test.tex)<br />
<br />
Creative users are invited to add some real puzzlers here!<br />
<br />
== Common MetaPost Errors ==<br />
<br />
* i = i + 1 ;<br />
<br />
* z := (a, b) ;<br />
<br />
* local p<br />
<br />
== Common Lua Errors ==<br />
<br />
* save p</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Common_errors&diff=22675Common errors2014-10-28T09:11:23Z<p>Braslau: added a MP error</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Common ConTeXt Errors ==<br />
<br />
Here, we collect a list of your favorite, common ConTeXt coding errors. Look carefully to see what is wrong...<br />
<br />
* \startext<br />
<br />
* \stopMPage<br />
<br />
* \startchapter[title=Space, the final frontier]<br />
<br />
* \somecommand[parameter,key=value]<br />
<br />
* context text (after editing test.tex)<br />
<br />
Creative users are invited to add some real puzzlers here!<br />
<br />
== Common MetaPost Errors ==<br />
<br />
* i = i + 1 ;<br />
<br />
* z := (a, b) ;</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Humour&diff=22674Humour2014-10-28T08:26:18Z<p>Braslau: </p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== A poem about documentation ==<br />
<br />
"Yet another context user" posted [http://archive.contextgarden.net/message/20100403.155801.7098c48a.en.html this poem] to the mailing list<br />
<br />
<pre><br />
If you were surprised, like me<br />
Fifty emails, in your inbox to see<br />
<br />
Let me help you with a summary<br />
Of what happended, using a poor excuse for poetry <br />
<br />
It was the day of fools<br />
When Arthur tried to be cool<br />
<br />
In ConTeXt mailing list he shouted, "Look<br />
I am going to write a ConTeXt book!"<br />
<br />
Everyone was happy and had a thrill<br />
Till Martin said, "it is the first of April"<br />
<br />
His joke ruined, Arthur was sad<br />
He said Martin, this is bad<br />
<br />
Other users were also upset, taken for a ride<br />
The lack of a book, is not a matter of pride<br />
<br />
There were cries and a big fuss<br />
I was just getting started, said Russ<br />
<br />
After that comments did pour<br />
Its not even funny, said Gour<br />
<br />
All of us would be out of luck<br />
If Hans were to be hit by a bus!<br />
<br />
Citing Douglas Adams said Taco<br />
That will make the bus, a shamed loco<br />
<br />
In time back it 'ill go<br />
And slam its breaks, like a pro<br />
<br />
Writing documentation is no fun<br />
It that the reason it is shun<br />
<br />
Even if you do write something<br />
Does anyone even read the damn thing?<br />
<br />
Taco lamented all he hears is that 'it sucks'<br />
Demotivated, he may just pass the buck<br />
<br />
"Oh please, don't let the project slack<br />
If you write something, we will give you feedback"<br />
<br />
This circle of arguments is always repeated<br />
Whenever the question of documentation gets tweeted<br />
<br />
A new conspiracy theory was added this time<br />
"They want to keep it a secret," it's a crime<br />
<br />
I am sick and tired of all the pretext<br />
Why do you think anyone should write a book on ConTeXt?<br />
<br />
Taco and Hans, their hands are full<br />
Everyone else is just using a tool<br />
<br />
(Actually when I was writing this chronology<br />
Irdis was thinking about a typographical ontology)<br />
<br />
If you think that the documentation is lacking<br />
Do something, rather than grumbling<br />
<br />
Here's a suggestion, if I may give to thee<br />
Follow it, and you'll be a ConTeXt prodigee<br />
<br />
Pick up a pen and go 'n write<br />
On any part of ConTeXt that you like<br />
<br />
A wiki article, a blog post, are good places to start<br />
People reading them will relish the knowledge it imparts<br />
<br />
Write an example, show how things work<br />
Don't just hide there and lurk<br />
<br />
If nothing else, write about what you find confusing<br />
Others writing documentation may find it motivating<br />
<br />
On this note, this summary I'll end<br />
You were not offended, I'll pretend<br />
<br />
Finally a request, if I may<br />
Let me be anonymous, please, I pray<br />
<br />
A promise in passing, I'll also make<br />
Someday a ConTeXt book or tutorial, I may bake<br />
<br />
I am waiting for time and a muse<br />
At least, that is my excuse<br />
<br />
<br />
<br />
-- A ConTeXt User<br />
<br />
<br />
</pre><br />
<br />
* Later in the thread Idris told how his name should be pronounced<br />
<pre><br />
&gt;&gt;&gt; (Actually when I was writing this chronology<br />
&gt;&gt;&gt; Irdis was thinking about a typographical ontology)<br />
&gt;&gt;<br />
&gt;&gt; Who is this Irdis?<br />
<br />
&gt; Oh, my heart now bleeds<br />
&gt; That I couldn't spell the name of Prof Hamid<br />
<br />
Our anonymous YACU ran, slipped and had to skid,<br />
Neither did (s)he know how to rhyme with Hamid<br />
<br />
Accent in Hamid is on the first syllable,<br />
Otherwise pronouncing it will be untenable<br />
</pre><br />
<br />
Not a poem, but well written:<br />
[http://www.ntg.nl/pipermail/ntg-context/2010/048197.html by Arthur]<br />
<br />
== What if Hans were hit by a bus ==<br />
* Taco's brilliant [http://archive.contextgarden.net/message/20100403.065454.97ad25ba.en.html answer] to this question<br />
<br />
<pre><br />
&gt; This raises another concern and that is: what is the future of ConTeXt<br />
&gt; is Hans "get hit by the bus"? (Of course, we even do not want to think<br />
&gt; about it...)<br />
<br />
The answer to this question is quite obvious if you have read Douglas<br />
Adams' books: the bus will think about the impact of its actions on the<br />
universe for a moment. Then, deeply immersed in gut-wrenching shame,<br />
it will travel back in time half a minute and push its own breaks for<br />
an emergency stop.<br />
</pre><br />
<br />
== latex and LaTeX ==<br />
<br />
Taco Hoekwater [http://archive.contextgarden.net/message/20100911.100030.b6e30e98.en.html explaining] the similarity between latex and LaTeX<br />
<br />
<blockquote><br />
Creating beautiful latex garments is at least as challenging as creating beautiful LaTeX documents (I<br />
tried, in earlier days). And just like in LaTeX, the problem areas are glue control and insert<br />
placement. Selling latex garments is also similar to selling LaTeX books: it is quite a niche market and your clients are considered fetishists by most other people.<br />
</blockquote><br />
<br />
== ConTeXt logic ==<br />
<br />
Steffen Wolfrum [http://www.mail-archive.com/ntg-context@ntg.nl/msg22409.html bewildered] at ConTeXt syntax:<br />
<br />
<blockquote><br />
Sometimes ConTeXt's syntax looks kind of "female" to me:<br />
It certainly has an inner logic, but this is far more ... rich and varied as my <br />
single-minded, male structured mind would expect -)<br />
</blockquote><br />
<br />
== Where is my update? ==<br />
<br />
Vnpenguin was [http://www.mail-archive.com/ntg-context@ntg.nl/msg47711.html confused] why he was not able to update ConTeXt, until Hans resolved the mystery.<br />
<br />
<pre><br />
> Since one week, I update my minimal ConTeXt almost everyday (Win32<br />
> version), but the version is alway the same:<br />
<br />
sure, as i didn't update context for a week<br />
</pre><br />
<br />
== Can you run it for me? ==<br />
<br />
Peter Rolf asking R. Bastian [http://www.mail-archive.com/ntg-context@ntg.nl/msg49587.html not to be afraid]:<br />
<br />
<blockquote><br />
<p><br />
&gt; Does this work in Mk II ?<br />
</p><br />
<br />
<p><br />
You can set your mind at rest and test it yourself.<br />
The 'nuke_my_computer_by_running_context' module is no longer part of<br />
the official distribution ;-)<br />
</p><br />
</blockquote><br />
<br />
== Finite Life ==<br />
<br />
The following exchange between the Philosophers Ludovicus Scarso<br />
and Ioannes Hagenius could be observed on the mailing list[http://archive.contextgarden.net/message/20101218.131804.c250b741.en.html].<br />
<pre><br />
> Live is too short to learn all those languages and stay<br />
> fluent in them, i.e. one simply forgets a lot when usage zeros.<br />
we should start to think how to to become immortal.<br />
</pre><br />
<br />
== Installation chant ==<br />
<br />
Patrick shared this conversation on 2011-12-21:<br />
<pre><br />
Hello Marek,<br />
<br />
> Hi Mr. Gundla<br />
> Just want to say Im very dissapointed that no installing package of ConText exist. <br />
> I mean like you install things in Win – two cliks and Done!<br />
> I was studying ConText whole afternoon and i liked it – But – im very very sick of this kind of installing. <br />
> It just makes people like me to hate the whole thing about trying something else then MS Word. <br />
> I was eager to learn this ConText ant than BIIIIIIG! Frustration cause i could not run it. <br />
> All those versions of packages - i wanted to shoot myself.<br />
<br />
> Yea, i know you dont get paid for this, BUT - come on Mr. Gundla. <br />
> Is it that hard to make one ABSOLUTE DUMMY PACKAGE (you geeks can call it <br />
> how you want i know you like to use word dummies for people who are lesser geeks than you :) ) <br />
> two cliks and lalala! <br />
> Hello Word! You save afternoon to many other people :D Just think about it, ok?<br />
<br />
Well, ConTeXt _is_ hard to install. First you have to sacrifice one of your family members. <br />
Afterwards, you need to hum the magic chant in order to open your spirit. <br />
After you have done that, please draw a circle around your computer and put candles on it, making the shape of a pentagram. <br />
Now, and this is important, go six times clockwise around that circle, six times counter clockwise <br />
and then six times clockwise again. <br />
After that, turn on your computer and start your webbrowser and go to<br />
<br />
http://wiki.contextgarden.net/Simple_Windows_Installation<br />
<br />
and download the installer.<br />
<br />
Sincerely your Mr. Gundla<br />
</pre><br />
<br />
== Wolfgang Interface ==<br />
<br />
> Gosh this list is nice! Reminds me of the "good old days" when we<br />
> used UUCP, bang-paths and C-News to communicate (or the early<br />
> ARPANET days): polite, expert, very willing to share knowledge &c.<br />
<br />
Wolfgang is ConTeXt's natural language interface.<br />
<br />
In fact, with careful use of the filter module and a couple of mail<br />
programs, it should be possible to create something like:<br />
<texcode><br />
\usemodule[filter]<br />
<br />
\defineexternalfilter<br />
[wolfgang]<br />
[filtercommand={ ... code to send email and fetch reply ... },<br />
cache=yes]<br />
<br />
\startwolfgang<br />
Hello list,<br />
<br />
I wonder if anyone could tell me how to implement the following in<br />
ConTeXt.<br />
<br />
... description goes here ...<br />
\stopwolfgang<br />
</texcode><br />
It's important to include the cache=yes, so Wolfgang only has to reply<br />
once.<br />
<br />
= Comparison between various TeX and GUI systems =<br />
<br />
William Adam on the difference between [[Comparison_between_ConTeXt_and_other_typesetting_programs|TeX and other GUI document design systems]]<br />
<br />
= Pictures =<br />
<br />
== Future ConTeXt Users ==<br />
[[Future ConTeXt Users]]<br />
<br />
== Super Wolfgang ==<br />
<br />
A [http://meeting.contextgarden.net/2010/talks/2010-09-17-closing/wolfgang-color.jpg cartoon] by Duane Bibby at the Fourth ConTeXt meeting<br />
<br />
= Common errors =<br />
<br />
[[ Common errors ]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Common_errors&diff=22673Common errors2014-10-28T08:25:52Z<p>Braslau: </p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Common ConTeXt Errors ==<br />
<br />
Here, we collect a list of your favorite, common ConTeXt coding errors. Look carefully to see what is wrong...<br />
<br />
* \startext<br />
<br />
* \stopMPage<br />
<br />
* \startchapter[title=Space, the final frontier]<br />
<br />
* \somecommand[parameter,key=value]<br />
<br />
* context text (after editing test.tex)<br />
<br />
Creative users are invited to add some real puzzlers here!<br />
<br />
== Common MetaPost Errors ==<br />
<br />
* i = i + 1 ;</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Humour&diff=22672Humour2014-10-28T08:25:18Z<p>Braslau: </p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== A poem about documentation ==<br />
<br />
"Yet another context user" posted [http://archive.contextgarden.net/message/20100403.155801.7098c48a.en.html this poem] to the mailing list<br />
<br />
<pre><br />
If you were surprised, like me<br />
Fifty emails, in your inbox to see<br />
<br />
Let me help you with a summary<br />
Of what happended, using a poor excuse for poetry <br />
<br />
It was the day of fools<br />
When Arthur tried to be cool<br />
<br />
In ConTeXt mailing list he shouted, "Look<br />
I am going to write a ConTeXt book!"<br />
<br />
Everyone was happy and had a thrill<br />
Till Martin said, "it is the first of April"<br />
<br />
His joke ruined, Arthur was sad<br />
He said Martin, this is bad<br />
<br />
Other users were also upset, taken for a ride<br />
The lack of a book, is not a matter of pride<br />
<br />
There were cries and a big fuss<br />
I was just getting started, said Russ<br />
<br />
After that comments did pour<br />
Its not even funny, said Gour<br />
<br />
All of us would be out of luck<br />
If Hans were to be hit by a bus!<br />
<br />
Citing Douglas Adams said Taco<br />
That will make the bus, a shamed loco<br />
<br />
In time back it 'ill go<br />
And slam its breaks, like a pro<br />
<br />
Writing documentation is no fun<br />
It that the reason it is shun<br />
<br />
Even if you do write something<br />
Does anyone even read the damn thing?<br />
<br />
Taco lamented all he hears is that 'it sucks'<br />
Demotivated, he may just pass the buck<br />
<br />
"Oh please, don't let the project slack<br />
If you write something, we will give you feedback"<br />
<br />
This circle of arguments is always repeated<br />
Whenever the question of documentation gets tweeted<br />
<br />
A new conspiracy theory was added this time<br />
"They want to keep it a secret," it's a crime<br />
<br />
I am sick and tired of all the pretext<br />
Why do you think anyone should write a book on ConTeXt?<br />
<br />
Taco and Hans, their hands are full<br />
Everyone else is just using a tool<br />
<br />
(Actually when I was writing this chronology<br />
Irdis was thinking about a typographical ontology)<br />
<br />
If you think that the documentation is lacking<br />
Do something, rather than grumbling<br />
<br />
Here's a suggestion, if I may give to thee<br />
Follow it, and you'll be a ConTeXt prodigee<br />
<br />
Pick up a pen and go 'n write<br />
On any part of ConTeXt that you like<br />
<br />
A wiki article, a blog post, are good places to start<br />
People reading them will relish the knowledge it imparts<br />
<br />
Write an example, show how things work<br />
Don't just hide there and lurk<br />
<br />
If nothing else, write about what you find confusing<br />
Others writing documentation may find it motivating<br />
<br />
On this note, this summary I'll end<br />
You were not offended, I'll pretend<br />
<br />
Finally a request, if I may<br />
Let me be anonymous, please, I pray<br />
<br />
A promise in passing, I'll also make<br />
Someday a ConTeXt book or tutorial, I may bake<br />
<br />
I am waiting for time and a muse<br />
At least, that is my excuse<br />
<br />
<br />
<br />
-- A ConTeXt User<br />
<br />
<br />
</pre><br />
<br />
* Later in the thread Idris told how his name should be pronounced<br />
<pre><br />
&gt;&gt;&gt; (Actually when I was writing this chronology<br />
&gt;&gt;&gt; Irdis was thinking about a typographical ontology)<br />
&gt;&gt;<br />
&gt;&gt; Who is this Irdis?<br />
<br />
&gt; Oh, my heart now bleeds<br />
&gt; That I couldn't spell the name of Prof Hamid<br />
<br />
Our anonymous YACU ran, slipped and had to skid,<br />
Neither did (s)he know how to rhyme with Hamid<br />
<br />
Accent in Hamid is on the first syllable,<br />
Otherwise pronouncing it will be untenable<br />
</pre><br />
<br />
Not a poem, but well written:<br />
[http://www.ntg.nl/pipermail/ntg-context/2010/048197.html by Arthur]<br />
<br />
== What if Hans were hit by a bus ==<br />
* Taco's brilliant [http://archive.contextgarden.net/message/20100403.065454.97ad25ba.en.html answer] to this question<br />
<br />
<pre><br />
&gt; This raises another concern and that is: what is the future of ConTeXt<br />
&gt; is Hans "get hit by the bus"? (Of course, we even do not want to think<br />
&gt; about it...)<br />
<br />
The answer to this question is quite obvious if you have read Douglas<br />
Adams' books: the bus will think about the impact of its actions on the<br />
universe for a moment. Then, deeply immersed in gut-wrenching shame,<br />
it will travel back in time half a minute and push its own breaks for<br />
an emergency stop.<br />
</pre><br />
<br />
== latex and LaTeX ==<br />
<br />
Taco Hoekwater [http://archive.contextgarden.net/message/20100911.100030.b6e30e98.en.html explaining] the similarity between latex and LaTeX<br />
<br />
<blockquote><br />
Creating beautiful latex garments is at least as challenging as creating beautiful LaTeX documents (I<br />
tried, in earlier days). And just like in LaTeX, the problem areas are glue control and insert<br />
placement. Selling latex garments is also similar to selling LaTeX books: it is quite a niche market and your clients are considered fetishists by most other people.<br />
</blockquote><br />
<br />
== ConTeXt logic ==<br />
<br />
Steffen Wolfrum [http://www.mail-archive.com/ntg-context@ntg.nl/msg22409.html bewildered] at ConTeXt syntax:<br />
<br />
<blockquote><br />
Sometimes ConTeXt's syntax looks kind of "female" to me:<br />
It certainly has an inner logic, but this is far more ... rich and varied as my <br />
single-minded, male structured mind would expect -)<br />
</blockquote><br />
<br />
== Where is my update? ==<br />
<br />
Vnpenguin was [http://www.mail-archive.com/ntg-context@ntg.nl/msg47711.html confused] why he was not able to update ConTeXt, until Hans resolved the mystery.<br />
<br />
<pre><br />
> Since one week, I update my minimal ConTeXt almost everyday (Win32<br />
> version), but the version is alway the same:<br />
<br />
sure, as i didn't update context for a week<br />
</pre><br />
<br />
== Can you run it for me? ==<br />
<br />
Peter Rolf asking R. Bastian [http://www.mail-archive.com/ntg-context@ntg.nl/msg49587.html not to be afraid]:<br />
<br />
<blockquote><br />
<p><br />
&gt; Does this work in Mk II ?<br />
</p><br />
<br />
<p><br />
You can set your mind at rest and test it yourself.<br />
The 'nuke_my_computer_by_running_context' module is no longer part of<br />
the official distribution ;-)<br />
</p><br />
</blockquote><br />
<br />
== Finite Life ==<br />
<br />
The following exchange between the Philosophers Ludovicus Scarso<br />
and Ioannes Hagenius could be observed on the mailing list[http://archive.contextgarden.net/message/20101218.131804.c250b741.en.html].<br />
<pre><br />
> Live is too short to learn all those languages and stay<br />
> fluent in them, i.e. one simply forgets a lot when usage zeros.<br />
we should start to think how to to become immortal.<br />
</pre><br />
<br />
== Installation chant ==<br />
<br />
Patrick shared this conversation on 2011-12-21:<br />
<pre><br />
Hello Marek,<br />
<br />
> Hi Mr. Gundla<br />
> Just want to say Im very dissapointed that no installing package of ConText exist. <br />
> I mean like you install things in Win – two cliks and Done!<br />
> I was studying ConText whole afternoon and i liked it – But – im very very sick of this kind of installing. <br />
> It just makes people like me to hate the whole thing about trying something else then MS Word. <br />
> I was eager to learn this ConText ant than BIIIIIIG! Frustration cause i could not run it. <br />
> All those versions of packages - i wanted to shoot myself.<br />
<br />
> Yea, i know you dont get paid for this, BUT - come on Mr. Gundla. <br />
> Is it that hard to make one ABSOLUTE DUMMY PACKAGE (you geeks can call it <br />
> how you want i know you like to use word dummies for people who are lesser geeks than you :) ) <br />
> two cliks and lalala! <br />
> Hello Word! You save afternoon to many other people :D Just think about it, ok?<br />
<br />
Well, ConTeXt _is_ hard to install. First you have to sacrifice one of your family members. <br />
Afterwards, you need to hum the magic chant in order to open your spirit. <br />
After you have done that, please draw a circle around your computer and put candles on it, making the shape of a pentagram. <br />
Now, and this is important, go six times clockwise around that circle, six times counter clockwise <br />
and then six times clockwise again. <br />
After that, turn on your computer and start your webbrowser and go to<br />
<br />
http://wiki.contextgarden.net/Simple_Windows_Installation<br />
<br />
and download the installer.<br />
<br />
Sincerely your Mr. Gundla<br />
</pre><br />
<br />
== Wolfgang Interface ==<br />
<br />
> Gosh this list is nice! Reminds me of the "good old days" when we<br />
> used UUCP, bang-paths and C-News to communicate (or the early<br />
> ARPANET days): polite, expert, very willing to share knowledge &c.<br />
<br />
Wolfgang is ConTeXt's natural language interface.<br />
<br />
In fact, with careful use of the filter module and a couple of mail<br />
programs, it should be possible to create something like:<br />
<texcode><br />
\usemodule[filter]<br />
<br />
\defineexternalfilter<br />
[wolfgang]<br />
[filtercommand={ ... code to send email and fetch reply ... },<br />
cache=yes]<br />
<br />
\startwolfgang<br />
Hello list,<br />
<br />
I wonder if anyone could tell me how to implement the following in<br />
ConTeXt.<br />
<br />
... description goes here ...<br />
\stopwolfgang<br />
</texcode><br />
It's important to include the cache=yes, so Wolfgang only has to reply<br />
once.<br />
<br />
= Comparison between various TeX and GUI systems =<br />
<br />
William Adam on the difference between [[Comparison_between_ConTeXt_and_other_typesetting_programs|TeX and other GUI document design systems]]<br />
<br />
= Pictures =<br />
<br />
== Future ConTeXt Users ==<br />
[[Future ConTeXt Users]]<br />
<br />
== Super Wolfgang ==<br />
<br />
A [http://meeting.contextgarden.net/2010/talks/2010-09-17-closing/wolfgang-color.jpg cartoon] by Duane Bibby at the Fourth ConTeXt meeting<br />
<br />
= Common errors =<br />
[[ Common Errors ]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Humour&diff=22671Humour2014-10-28T08:23:58Z<p>Braslau: remove spelling variant</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== A poem about documentation ==<br />
<br />
"Yet another context user" posted [http://archive.contextgarden.net/message/20100403.155801.7098c48a.en.html this poem] to the mailing list<br />
<br />
<pre><br />
If you were surprised, like me<br />
Fifty emails, in your inbox to see<br />
<br />
Let me help you with a summary<br />
Of what happended, using a poor excuse for poetry <br />
<br />
It was the day of fools<br />
When Arthur tried to be cool<br />
<br />
In ConTeXt mailing list he shouted, "Look<br />
I am going to write a ConTeXt book!"<br />
<br />
Everyone was happy and had a thrill<br />
Till Martin said, "it is the first of April"<br />
<br />
His joke ruined, Arthur was sad<br />
He said Martin, this is bad<br />
<br />
Other users were also upset, taken for a ride<br />
The lack of a book, is not a matter of pride<br />
<br />
There were cries and a big fuss<br />
I was just getting started, said Russ<br />
<br />
After that comments did pour<br />
Its not even funny, said Gour<br />
<br />
All of us would be out of luck<br />
If Hans were to be hit by a bus!<br />
<br />
Citing Douglas Adams said Taco<br />
That will make the bus, a shamed loco<br />
<br />
In time back it 'ill go<br />
And slam its breaks, like a pro<br />
<br />
Writing documentation is no fun<br />
It that the reason it is shun<br />
<br />
Even if you do write something<br />
Does anyone even read the damn thing?<br />
<br />
Taco lamented all he hears is that 'it sucks'<br />
Demotivated, he may just pass the buck<br />
<br />
"Oh please, don't let the project slack<br />
If you write something, we will give you feedback"<br />
<br />
This circle of arguments is always repeated<br />
Whenever the question of documentation gets tweeted<br />
<br />
A new conspiracy theory was added this time<br />
"They want to keep it a secret," it's a crime<br />
<br />
I am sick and tired of all the pretext<br />
Why do you think anyone should write a book on ConTeXt?<br />
<br />
Taco and Hans, their hands are full<br />
Everyone else is just using a tool<br />
<br />
(Actually when I was writing this chronology<br />
Irdis was thinking about a typographical ontology)<br />
<br />
If you think that the documentation is lacking<br />
Do something, rather than grumbling<br />
<br />
Here's a suggestion, if I may give to thee<br />
Follow it, and you'll be a ConTeXt prodigee<br />
<br />
Pick up a pen and go 'n write<br />
On any part of ConTeXt that you like<br />
<br />
A wiki article, a blog post, are good places to start<br />
People reading them will relish the knowledge it imparts<br />
<br />
Write an example, show how things work<br />
Don't just hide there and lurk<br />
<br />
If nothing else, write about what you find confusing<br />
Others writing documentation may find it motivating<br />
<br />
On this note, this summary I'll end<br />
You were not offended, I'll pretend<br />
<br />
Finally a request, if I may<br />
Let me be anonymous, please, I pray<br />
<br />
A promise in passing, I'll also make<br />
Someday a ConTeXt book or tutorial, I may bake<br />
<br />
I am waiting for time and a muse<br />
At least, that is my excuse<br />
<br />
<br />
<br />
-- A ConTeXt User<br />
<br />
<br />
</pre><br />
<br />
* Later in the thread Idris told how his name should be pronounced<br />
<pre><br />
&gt;&gt;&gt; (Actually when I was writing this chronology<br />
&gt;&gt;&gt; Irdis was thinking about a typographical ontology)<br />
&gt;&gt;<br />
&gt;&gt; Who is this Irdis?<br />
<br />
&gt; Oh, my heart now bleeds<br />
&gt; That I couldn't spell the name of Prof Hamid<br />
<br />
Our anonymous YACU ran, slipped and had to skid,<br />
Neither did (s)he know how to rhyme with Hamid<br />
<br />
Accent in Hamid is on the first syllable,<br />
Otherwise pronouncing it will be untenable<br />
</pre><br />
<br />
Not a poem, but well written:<br />
[http://www.ntg.nl/pipermail/ntg-context/2010/048197.html by Arthur]<br />
<br />
== What if Hans were hit by a bus ==<br />
* Taco's brilliant [http://archive.contextgarden.net/message/20100403.065454.97ad25ba.en.html answer] to this question<br />
<br />
<pre><br />
&gt; This raises another concern and that is: what is the future of ConTeXt<br />
&gt; is Hans "get hit by the bus"? (Of course, we even do not want to think<br />
&gt; about it...)<br />
<br />
The answer to this question is quite obvious if you have read Douglas<br />
Adams' books: the bus will think about the impact of its actions on the<br />
universe for a moment. Then, deeply immersed in gut-wrenching shame,<br />
it will travel back in time half a minute and push its own breaks for<br />
an emergency stop.<br />
</pre><br />
<br />
== latex and LaTeX ==<br />
<br />
Taco Hoekwater [http://archive.contextgarden.net/message/20100911.100030.b6e30e98.en.html explaining] the similarity between latex and LaTeX<br />
<br />
<blockquote><br />
Creating beautiful latex garments is at least as challenging as creating beautiful LaTeX documents (I<br />
tried, in earlier days). And just like in LaTeX, the problem areas are glue control and insert<br />
placement. Selling latex garments is also similar to selling LaTeX books: it is quite a niche market and your clients are considered fetishists by most other people.<br />
</blockquote><br />
<br />
== ConTeXt logic ==<br />
<br />
Steffen Wolfrum [http://www.mail-archive.com/ntg-context@ntg.nl/msg22409.html bewildered] at ConTeXt syntax:<br />
<br />
<blockquote><br />
Sometimes ConTeXt's syntax looks kind of "female" to me:<br />
It certainly has an inner logic, but this is far more ... rich and varied as my <br />
single-minded, male structured mind would expect -)<br />
</blockquote><br />
<br />
== Where is my update? ==<br />
<br />
Vnpenguin was [http://www.mail-archive.com/ntg-context@ntg.nl/msg47711.html confused] why he was not able to update ConTeXt, until Hans resolved the mystery.<br />
<br />
<pre><br />
> Since one week, I update my minimal ConTeXt almost everyday (Win32<br />
> version), but the version is alway the same:<br />
<br />
sure, as i didn't update context for a week<br />
</pre><br />
<br />
== Can you run it for me? ==<br />
<br />
Peter Rolf asking R. Bastian [http://www.mail-archive.com/ntg-context@ntg.nl/msg49587.html not to be afraid]:<br />
<br />
<blockquote><br />
<p><br />
&gt; Does this work in Mk II ?<br />
</p><br />
<br />
<p><br />
You can set your mind at rest and test it yourself.<br />
The 'nuke_my_computer_by_running_context' module is no longer part of<br />
the official distribution ;-)<br />
</p><br />
</blockquote><br />
<br />
== Finite Life ==<br />
<br />
The following exchange between the Philosophers Ludovicus Scarso<br />
and Ioannes Hagenius could be observed on the mailing list[http://archive.contextgarden.net/message/20101218.131804.c250b741.en.html].<br />
<pre><br />
> Live is too short to learn all those languages and stay<br />
> fluent in them, i.e. one simply forgets a lot when usage zeros.<br />
we should start to think how to to become immortal.<br />
</pre><br />
<br />
== Installation chant ==<br />
<br />
Patrick shared this conversation on 2011-12-21:<br />
<pre><br />
Hello Marek,<br />
<br />
> Hi Mr. Gundla<br />
> Just want to say Im very dissapointed that no installing package of ConText exist. <br />
> I mean like you install things in Win – two cliks and Done!<br />
> I was studying ConText whole afternoon and i liked it – But – im very very sick of this kind of installing. <br />
> It just makes people like me to hate the whole thing about trying something else then MS Word. <br />
> I was eager to learn this ConText ant than BIIIIIIG! Frustration cause i could not run it. <br />
> All those versions of packages - i wanted to shoot myself.<br />
<br />
> Yea, i know you dont get paid for this, BUT - come on Mr. Gundla. <br />
> Is it that hard to make one ABSOLUTE DUMMY PACKAGE (you geeks can call it <br />
> how you want i know you like to use word dummies for people who are lesser geeks than you :) ) <br />
> two cliks and lalala! <br />
> Hello Word! You save afternoon to many other people :D Just think about it, ok?<br />
<br />
Well, ConTeXt _is_ hard to install. First you have to sacrifice one of your family members. <br />
Afterwards, you need to hum the magic chant in order to open your spirit. <br />
After you have done that, please draw a circle around your computer and put candles on it, making the shape of a pentagram. <br />
Now, and this is important, go six times clockwise around that circle, six times counter clockwise <br />
and then six times clockwise again. <br />
After that, turn on your computer and start your webbrowser and go to<br />
<br />
http://wiki.contextgarden.net/Simple_Windows_Installation<br />
<br />
and download the installer.<br />
<br />
Sincerely your Mr. Gundla<br />
</pre><br />
<br />
== Wolfgang Interface ==<br />
<br />
> Gosh this list is nice! Reminds me of the "good old days" when we<br />
> used UUCP, bang-paths and C-News to communicate (or the early<br />
> ARPANET days): polite, expert, very willing to share knowledge &c.<br />
<br />
Wolfgang is ConTeXt's natural language interface.<br />
<br />
In fact, with careful use of the filter module and a couple of mail<br />
programs, it should be possible to create something like:<br />
<texcode><br />
\usemodule[filter]<br />
<br />
\defineexternalfilter<br />
[wolfgang]<br />
[filtercommand={ ... code to send email and fetch reply ... },<br />
cache=yes]<br />
<br />
\startwolfgang<br />
Hello list,<br />
<br />
I wonder if anyone could tell me how to implement the following in<br />
ConTeXt.<br />
<br />
... description goes here ...<br />
\stopwolfgang<br />
</texcode><br />
It's important to include the cache=yes, so Wolfgang only has to reply<br />
once.<br />
<br />
= Comparison between various TeX and GUI systems =<br />
<br />
William Adam on the difference between [[Comparison_between_ConTeXt_and_other_typesetting_programs|TeX and other GUI document design systems]]<br />
<br />
= Pictures =<br />
<br />
== Future ConTeXt Users ==<br />
[[Future ConTeXt Users]]<br />
<br />
== Super Wolfgang ==<br />
<br />
A [http://meeting.contextgarden.net/2010/talks/2010-09-17-closing/wolfgang-color.jpg cartoon] by Duane Bibby at the Fourth ConTeXt meeting</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Humour&diff=22669Humour2014-10-28T08:22:06Z<p>Braslau: Added category "humour"</p>
<hr />
<div>< [[Main Page]] | [[Humour]] | [[Humor]] ><br />
<br />
== A poem about documentation ==<br />
<br />
"Yet another context user" posted [http://archive.contextgarden.net/message/20100403.155801.7098c48a.en.html this poem] to the mailing list<br />
<br />
<pre><br />
If you were surprised, like me<br />
Fifty emails, in your inbox to see<br />
<br />
Let me help you with a summary<br />
Of what happended, using a poor excuse for poetry <br />
<br />
It was the day of fools<br />
When Arthur tried to be cool<br />
<br />
In ConTeXt mailing list he shouted, "Look<br />
I am going to write a ConTeXt book!"<br />
<br />
Everyone was happy and had a thrill<br />
Till Martin said, "it is the first of April"<br />
<br />
His joke ruined, Arthur was sad<br />
He said Martin, this is bad<br />
<br />
Other users were also upset, taken for a ride<br />
The lack of a book, is not a matter of pride<br />
<br />
There were cries and a big fuss<br />
I was just getting started, said Russ<br />
<br />
After that comments did pour<br />
Its not even funny, said Gour<br />
<br />
All of us would be out of luck<br />
If Hans were to be hit by a bus!<br />
<br />
Citing Douglas Adams said Taco<br />
That will make the bus, a shamed loco<br />
<br />
In time back it 'ill go<br />
And slam its breaks, like a pro<br />
<br />
Writing documentation is no fun<br />
It that the reason it is shun<br />
<br />
Even if you do write something<br />
Does anyone even read the damn thing?<br />
<br />
Taco lamented all he hears is that 'it sucks'<br />
Demotivated, he may just pass the buck<br />
<br />
"Oh please, don't let the project slack<br />
If you write something, we will give you feedback"<br />
<br />
This circle of arguments is always repeated<br />
Whenever the question of documentation gets tweeted<br />
<br />
A new conspiracy theory was added this time<br />
"They want to keep it a secret," it's a crime<br />
<br />
I am sick and tired of all the pretext<br />
Why do you think anyone should write a book on ConTeXt?<br />
<br />
Taco and Hans, their hands are full<br />
Everyone else is just using a tool<br />
<br />
(Actually when I was writing this chronology<br />
Irdis was thinking about a typographical ontology)<br />
<br />
If you think that the documentation is lacking<br />
Do something, rather than grumbling<br />
<br />
Here's a suggestion, if I may give to thee<br />
Follow it, and you'll be a ConTeXt prodigee<br />
<br />
Pick up a pen and go 'n write<br />
On any part of ConTeXt that you like<br />
<br />
A wiki article, a blog post, are good places to start<br />
People reading them will relish the knowledge it imparts<br />
<br />
Write an example, show how things work<br />
Don't just hide there and lurk<br />
<br />
If nothing else, write about what you find confusing<br />
Others writing documentation may find it motivating<br />
<br />
On this note, this summary I'll end<br />
You were not offended, I'll pretend<br />
<br />
Finally a request, if I may<br />
Let me be anonymous, please, I pray<br />
<br />
A promise in passing, I'll also make<br />
Someday a ConTeXt book or tutorial, I may bake<br />
<br />
I am waiting for time and a muse<br />
At least, that is my excuse<br />
<br />
<br />
<br />
-- A ConTeXt User<br />
<br />
<br />
</pre><br />
<br />
* Later in the thread Idris told how his name should be pronounced<br />
<pre><br />
&gt;&gt;&gt; (Actually when I was writing this chronology<br />
&gt;&gt;&gt; Irdis was thinking about a typographical ontology)<br />
&gt;&gt;<br />
&gt;&gt; Who is this Irdis?<br />
<br />
&gt; Oh, my heart now bleeds<br />
&gt; That I couldn't spell the name of Prof Hamid<br />
<br />
Our anonymous YACU ran, slipped and had to skid,<br />
Neither did (s)he know how to rhyme with Hamid<br />
<br />
Accent in Hamid is on the first syllable,<br />
Otherwise pronouncing it will be untenable<br />
</pre><br />
<br />
Not a poem, but well written:<br />
[http://www.ntg.nl/pipermail/ntg-context/2010/048197.html by Arthur]<br />
<br />
== What if Hans were hit by a bus ==<br />
* Taco's brilliant [http://archive.contextgarden.net/message/20100403.065454.97ad25ba.en.html answer] to this question<br />
<br />
<pre><br />
&gt; This raises another concern and that is: what is the future of ConTeXt<br />
&gt; is Hans "get hit by the bus"? (Of course, we even do not want to think<br />
&gt; about it...)<br />
<br />
The answer to this question is quite obvious if you have read Douglas<br />
Adams' books: the bus will think about the impact of its actions on the<br />
universe for a moment. Then, deeply immersed in gut-wrenching shame,<br />
it will travel back in time half a minute and push its own breaks for<br />
an emergency stop.<br />
</pre><br />
<br />
== latex and LaTeX ==<br />
<br />
Taco Hoekwater [http://archive.contextgarden.net/message/20100911.100030.b6e30e98.en.html explaining] the similarity between latex and LaTeX<br />
<br />
<blockquote><br />
Creating beautiful latex garments is at least as challenging as creating beautiful LaTeX documents (I<br />
tried, in earlier days). And just like in LaTeX, the problem areas are glue control and insert<br />
placement. Selling latex garments is also similar to selling LaTeX books: it is quite a niche market and your clients are considered fetishists by most other people.<br />
</blockquote><br />
<br />
== ConTeXt logic ==<br />
<br />
Steffen Wolfrum [http://www.mail-archive.com/ntg-context@ntg.nl/msg22409.html bewildered] at ConTeXt syntax:<br />
<br />
<blockquote><br />
Sometimes ConTeXt's syntax looks kind of "female" to me:<br />
It certainly has an inner logic, but this is far more ... rich and varied as my <br />
single-minded, male structured mind would expect -)<br />
</blockquote><br />
<br />
== Where is my update? ==<br />
<br />
Vnpenguin was [http://www.mail-archive.com/ntg-context@ntg.nl/msg47711.html confused] why he was not able to update ConTeXt, until Hans resolved the mystery.<br />
<br />
<pre><br />
> Since one week, I update my minimal ConTeXt almost everyday (Win32<br />
> version), but the version is alway the same:<br />
<br />
sure, as i didn't update context for a week<br />
</pre><br />
<br />
== Can you run it for me? ==<br />
<br />
Peter Rolf asking R. Bastian [http://www.mail-archive.com/ntg-context@ntg.nl/msg49587.html not to be afraid]:<br />
<br />
<blockquote><br />
<p><br />
&gt; Does this work in Mk II ?<br />
</p><br />
<br />
<p><br />
You can set your mind at rest and test it yourself.<br />
The 'nuke_my_computer_by_running_context' module is no longer part of<br />
the official distribution ;-)<br />
</p><br />
</blockquote><br />
<br />
== Finite Life ==<br />
<br />
The following exchange between the Philosophers Ludovicus Scarso<br />
and Ioannes Hagenius could be observed on the mailing list[http://archive.contextgarden.net/message/20101218.131804.c250b741.en.html].<br />
<pre><br />
> Live is too short to learn all those languages and stay<br />
> fluent in them, i.e. one simply forgets a lot when usage zeros.<br />
we should start to think how to to become immortal.<br />
</pre><br />
<br />
== Installation chant ==<br />
<br />
Patrick shared this conversation on 2011-12-21:<br />
<pre><br />
Hello Marek,<br />
<br />
> Hi Mr. Gundla<br />
> Just want to say Im very dissapointed that no installing package of ConText exist. <br />
> I mean like you install things in Win – two cliks and Done!<br />
> I was studying ConText whole afternoon and i liked it – But – im very very sick of this kind of installing. <br />
> It just makes people like me to hate the whole thing about trying something else then MS Word. <br />
> I was eager to learn this ConText ant than BIIIIIIG! Frustration cause i could not run it. <br />
> All those versions of packages - i wanted to shoot myself.<br />
<br />
> Yea, i know you dont get paid for this, BUT - come on Mr. Gundla. <br />
> Is it that hard to make one ABSOLUTE DUMMY PACKAGE (you geeks can call it <br />
> how you want i know you like to use word dummies for people who are lesser geeks than you :) ) <br />
> two cliks and lalala! <br />
> Hello Word! You save afternoon to many other people :D Just think about it, ok?<br />
<br />
Well, ConTeXt _is_ hard to install. First you have to sacrifice one of your family members. <br />
Afterwards, you need to hum the magic chant in order to open your spirit. <br />
After you have done that, please draw a circle around your computer and put candles on it, making the shape of a pentagram. <br />
Now, and this is important, go six times clockwise around that circle, six times counter clockwise <br />
and then six times clockwise again. <br />
After that, turn on your computer and start your webbrowser and go to<br />
<br />
http://wiki.contextgarden.net/Simple_Windows_Installation<br />
<br />
and download the installer.<br />
<br />
Sincerely your Mr. Gundla<br />
</pre><br />
<br />
== Wolfgang Interface ==<br />
<br />
> Gosh this list is nice! Reminds me of the "good old days" when we<br />
> used UUCP, bang-paths and C-News to communicate (or the early<br />
> ARPANET days): polite, expert, very willing to share knowledge &c.<br />
<br />
Wolfgang is ConTeXt's natural language interface.<br />
<br />
In fact, with careful use of the filter module and a couple of mail<br />
programs, it should be possible to create something like:<br />
<texcode><br />
\usemodule[filter]<br />
<br />
\defineexternalfilter<br />
[wolfgang]<br />
[filtercommand={ ... code to send email and fetch reply ... },<br />
cache=yes]<br />
<br />
\startwolfgang<br />
Hello list,<br />
<br />
I wonder if anyone could tell me how to implement the following in<br />
ConTeXt.<br />
<br />
... description goes here ...<br />
\stopwolfgang<br />
</texcode><br />
It's important to include the cache=yes, so Wolfgang only has to reply<br />
once.<br />
<br />
= Comparison between various TeX and GUI systems =<br />
<br />
William Adam on the difference between [[Comparison_between_ConTeXt_and_other_typesetting_programs|TeX and other GUI document design systems]]<br />
<br />
= Pictures =<br />
<br />
== Future ConTeXt Users ==<br />
[[Future ConTeXt Users]]<br />
<br />
== Super Wolfgang ==<br />
<br />
A [http://meeting.contextgarden.net/2010/talks/2010-09-17-closing/wolfgang-color.jpg cartoon] by Duane Bibby at the Fourth ConTeXt meeting</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Common_errors&diff=22668Common errors2014-10-28T08:21:25Z<p>Braslau: Added category "humour"</p>
<hr />
<div>< [[Main Page]] | [[Humour]] | [[Humor]] ><br />
<br />
== Common ConTeXt Errors ==<br />
<br />
Here, we collect a list of your favorite, common ConTeXt coding errors. Look carefully to see what is wrong...<br />
<br />
* \startext<br />
<br />
* \stopMPage<br />
<br />
* \startchapter[title=Space, the final frontier]<br />
<br />
* \somecommand[parameter,key=value]<br />
<br />
* context text (after editing test.tex)<br />
<br />
Creative users are invited to add some real puzzlers here!<br />
<br />
== Common MetaPost Errors ==<br />
<br />
* i = i + 1 ;</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Common_errors&diff=22666Common errors2014-10-27T11:15:07Z<p>Braslau: new gotcha</p>
<hr />
<div>== Common ConTeXt Errors ==<br />
<br />
Here, we collect a list of your favorite, common ConTeXt coding errors. Look carefully to see what is wrong...<br />
<br />
* \startext<br />
<br />
* \stopMPage<br />
<br />
* \startchapter[title=Space, the final frontier]<br />
<br />
* context text (after editing test.tex)<br />
<br />
Creative users are invited to add some real puzzlers here!<br />
<br />
== Common MetaPost Errors ==<br />
<br />
* i = i + 1 ;</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Common_errors&diff=22665Common errors2014-10-27T11:07:31Z<p>Braslau: added section MetaPost errors</p>
<hr />
<div>== Common ConTeXt Errors ==<br />
<br />
Here, we collect a list of your favorite, common ConTeXt coding errors. Look carefully to see what is wrong...<br />
<br />
* \startext<br />
<br />
* \stopMPage<br />
<br />
* \startchapter[title=Space, the final frontier]<br />
<br />
Creative users are invited to add some real puzzlers here!<br />
<br />
== Common MetaPost Errors ==<br />
<br />
* i = i + 1 ;</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Common_errors&diff=22664Common errors2014-10-27T10:58:11Z<p>Braslau: created new page</p>
<hr />
<div>== Common ConTeXt Errors ==<br />
<br />
Here, we collect a list of your favorite, common ConTeXt coding errors. Look carefully to see what is wrong...<br />
<br />
* \startext<br />
<br />
* \stopMPage<br />
<br />
* \startchapter[title=Space, the final frontier]<br />
<br />
Creative users are invited to add some real puzzlers here!</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Font_Switching&diff=22227Font Switching2014-01-13T14:46:30Z<p>Braslau: Added warning concerning font changes at the beginning of a paragraph.</p>
<hr />
<div>< [[Basic Text Formatting]] | [[Fonts]] | [[Font Sizes]] ><br />
<br />
<br />
In ConTeXt there are four ways to switch fonts:<br />
<br />
* font style/alternative commands ({{cmd|rm}}, {{cmd|ss}}, etc.),<br />
* font size commands ({{cmd|tfa}}, {{cmd|tfb}}, etc.),<br />
* mnemonic command aliases ({{cmd|bold}}, {{cmd|sans}}, etc.),<br />
* a complete font change ({{cmd|setupbodyfont}}, {{cmd|switchtobodyfont}}).<br />
<br />
== Warning ==<br />
<br />
Placing a font switch at the begin of a paragraph can sometimes<br />
generate unexpected side-effets. This can be avoided by forcing<br />
horizontal mode before any font change:<br />
<texcode><br />
\dontleavehmode{\bf Warning!} Care must be taken when a font switch is used<br />
at the beginning of a paragraph.\par<br />
</texcode><br />
<br />
== Font styles and alternatives ==<br />
<br />
There are three main types of font styles: serif, sans serif, and teletype. To<br />
switch between these styles, use {{cmd|rm}} for serif, {{cmd|ss}} for<br />
sans serif, and {{cmd|tt}} for teletype.<br />
<br />
Each of these styles comes in different alternatives: normal, bold, italic,<br />
slanted, bold-italic, bold-slanted, and small-capped. To switch to a different<br />
alternative, use {{cmd|tf}} ("typeface") for normal, {{cmd|bf}} for bold, {{cmd|it}}<br />
for italic, {{cmd|sl}} for slanted, {{cmd|bi}} for bold-italic,<br />
{{cmd|bs}} for bold-slanted, and {{cmd|sc}} for small-capped.<br />
<br />
You can generally combine font styles with alternatives, so if you want to<br />
switch to bold sans serif, you can use either <code>\bf\ss</code> or<br />
<code>\ss\bf</code>. <br />
<br />
There is a font switch {{cmd|em}} to ''emphasize'' text. This is somewhat<br />
special: it does automatic italic correction and changes the alternative depending<br />
on the current alternative. For example, if the current font alternative is normal (i.e. upright),<br />
{{cmd|em}} switches to slanted; and if the current font alternative is slanted,<br />
{{cmd|em}} switches to normal.<br />
<br />
ConTeXt uses the Latin Modern fonts by default; these fonts look<br />
similar to the original Computer Modern fonts, but have a much larger<br />
character repertoire. As it happens, in the Latin Modern (and Computer<br />
Modern) fonts, the slanted font does not stand out from the<br />
upright font enough for some tastes; so, many people prefer to use the<br />
italic font for emphasis. To do that use <br />
<texcode><br />
\definebodyfontenvironment[default][em=italic]<br />
</texcode><br />
<br />
A font switch remains valid for the rest of the ''group''. So, if you want to<br />
temporarily switch to a different font, use the font style command inside a<br />
group. The easiest way to start a group is to enclose the text within braces<br />
(also called curly brackets), for example<br />
<br />
<texcode><br />
This is serif text<br />
{\ss This is sans serif}<br />
This is serif again<br />
{\tt and this is typewriter}<br />
And serif again<br />
</texcode><br />
<br />
which gives (notice the braces in the above lines)<br />
<br />
<context><br />
This is serif text \crlf<br />
{\ss This is sans serif} \crlf<br />
This is serif again \crlf<br />
{\tt and this is typewriter} \crlf<br />
And serif again<br />
</context><br />
<br />
== Font sizes ==<br />
<br />
Occasionally one needs to use a font size different from the bodyfont. ConTeXt provides two series<br />
of commands for that. For a larger font size, you can use {{cmd|tfa}} to scale<br />
the font size by a factor of <code>1.2</code>, {{cmd|tfb}} to scale by a factor of<br />
<code>(1.2)^2 = 1.44</code>, {{cmd|tfc}} to scale by <code>(1.2)^3 = 1.728</code> and {{cmd|tfd}} to<br />
scale by <code>(1.2)^4 = 2.074</code>. The scale is relative to the current bodyfont size.<br />
<br />
To decrease the font size, you can use {{cmd|tfx}}<br />
to scale the font by a factor of <code>0.8</code> and {{cmd|tfxx}} to scale by a factor<br />
of <code>0.6</code>.<br />
<br />
The mapping of particular command suffixes (a, x, etc.) and current bodyfont size to effective font size can<br />
be changed by {{cmd|definebodyfontenvironment}}.<br />
For example, if you want<br />
{{cmd|tfa}} to set the effective font size to 12pt when the bodyfont size is 10pt, and to set the effective font size to <br />
14pt when the bodyfont size is 11pt, then add<br />
<texcode><br />
\definebodyfontenvironment [10pt] [a=12pt]<br />
\definebodyfontenvironment [11pt] [a=14pt]<br />
</texcode><br />
{{cmd|definebodyfontenvironment}} is described in detail in <br />
the ConTeXt manual and the [[source:font-ini.tex|font-ini.tex]] source file.<br />
<br />
Font size can be combined with font styles. As a shortcut, you can use<br />
{{cmd|bfa}} to get bold font scaled by <code>1.2</code>, {{cmd|bfx}} to get a bold font<br />
scaled by <code>0.8</code> and similar commands for other font styles.<br />
<br />
These quick font switches are meant for changing the font style, alternative, or size of a few<br />
words: they do not change the bodyfont, so they don't affect interline spacing or math font sizes. So, if<br />
you want to change the font size of an entire paragraph, use<br />
{{cmd|switchtobodyfont}} described below in [[Font_Switching#Complete_font_change|Complete Font Change]]. However, it<br />
is fine to use them as style directives in setup commands, that is, using them<br />
as an option for <code>[[Style_and_Color_Parameters|style=]]...</code> in any setup command that accepts<br />
<code>style</code> option.<br />
<br />
== Mnemonic font switches ==<br />
<br />
While learning a document markup language like ConTeXt, it can be hard to<br />
remember all the commands. ConTeXt provides other, easy-to-remember font<br />
switches. So for bold you can use {{cmd|bold}}, for italic you can use<br />
{{cmd|italic}}, for slanted you can use {{cmd|slanted}}, and so on. You can<br />
probably guess what the following do:<br />
<br />
{|<br />
| {{cmd|normal}} <br />
| {{cmd|slanted}}<br />
|-<br />
| {{cmd|boldslanted}}<br />
| {{cmd|slantedbold}}<br />
|-<br />
| {{cmd|bolditalic}}<br />
| {{cmd|italicbold}}<br />
|-<br />
| {{cmd|small}}<br />
| {{cmd|smallnormal}}<br />
|-<br />
| {{cmd|smallbold}}<br />
| {{cmd|smallslanted}}<br />
|-<br />
| {{cmd|smallboldslanted}}<br />
| {{cmd|smallslantedbold}}<br />
|-<br />
| {{cmd|smallbolditalic}}<br />
| {{cmd|smallitalicbold}}<br />
|-<br />
| {{cmd|sans}}<br />
| {{cmd|sansserif}}<br />
|-<br />
| {{cmd|sansbold}}<br />
| {{cmd|smallcaps}} <br />
|}<br />
<br />
In addition, the commands {{cmd|smallbodyfont}} and<br />
{{cmd|bigbodyfont}} can be used to change the font size.<br />
<br />
These mnemonic font switches are pretty smart. You can either use them as<br />
font style switches inside a { ''group'' }, or as a font changing command that takes an<br />
argument. For example,<br />
<br />
<context source="yes"><br />
This is {\bold bold} and so is \bold{this}. But this is not.<br />
</context><br />
<br />
These mnemonic font switches can also be used for all <code>style=...</code><br />
options, and while using them as style options, you can just give the command<br />
name without the backslash. For example:<br />
<texcode><br />
\setuphead[section][style=bold] <br />
</texcode><br />
<br />
== Complete font (bodyfont) change ==<br />
<br />
If you need to change to a different font size and take care of interline<br />
spacing, you can change the bodyfont by using {{cmd|switchtobodyfont}}. For example, to switch to 12pt<br />
you can use <code>\switchtobodyfont[12pt]</code>.<br />
<br />
<br />
ConTeXt provides two relative sizes, called ''big'' and ''small''. So, to increase the bodyfont size, use <code>\switchtobodyfont[big]</code> (or <code>\setbigbodyfont</code>), and to decrease the bodyfont size, use <code>\switchtobodyfont[small]</code> (or <code>\setsmallbodyfont</code>). The exact<br />
size used for big and small can be set using <br />
{{cmd|definebodyfontenvironment}}.<br />
<br />
The {{cmd|setupbodyfont}} command accepts all the same arguments as<br />
{{cmd|switchtobodyfont}}. The difference between the two is that<br />
{{cmd|setupbodyfont}} also changes the font for headers, footers and other<br />
page markings, while {{cmd|switchtobodyfont}} does not. So you should use<br />
{{cmd|setupbodyfont}} for global font definitions to apply to the whole document, and<br />
{{cmd|switchtobodyfont}} for local font changes (i.e. changes to the running text only). The effect of<br />
{{cmd|switchtobodyfont}} can be localized within a group as usual.<br />
<br />
== Different typefaces ==<br />
<br />
So far we have discussed style and size changes within a given typeface<br />
family. If you want to use a different typeface altogether, such as Times or<br />
Palatino, the Pragma web site has recipes covering all the commonly available<br />
typefaces [http://pragma-ade.com/general/manuals/showfont.pdf], while a<br />
separate manual describes how to write support for new typefaces<br />
[http://pragma-ade.com/general/manuals/mfonts.pdf].<br />
<br />
The recipes as given work with the standalone ConTeXt distribution, but not<br />
with TeX Live et al. [http://pragma-ade.com/general/technotes/tfmetrics.pdf]<br />
explains why ConText uses separate font metrics, and gives some differences<br />
between the sets. To use the recipes with other distributions,<br />
try adding one of <code>\usetypescript[berry][ec]</code> or<br />
<code>\usetypescript[adobekb][ec]</code>.<br />
<br />
* [[Simple Typescript Example]]<br />
* [[Example with normal and condensed font variants]]<br />
* [[Linux Libertine on mkiv]]<br />
<br />
== Conclusion ==<br />
<br />
There are many other ways of choosing font styles in ConTeXt. If these<br />
basic styles do not satisfy your needs, have a look at the [[Manuals|manuals]],<br />
or ask on the [[ConTeXt Mailing Lists]].<br />
<br />
[[Category:Fonts]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Footnotes&diff=21703Footnotes2013-05-02T07:58:36Z<p>Braslau: automigrateinserts</p>
<hr />
<div>< [[Structurals]] | [[References]] ><br />
<br />
{{todo|This page needs to be reorganized: progression from simple to more complex use is a bit circular..}}<br />
<br />
==First View==<br />
<br />
<texcode><br />
\section{First}<br />
<br />
Way to \ConTeXt\footnote{First footnote.} is painful.<br />
<br />
\section{Second}<br />
<br />
But \ConTeXt\ is amazing.\footnote{Second footnote}<br />
<br />
\placetable<br />
{Complex Table\footnote{A table head footnote.}}<br />
{\startlocalfootnotes<br />
\placelegend<br />
{\starttable[|l|l|]<br />
\HL<br />
\NC First Column \NC Second Column \NC \FR<br />
\HL<br />
\NC East\footnote{Footnote inside graphic.} \NC North \NC \FR<br />
\NC West \NC South \NC \LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes}<br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\strut\vfill\<br />
\section{First}<br />
<br />
Way to \ConTeXt\footnote{First footnote.} is painful.<br />
<br />
\section{Second}<br />
<br />
But \ConTeXt\ is amazing.\footnote{Second footnote}<br />
<br />
\placetable<br />
{Complex Table\footnote{A table head footnote.}}<br />
{\startlocalfootnotes<br />
\placelegend<br />
{\starttable[|l|l|]<br />
\HL<br />
\NC First Column \NC Second Column \NC \FR<br />
\HL<br />
\NC East\footnote{Footnote inside graphic.} \NC North \NC \FR<br />
\NC West \NC South \NC \LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes}<br />
\stoptext<br />
</context><br />
<br />
Here we have footnotes of two outer ones, a local one (in the table) and a postponed one (in the graphic).<br />
<br />
==Basic Footnotes==<br />
<br />
For basic footnotes, simply use <cmd>footnote</cmd><tt>[reference]{footnote text}</tt>.<br />
The reference is optional, and can be used to refer to the same footnote again. Footnotes can be referenced with the usual <cmd>in</cmd> and <cmd>at</cmd> macros (see [[References]]), or the note itself can be reproduced with <cmd>note</cmd><tt>[reference]</tt>. For example:<br />
<br />
<texcode><br />
This\footnote[footA](Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and \in{footnote}[footA] on \at{page}[footA], denoted by \note[footA].}. <br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote[footA](Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and \in{footnote}[footA] on \at{page}[footA], denoted by \note[footA].}. <br />
\stoptext<br />
</context><br />
<br />
<br />
Thanks to Oblomov, it's also possible to use footnotes in footnotes, as in this example.<br />
<br />
<texcode><br />
This\footnote(Or that\footnote{Or possibly even the other.}, if you prefer.} is a sentence<br />
with a footnote. <br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote(Or that\footnote{Or possibly even the other.}, if you prefer.} is a sentence<br />
with a footnote. <br />
\stoptext<br />
</context><br />
<br />
<br />
==Footnote Numbering==<br />
<br />
You can setup the exact behaviour of footnotes as usual with <cmd>setupfootnotes</cmd>. For example, to use footnotes with standard footnote symbols (which ConTeXt has defined as the conversion "set 2"), with the footnote counter resetting on each page, one would use the following:<br />
<br />
<texcode><br />
\setupfootnotes[way=bypage, conversion=set 2]<br />
</texcode><br />
<br />
Beware, in MkIV this became<br />
<br />
<texcode><br />
\setupnotation[footnote][way=bypage,numberconversion=set 2]<br />
</texcode><br />
<br />
This produces the following footnotes, using the text of the previous example.<br />
<br />
<context><br />
\setupfootnotes[way=bypage, conversion=set 2]<br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote[footA](Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and \in{footnote}[footA] on \at{page}[footA], denoted by \note[footA].}. <br />
\stoptext<br />
</context><br />
<br />
==Alternate Footnote Locations==<br />
<br />
The <cmd>setupfootnotes</cmd> command offers some options for the placement of footnotes; for instance, the <code>location=columns</code> option places the footnotes in a single column (of a multicolumn page) rather than across the whole page. The <code>location=text</code> option places the footnotes in text at a location specified by <cmd>placefootnotes</cmd>; this can be easily used to create endnotes, or even to place footnotes after each paragraph or subsection.<br />
<br />
<texcode><br />
\setupfootnotes[location=text]<br />
This\footnote[footA]{Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and footnote \note[footA].}. <br />
\placefootnotes<br />
This is some more text, with more footnotes\footnote{Specifically, this one.}.<br />
\placefootnotes<br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\setupfootnotes[location=text]<br />
This\footnote[footA]{Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and footnote \note[footA].}. <br />
\placefootnotes<br />
This is some more text, with more footnotes\footnote{Specifically, this one.}.<br />
\placefootnotes<br />
\stoptext<br />
</context><br />
<br />
==Footnote Formatting==<br />
<br />
You can change the font used in the footnotes with<br />
<cmd>setupfootnotedefinition</cmd><code>[before=\MyFontCommand]</code>.<br />
<br />
Footnotes can be placed in multiple columns, using the <tt>n=<i>number</i></tt> option in <cmd>setupfootnotes</cmd> (in latest betas it should be added to <cmd>setupnotes</cmd> or <cmd>setupnote</cmd> instead).<br />
<br />
<texcode><br />
\setupfootnotes[n=3]<br />
This\footnote[footA](Or that\footnote{Or the other.}, if you prefer.} is a sentence<br />
with a footnote\footnote{Actually, two footnotes; this one and \in{footnote}[footA]<br />
on \at{page}[footA], denoted by \note[footA].}. <br />
</texcode><br />
<br />
<context><br />
\setupfootnotes[n=3]<br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote[footA](Or that\footnote{Or the other.}, if you prefer.} is a sentence<br />
with a footnote\footnote{Actually, two footnotes; this one and \in{footnote}[footA]<br />
on \at{page}[footA], denoted by \note[footA].}. <br />
\stoptext<br />
</context><br />
<br />
{{todo|This is ugly, and points up some ConTeXt bugs that need to be fixed.}}<br />
<br />
==Footnotes in Floats==<br />
<br />
[[Floating Objects|Floats]] cannot include normal footnotes, because they are likely to float to another page from the page on which they were defined, thus getting the footnotes out of order. Thus, to include footnotes in a float, one must use local footnotes. This table, which uses the <cmd>placelegend</cmd> command to create a place for the footnotes, illustrates the process:<br />
<br />
<texcode><br />
\startlocalfootnotes[n=2]<br />
\placetable{A table with footnotes.}<br />
\placelegend<br />
{\starttable[|l|r|]<br />
\HL<br />
\VL One\footnote{First} \VL Two\footnote{Second} \VL\FR<br />
\VL Three\footnote{Third} \VL Four\footnote{Fourth} \VL\LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes<br />
</texcode><br />
<br />
<context><br />
\startlocalfootnotes[n=2]<br />
\placetable{A table with footnotes.}<br />
\placelegend<br />
{\strut\starttable[|l|r|]<br />
\HL<br />
\VL One\footnote{First} \VL Two\footnote{Second} \VL\FR<br />
\VL Three\footnote{Third} \VL Four\footnote{Fourth} \VL\LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes<br />
</context><br />
<br />
When using natural tables, the above leads to alignment problems. An alternative is to use:<br />
<br />
<texcode><br />
\defineframed[noteframed]<br />
\setupframed[noteframed]<br />
[width=\hsize,<br />
frame=off,<br />
align=right,<br />
%height=fit,<br />
top=\hbox\bgroup,<br />
bottom=\egroup]<br />
<br />
\starttext<br />
<br />
\startlocalfootnotes[n=0]<br />
\placetable<br />
{Caption}<br />
{\placelegend<br />
{\bTABLE<br />
\bTR\bTD One\footnote{First} \eTD\bTD Two\footnote{Second} \eTD\eTR<br />
\bTR\bTD Three\footnote{Third} \eTD\bTD Four\footnote{Fourth} \eTD\eTR<br />
\eTABLE}<br />
{\noteframed{\placelocalfootnotes}}}<br />
\stoplocalfootnotes<br />
<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
\defineframed[noteframed]<br />
\setupframed[noteframed]<br />
[width=\hsize,<br />
frame=off,<br />
align=right,<br />
%height=fit,<br />
top=\hbox\bgroup,<br />
bottom=\egroup]<br />
<br />
\starttext<br />
<br />
\startlocalfootnotes[n=0]<br />
\placetable<br />
{Caption}<br />
{\placelegend<br />
{\bTABLE<br />
\bTR\bTD One\footnote{First} \eTD\bTD Two\footnote{Second} \eTD\eTR<br />
\bTR\bTD Three\footnote{Third} \eTD\bTD Four\footnote{Fourth} \eTD\eTR<br />
\eTABLE}<br />
{\noteframed{\placelocalfootnotes}}}<br />
\stoplocalfootnotes<br />
<br />
\stoptext<br />
</context><br />
<br />
==Footnotes in a box==<br />
<br />
Note that it is necessary to add the command <cmd>automigrateinserts</cmd><br />
(for example before <cmd>starttext</cmd>)<br />
in order to correctly handle the placement of footnotes within a box such as <cmd>framed</cmd> or <cmd>placeongrid</cmd>...<br />
<br />
==Placing Footnotes Manually==<br />
<br />
In some cases, ConTeXt's footnoting system may not be able to do exactly what you want. For instance, you may want to place a footnote in a table so that the footnote appears with the rest of the footnotes on the page, or you may want to create a footnote to a footnote to a footnote. Many of these cases can be handled by using the <cmd>footnotetext</cmd> command (which creates a footnote without placing the corresponding symbol in the text) and the <cmd>note</cmd> command (which places the footnote symbol in the text, but does not create a footnote).<br />
<br />
For example, to create a footnote to a footnote to a footnote, all but the first footnotes are created with <cmd>footnotetext</cmd> commands, which are placed in the main text -- thereby ensuring that the footnotes are numbered and appear in the correct order. Then, these footnotes are referenced by <cmd>note</cmd> commands within the relevant footnotes. In this example, the lines are broken for clarity; note the <tt>%</tt> at the end of each line to prevent spurious spaces in the text.<br />
<br />
<texcode><br />
This%<br />
\footnote{Or that\note[footB], if you prefer.}%<br />
\footnotetext[footB]{Or possibly even the other\note[footC].}%<br />
\footnotetext[footC]{It could be something entirely different.}<br />
is a sentence with nested footnotes.<br />
</texcode><br />
<br />
<context><br />
\strut\vfill<br />
This%<br />
\footnote{Or that\note[footB], if you prefer.}%<br />
\footnotetext[footB]{Or possibly even the other\note[footC].}%<br />
\footnotetext[footC]{It could be something entirely different.}<br />
is a sentence with nested footnotes.<br />
</context><br />
<br />
== Color of Footnote Links that Refer to the Same Page ==<br />
<br />
If you have set footnotes to be interactive and have noticed that your footnote links become red, it is because they are linked to content on the same page on which they appear. This means they are governed by the \setupinteraction attribute of 'contrastcolor', rather than 'color'.<br />
<br />
To fix the redness (or change it to a different color), try:<br />
<br />
<texcode><br />
\setupinteraction[state=start,color=black,contrastcolor=black]<br />
</texcode><br />
<br />
== Special Needs ==<br />
There are numerous ways to display and format footnotes. The following section gathers solutions to some special tasks asked on the mailing list.<br />
<br />
* Is there a way to turn off hyphenation for the main body of my text, but enable it for the footnotes?<br />
<br />
<texcode><br />
\starttext<br />
<br />
\setupnote[footnote][align={normal,hyphenated}]<br />
<br />
\setupalign[hyphenated] \input tufte \footnote{\input tufte \relax} \par<br />
<br />
\setupalign[nothyphenated,stretch,tolerant] \input tufte<br />
\footnote{\input tufte \relax} \par<br />
<br />
\stoptext<br />
</texcode><br />
<br />
* Currently, footnotes are set so that the left end of the text of the footnote is aligned with the left edge of the text, and the footnote number hangs out into the margin. Is it possible to change this? (For instance, suppose I would like the number aligned to the text-edge, and then a fixed-width space, and then the text?)<br />
<br />
This behavior is controlled by the <code>location</code> key in the <code>\setupnotation</code> command. Here are some examples:<br />
<br />
Note number is typeset in an area with a width of 1cm, aligned at the left of the text area:<br />
<br />
<context source="yes" text="produces"><br />
\definepapersize[wiki][width=8cm,height=8cm]<br />
<br />
\setuppapersize[wiki][wiki]<br />
<br />
\starttext<br />
<br />
\showframe<br />
<br />
\setupnotation[footnote][location=left,width=1cm]<br />
\setupnote[footnote][location=page,numbercommand=]<br />
<br />
test \footnote{test}<br />
<br />
\stoptext <br />
</context><br />
<br />
<br />
Suppose that one wants a width of 1.5em. Then<br />
<br />
<texcode><br />
\setupnote[footnote][margindistance=0em,command=\myfootnotecommand]<br />
\setupnotation[footnote][location=left,hang=1]<br />
<br />
\def\myfootnotecommand#1{\hbox to 1.5em{#1.}}<br />
</texcode><br />
<br />
* Can I change the line spacing of a footnote independently of that of the main text?<br />
<br />
The way to do this is not obvious, but this is the code you need to use:<br />
<br />
<texcode><br />
\def\setnotebodyfont<br />
{\switchtobodyfont[your desired font size]\setupinterlinespace[your desired spacing]} <br />
</texcode></div>Braslauhttps://wiki.contextgarden.net/index.php?title=Floating_Objects&diff=21556Floating Objects2013-04-20T16:41:08Z<p>Braslau: Fixed landscape floats</p>
<hr />
<div>< [[Visuals]] | [[Graphics]] | [[Using Graphics]] ><br />
<br />
Floats are elements like tables or figures that are placed (and numbered) automatically by TeX. They are so called as they can ''float'' around the output pages to a place where TeX thinks they are appropriate (You can influence what TeX thinks as appropriate).<br />
<br />
Floats are ConTeXt's "base class" for everything that uses a <tt>\place...</tt> command (table, figure, own floats).<br />
<br />
If you search options of e.g. <cmd>placeexternalfigure</cmd> you must look after <cmd>placefloat</cmd> in the manual! (same for <tt>\setup...</tt> etc.)<br />
<br />
The float types "graphic", "figure", "table" and "intermezzo" are readily defined. If you need more (i.e. if you need another numbering or table of something), you can easily define your own floats with <cmd>definefloat</cmd>.<br />
<br />
<texcode><br />
\placefloat[place][reference]{caption}{some float}<br />
</texcode><br />
<br />
'''place''' is one or several (comma separated) of:<br />
<table><br />
<tr bgcolor="#AAAAAA"><th>preference</th><th align="left">result</th></tr><br />
<tr bgcolor="#DDDDDD"><td>left</td><td>left of text</td></tr><br />
<tr><td>right</td><td>right of text</td></tr><br />
<tr bgcolor="#DDDDDD"><td>here</td><td>preferably here</td></tr><br />
<tr><td>top</td><td>at top of page</td></tr><br />
<tr bgcolor="#DDDDDD"><td>bottom</td><td>at bottom of page</td></tr><br />
<tr><td>inleft</td><td>in left margin</td></tr><br />
<tr bgcolor="#DDDDDD"><td>inright</td><td>in right margin</td></tr><br />
<tr><td>inmargin</td><td>in the margin (left or right)</td></tr><br />
<tr bgcolor="#DDDDDD"><td>margin</td><td>in the margin (margin float)</td></tr><br />
<tr><td>page</td><td>on a new (empty) page</td></tr><br />
<tr bgcolor="#DDDDDD"><td>opposite</td><td>on the left page</td></tr><br />
<tr><td>90</td><td>orientation (rotation angle), both caption and contents</td></tr><br />
<tr bgcolor="#DDDDDD"><td>always</td><td>precedence over stored floats</td></tr><br />
<tr><td>force</td><td>per se here</td></tr><br />
<tr bgcolor="#DDDDDD"><td>split</td><td>(For TABLES only) split tables</td></tr><br />
</table><br />
(table copied from the manual)<br />
<br />
<cmd>placefigure</cmd> and <cmd>placetable</cmd> also accept the same set of options, and allow to create floating figures and captions respectively.<br />
<br />
'''reference'''<br />
<br />
If you don't need to refer to your float, you can leave this parameter out.<br />
<br />
== Examples ==<br />
I will explain the examples in terms of <cmd>placefigure</cmd> but the same set of options are also valid for other floats.<br />
<br />
* If you do not want a caption<br />
<br />
<texcode><br />
\placefigure[none] {} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
<br />
* If you do not want the figure to be numbered (but still want the caption)<br />
<br />
<texcode><br />
\placefigure [nonumber] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
* Suppose you want the figure to be placed on the right side of the page, a few lines into the paragraph, and want the rest of the paragraph to wrap around the figure<br />
<br />
<texcode><br />
\placefigure [right,2*line] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
or <br />
<br />
<texcode><br />
\placefigure [right,2*hang] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
This does not work correctly at a page boundary. The <tt>line</tt> option leaves the space above the figures empty, while the <tt>hang</tt> option also wraps texts above the figure.<br />
<br />
==Floats and columns==<br />
<br />
This special case is discussed [[Columns#Floats_and_other_limitations_of_columns|here]].<br />
<br />
==Protruding Floats in Double-Sided Documents==<br />
<br />
If you have a double-sided document with wide outer margins then you might want your figures to protrude into the margin. In a double-sided document you need to tell ConTeXt to decide whether to make the figure protrude to the left or the right. This can be done as follows:<br />
<br />
<texcode><br />
\definefloat[textmarginfigure][textmarginfigures]<br />
\setupfloat[textmarginfigure][location=inner]<br />
\placetextmarginfigure{\externalfigure[figurename]}<br />
</texcode><br />
<br />
The following code gives a full example that can be pasted into live ConTeXt:<br />
<br />
<texcode><br />
\setuppagenumbering [alternative=doublesided]<br />
\setuplayout[location=middle,backspace=2pc, width=20pc]<br />
\definefloat[textmarginfigure][textmarginfigures]<br />
\setupfloat[textmarginfigure][location=inner]<br />
\starttext<br />
\input knuth<br />
\placetextmarginfigure[here]{}{\externalfigure[figurename][width=30pc]}<br />
\input knuth<br />
\placetextmarginfigure[here]{}{\externalfigure[figurename][width=30pc]}<br />
\input knuth<br />
\stoptext<br />
</texcode><br />
<br />
==Landscape Floats in a Portrait Document==<br />
Wide tables, for example, can be turned and most likely will need to be put on a separate page.<br />
<texcode><br />
\startplacetable [location={page,90},title=Table caption]<br />
\bTABLE [textwidth=\textheight]<br />
put a wide table here...<br />
\eTABLE<br />
\stopplacetable<br />
</texcode><br />
Both the table caption and the contents will be rotated, but not the page header and footer which remain "upright". Notice that one must set the TABLE textwidth to <cmd>textheight</cmd> in order for the table macros to fit properly.<br />
<br />
== Floats and section headings ==<br />
By default, section headings don't wrap "around" floating objects. Instead, they will be moved down as far as needed to appear below the float. This behaviour can be controlled using the <tt>aligntitle</tt> option of the <cmd>setupheads</cmd> or <cmd>setuphead</cmd> commands.<br />
<br />
== Captions ==<br />
To change the style of figure(table) captions, use <cmd>setupcaptions</cmd>.<br />
<br />
To use a different (e.g. abbreviated) caption in the list of floats, you can do:<br />
<br />
<texcode><br />
\defineselector[caption][max=2,n=2]<br />
\starttext<br />
\setupselector[caption][n=1]<br />
\completelistoffigures<br />
\setupselector[caption][n=2]<br />
\placefigure[][]<br />
{\select{caption}<br />
{Short caption for list}<br />
{A rather longer caption which will appear below the figure itself}}<br />
{This is the content of the actual figure}<br />
\stoptext<br />
</texcode><br />
<br />
Or in more recent (circa November 2011 and later) versions of ConTeXt:<br />
<br />
<texcode><br />
\startplacefigure[title={A rather long caption},list={A short caption}]<br />
This is the content of the actual figure<br />
\stopplacefigure<br />
</texcode><br />
<br />
== Flushing floats ==<br />
<br />
The command <cmd>placefloats</cmd> outputs all pending floats.</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Floating_Objects&diff=21553Floating Objects2013-04-20T14:02:15Z<p>Braslau: added section on rotated floats</p>
<hr />
<div>< [[Visuals]] | [[Graphics]] | [[Using Graphics]] ><br />
<br />
Floats are elements like tables or figures that are placed (and numbered) automatically by TeX. They are so called as they can ''float'' around the output pages to a place where TeX thinks they are appropriate (You can influence what TeX thinks as appropriate).<br />
<br />
Floats are ConTeXt's "base class" for everything that uses a <tt>\place...</tt> command (table, figure, own floats).<br />
<br />
If you search options of e.g. <cmd>placeexternalfigure</cmd> you must look after <cmd>placefloat</cmd> in the manual! (same for <tt>\setup...</tt> etc.)<br />
<br />
The float types "graphic", "figure", "table" and "intermezzo" are readily defined. If you need more (i.e. if you need another numbering or table of something), you can easily define your own floats with <cmd>definefloat</cmd>.<br />
<br />
<texcode><br />
\placefloat[place][reference]{caption}{some float}<br />
</texcode><br />
<br />
'''place''' is one or several (comma separated) of:<br />
<table><br />
<tr bgcolor="#AAAAAA"><th>preference</th><th align="left">result</th></tr><br />
<tr bgcolor="#DDDDDD"><td>left</td><td>left of text</td></tr><br />
<tr><td>right</td><td>right of text</td></tr><br />
<tr bgcolor="#DDDDDD"><td>here</td><td>preferably here</td></tr><br />
<tr><td>top</td><td>at top of page</td></tr><br />
<tr bgcolor="#DDDDDD"><td>bottom</td><td>at bottom of page</td></tr><br />
<tr><td>inleft</td><td>in left margin</td></tr><br />
<tr bgcolor="#DDDDDD"><td>inright</td><td>in right margin</td></tr><br />
<tr><td>inmargin</td><td>in the margin (left or right)</td></tr><br />
<tr bgcolor="#DDDDDD"><td>margin</td><td>in the margin (margin float)</td></tr><br />
<tr><td>page</td><td>on a new (empty) page</td></tr><br />
<tr bgcolor="#DDDDDD"><td>opposite</td><td>on the left page</td></tr><br />
<tr><td>90</td><td>orientation (rotation angle), both caption and contents</td></tr><br />
<tr bgcolor="#DDDDDD"><td>always</td><td>precedence over stored floats</td></tr><br />
<tr><td>force</td><td>per se here</td></tr><br />
<tr bgcolor="#DDDDDD"><td>split</td><td>(For TABLES only) split tables</td></tr><br />
</table><br />
(table copied from the manual)<br />
<br />
<cmd>placefigure</cmd> and <cmd>placetable</cmd> also accept the same set of options, and allow to create floating figures and captions respectively.<br />
<br />
'''reference'''<br />
<br />
If you don't need to refer to your float, you can leave this parameter out.<br />
<br />
== Examples ==<br />
I will explain the examples in terms of <cmd>placefigure</cmd> but the same set of options are also valid for other floats.<br />
<br />
* If you do not want a caption<br />
<br />
<texcode><br />
\placefigure[none] {} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
<br />
* If you do not want the figure to be numbered (but still want the caption)<br />
<br />
<texcode><br />
\placefigure [nonumber] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
* Suppose you want the figure to be placed on the right side of the page, a few lines into the paragraph, and want the rest of the paragraph to wrap around the figure<br />
<br />
<texcode><br />
\placefigure [right,2*line] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
or <br />
<br />
<texcode><br />
\placefigure [right,2*hang] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
This does not work correctly at a page boundary. The <tt>line</tt> option leaves the space above the figures empty, while the <tt>hang</tt> option also wraps texts above the figure.<br />
<br />
==Floats and columns==<br />
<br />
This special case is discussed [[Columns#Floats_and_other_limitations_of_columns|here]].<br />
<br />
==Protruding Floats in Double-Sided Documents==<br />
<br />
If you have a double-sided document with wide outer margins then you might want your figures to protrude into the margin. In a double-sided document you need to tell ConTeXt to decide whether to make the figure protrude to the left or the right. This can be done as follows:<br />
<br />
<texcode><br />
\definefloat[textmarginfigure][textmarginfigures]<br />
\setupfloat[textmarginfigure][location=inner]<br />
\placetextmarginfigure{\externalfigure[figurename]}<br />
</texcode><br />
<br />
The following code gives a full example that can be pasted into live ConTeXt:<br />
<br />
<texcode><br />
\setuppagenumbering [alternative=doublesided]<br />
\setuplayout[location=middle,backspace=2pc, width=20pc]<br />
\definefloat[textmarginfigure][textmarginfigures]<br />
\setupfloat[textmarginfigure][location=inner]<br />
\starttext<br />
\input knuth<br />
\placetextmarginfigure[here]{}{\externalfigure[figurename][width=30pc]}<br />
\input knuth<br />
\placetextmarginfigure[here]{}{\externalfigure[figurename][width=30pc]}<br />
\input knuth<br />
\stoptext<br />
</texcode><br />
<br />
==Landscape Floats in a Portrait Document==<br />
Wide tables, for example, can be turned and most likely will need to be put on a separate page.<br />
<texcode><br />
\startplacetable [location={page,90},title=Table caption]<br />
\startTEXpage [width=\textheight]<br />
put a wide table here...<br />
\stopTEXpage<br />
\stopplacetable<br />
</texcode><br />
Both the table caption and the contents will be rotated, but not the page header and footer which remain "upright". The <cmd>startTEXpage</cmd> <cmd>stopTEXpage</cmd> is a trick to allow table macros to work correctly.<br />
<br />
== Floats and section headings ==<br />
By default, section headings don't wrap "around" floating objects. Instead, they will be moved down as far as needed to appear below the float. This behaviour can be controlled using the <tt>aligntitle</tt> option of the <cmd>setupheads</cmd> or <cmd>setuphead</cmd> commands.<br />
<br />
== Captions ==<br />
To change the style of figure(table) captions, use <cmd>setupcaptions</cmd>.<br />
<br />
To use a different (e.g. abbreviated) caption in the list of floats, you can do:<br />
<br />
<texcode><br />
\defineselector[caption][max=2,n=2]<br />
\starttext<br />
\setupselector[caption][n=1]<br />
\completelistoffigures<br />
\setupselector[caption][n=2]<br />
\placefigure[][]<br />
{\select{caption}<br />
{Short caption for list}<br />
{A rather longer caption which will appear below the figure itself}}<br />
{This is the content of the actual figure}<br />
\stoptext<br />
</texcode><br />
<br />
Or in more recent (circa November 2011 and later) versions of ConTeXt:<br />
<br />
<texcode><br />
\startplacefigure[title={A rather long caption},list={A short caption}]<br />
This is the content of the actual figure<br />
\stopplacefigure<br />
</texcode><br />
<br />
== Flushing floats ==<br />
<br />
The command <cmd>placefloats</cmd> outputs all pending floats.</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Quotes&diff=21484Quotes2013-03-24T18:59:57Z<p>Braslau: Modified the example setting in small type.</p>
<hr />
<div>< [[Visuals]]<br />
<br />
==Basic commands==<br />
<br />
Don't try to type quotation marks, but use logical markup!<br />
Quotation marks and formatting are language dependent.<br />
<br />
; single quotes : {{cmd|quote|{some text}}}<br />
; double quotes : {{cmd|quotation|{some text}}}<br />
; long quote sections : try {{cmd|startquote}} or {{cmd|startquotation}} etc.<br />
<br />
<br />
==Nested quotations==<br />
<br />
The following commands can be used to automatically nest double and single quotes.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
<br />
\setupdelimitedtext<br />
[quotation]<br />
[1]<br />
[left={\symbol[leftquotation]},<br />
right={\symbol[rightquotation]}]<br />
<br />
\setupdelimitedtext<br />
[quotation]<br />
[2]<br />
[left={\symbol[leftquote]},<br />
right={\symbol[rightquote]}]<br />
<br />
\setupdelimitedtext<br />
[quotation]<br />
[3]<br />
[left={\symbol[leftquotation]},<br />
right={\symbol[rightquotation]}]<br />
<br />
\quotation{A long quotation in which one character says,<br />
\quotation{Eh? What am I supposed to say? Something like, \quotation<br />
{Quotations in this sentance are nested}?}}<br />
</context><br />
<br />
<br />
==Nested quotations in MkIV==<br />
<br />
<context source="yes"><br />
\enableregime[utf]<br />
<br />
\setuplanguage[cz]<br />
[leftquotation=„,<br />
rightquotation=“,<br />
leftquote=‚,<br />
rightquote=‘]<br />
<br />
\mainlanguage[cz]<br />
<br />
\starttext<br />
Following example is not correct. Typography rules for Czech language <br />
for quotes \quotation{of text in quotes define \quotation{nested inner} quotes}.<br />
<br />
And now correct version. Typography rules for Czech language for quotes<br />
\quotation{of text in quotes define to \quote{nested inner} quotes}.<br />
<br />
\setupdelimitedtext[quotation:1][left={\symbol[leftquotation]},right={\symbol[rightquotation]}]<br />
\setupdelimitedtext[quotation:2][left={\symbol[leftquote]}, right={\symbol[rightquote]}]<br />
<br />
Automatic nesting. Typography rules for Czech language for quotes \quotation{of <br />
text in quotes define to \quotation{nested inner} quotes}.<br />
<br />
\setupdelimitedtext[quotation:1][left=»,right=«]<br />
\setupdelimitedtext[quotation:2][left=›,right=‹]<br />
<br />
Another type of quotes now. Typography rules for Czech language for French quotes <br />
\quotation{of text in quotes define to \quotation{nested inner} quotes}.<br />
\stoptext <br />
<br />
</context><br />
<br />
==Long quotations and extracts==<br />
<br />
The following may serve as a guide to others in formatting long quotations or extracts:<br />
<br />
===Long quotations defined with {{cmd|definestartstop}}===<br />
<br />
In body text:<br />
<br />
<texcode><br />
\defineblank[extractdistance][3pt]<br />
<br />
\definestartstop[extract][<br />
before={\blank[extractdistance] % [extractdistance,force] causes spurious <br />
% overfull \hbox warnings<br />
\setupnarrower[left=1.5pc,right=1.5pc]<br />
\startnarrower[left,right]<br />
\noindent},<br />
after={\stopnarrower<br />
\blank[extractdistance]<br />
\indenting[yes]}]<br />
</texcode><br />
<br />
In footnotes:<br />
<br />
<texcode><br />
\defineblank[footenoteextractdistance][2.7pt]<br />
<br />
\definestartstop[fnextract][<br />
before={\blank[footenoteextractdistance]<br />
\setupnarrower[left=1.5pc,right=1.5pc]<br />
\startnarrower[left,right]<br />
\noindent},<br />
after={\stopnarrower<br />
\blank[footenoteextractdistance]<br />
\indenting[yes]}]<br />
</texcode><br />
<br />
===Long quotations defined with {{cmd|definedelimitedtext}} ===<br />
<br />
In body text:<br />
<br />
<texcode><br />
\defineblank[extractdistance][3pt]<br />
<br />
\definedelimitedtext[extract][blockquote]<br />
<br />
\setupdelimitedtext<br />
[extract]<br />
[spacebefore=extractdistance,<br />
leftmargin=1.5pc,<br />
before={\setupindenting[next]}]<br />
</texcode><br />
<br />
In footnotes:<br />
<br />
<texcode><br />
\defineblank[footenoteextractdistance][2.7pt]<br />
<br />
\definedelimitedtext[fnextract][blockquote]<br />
<br />
\setupdelimitedtext<br />
[fnextract]<br />
[spacebefore=footenoteextractdistance,<br />
leftmargin=1.5pc,<br />
before={\setupindenting[next]}]<br />
</texcode><br />
<br />
==Example using {{cmd|setupdelimitedtext}}==<br />
<br />
Here is how to get indented quotations set in small type:<br />
<context source="yes"><br />
%\setupdelimitedtext[blockquote][style={\setupbodyfont[small]}]<br />
\setupdelimitedtext[blockquote][style=\slx,before={\setupinterlinespace[line=2.4ex]}]<br />
Hello<br />
\startblockquote<br />
\input knuth<br />
%\par<br />
\stopblockquote<br />
Hello<br />
</context><br />
<br />
The {{cmd|par}} inside the block quotation keeps TeX's paragraph builder happy. Otherwise the last paragraph in the block quotation gets the wider linespacing of the outside environment rather than the narrower linespacing appropriate to the smaller text; Alternately, one can add <code>before={\setupinterlinespace}</code>, as shown above.<br />
<br />
Using {{code|1=style=small}} does not work as well as <code>style={\setupbodyfont[small]}</code> or <code>style={\setupbodyfont[9pt]}</code>, because {{code|small}} shrinks only the font size but not the linespacing. Alternately, by using <code>before={\setupinterlinespace}</code>, one can then use commands such as <code>style=\tfx</code>, setting the size relatively rather than absolutely, advantageous for nestling and for inclusion in footnotes, for example.<br />
<br />
{{Getting started navbox}}</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Command/setupMPinstance&diff=21396Command/setupMPinstance2013-01-26T15:31:29Z<p>Braslau: added method=scaled double</p>
<hr />
<div>{{Reference<br />
|name=setupMPinstance<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\setupMPinstance<span class="first" >[...]</span><span class="second" >[...,...=...,...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[...]</td><br />
<td>name </td><br />
</tr><br />
<tr valign="top" class="second"><br />
<td class="cmd">format</td><br />
<td>metafun mpost </td><br />
</tr><br />
<tr valign="top" class="second"><br />
<td class="cmd">extensions</td><br />
<td>yes no </td><br />
</tr><br />
<tr valign="top" class="second"><br />
<td class="cmd">initializations</td><br />
<td>yes no </td><br />
</tr><br />
<tr valign="top" class="second"><br />
<td class="cmd">method</td><br />
<td>scaled double </td><br />
</tr><br />
<tr valign="top" class="second"><br />
<td class="cmd">textstyle</td><br />
<td>bold sans mono … </td><br />
</tr><br />
<tr valign="top" class="second"><br />
<td class="cmd">textcolor</td><br />
<td>color spec</td><br />
</tr><br />
<tr valign="top" class="second"><br />
<td class="cmd">setups</td><br />
<td></td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
This command sets up the default MetaPost instance <code>metafun</code> or a custom MetaPost instance previously defined with {{cmd|defineMPinstance}}.<br />
<br />
The <code>extensions</code> and <code>initializations</code> keys control whether the content of the <code>\startMPextensions</code> and <code>\startMPinitializations</code> environment is used or ignored in the metapost code.<br />
<br />
'''Note''': the <code>textstyle</code> and <code>textcolor</code> keys only work when <code>initializations=yes</code> is set.<br />
<br />
== Usage ==<br />
<br />
To print all MetaPost labels in red:<br />
<br />
<texcode><br />
\setupMPinstance [metafun] [textcolor=red]<br />
<br />
\starttext<br />
<br />
\startMPcode<br />
draw textext("some text") ;<br />
\stopMPcode<br />
<br />
\stoptext<br />
</texcode><br />
<br />
Another example using the <code>setups</code> key:<br />
<br />
<context source="yes" mode="mkiv" text="produces"><br />
\defineMPinstance<br />
[mpinstanceprefixed]<br />
[metafun]<br />
[setups=mp:instanceprefix:one, textcolor=red]<br />
<br />
\startsetups mp:instanceprefix:one<br />
prefix:\space<br />
\stopsetups<br />
<br />
\starttext<br />
<br />
\startMPcode<br />
draw textext("normal text") ;<br />
\stopMPcode<br />
<br />
\startMPcode{mpinstanceprefixed}<br />
draw textext("red text") ;<br />
\stopMPcode<br />
<br />
\stoptext<br />
</context><br />
<br />
== See also ==<br />
{{MetaPost see also}}<br />
<br />
== Help from ConTeXt-Mailinglist/Forum ==<br />
All issues with:<br />
{{Forum|{{SUBPAGENAME}}}}<br />
<br />
[[Category:Command/MetaPost|setupMPinstance]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=System_Macros/Loops_and_Recursion&diff=20961System Macros/Loops and Recursion2012-10-26T13:57:03Z<p>Braslau: </p>
<hr />
<div>< '''Prev:''' [[System Macros/Branches and Decisions|Branches & Decisions]] | '''Top:''' [[System Macros]] | '''Next:''' [[System Macros/Action Processing|Action Processing]] ><br />
<br />
TeX does not offer us powerful for-loop mechanisms. On<br />
the other hand its recursion engine is quite unique. We<br />
therefore identify the for-looping macros by this method.<br />
The most simple alternative is the one that only needs a<br />
number.<br />
<br />
=== <cmd>dorecurse</cmd> ===<br />
<texcode><br />
\dorecurse {n} {whatever we want}<br />
</texcode><br />
<br />
This macro can be nested without problems and therefore be<br />
used in situations where Plain TeX's <code>\loop</code> macro<br />
ungracefully fails. The current value of the counter is<br />
available in <code>\recurselevel</code>, before as well as after<br />
the <code>whatever we want</code> stuff.<br />
<br />
<context source="yes"><br />
\dorecurse % inner loop<br />
{10}<br />
{\recurselevel: % outer value<br />
\dorecurse % inner loop<br />
{\recurselevel} % outer value<br />
{\recurselevel} % inner value<br />
\dorecurse % inner loop<br />
{\recurselevel} % outer value<br />
{\recurselevel} % inner value<br />
\endgraf}<br />
</context><br />
<br />
In this example the first, second and fourth<br />
<code>\recurselevel</code> concern the outer loop, while the third<br />
and fifth one concern the inner loop. The depth of the<br />
nesting is available for inspection in <code>\recursedepth</code>.<br />
<br />
Both <code>\recurselevel</code> and <code>\recursedepth</code> are<br />
macros. The real conters are hidden from the user because<br />
we don't want any interference.<br />
<br />
<br />
=== <cmd>dostepwiserecurse</cmd> ===<br />
The simple command <code>\dorecurse</code> is<br />
a special case of the more general:<br />
<br />
<texcode><br />
\dostepwiserecurse {from} {to} {step} {action}<br />
</texcode><br />
<br />
This commands accepts positive and negative steps. Illegal<br />
values are handled as good as possible and the macro accepts<br />
numbers and counters.<br />
<br />
<texcode><br />
\dostepwiserecurse {1} {10} {2} {...}<br />
\dostepwiserecurse {10} {1} {-2} {...}<br />
</texcode><br />
<br />
=== <cmd>doloop</cmd> <cmd>exitloop</cmd> ===<br />
Sometimes loops are not determined by counters, but by<br />
(a combinations of) conditions. We therefore implement a<br />
straightforward loop, which can only be left when we<br />
explicitly exit it. Nesting is supported. First we present<br />
a more extensive alternative.<br />
<br />
<texcode><br />
\doloop<br />
{Some kind of typesetting punishment \par<br />
\ifnum\pageno>100 \exitloop \fi}<br />
</texcode><br />
<br />
When needed, one can call for <code>\looplevel</code> and<br />
<code>\loopdepth</code>.<br />
<br />
The loop is executed at least once, so beware of situations<br />
like:<br />
<br />
<texcode><br />
\doloop {\exitloop some commands}<br />
</texcode><br />
<br />
It's just a matter of putting the text into the <code>\if</code><br />
statement that should be there anyway, like in:<br />
<br />
<texcode><br />
\doloop {\ifwhatever \exitloop \else some commands\fi}<br />
</texcode><br />
<br />
You can also quit a loop immediately, by using <code><br />
\exitloopnow</code> instead. Beware, this is more sensitive<br />
for conditional errors.<br />
<br />
=== Recursion and expansion ===<br />
<br />
Using recursion to build tables requires some particular attention:<br />
<br />
<context source="yes"><br />
\bTABLE<br />
\bTR<br />
\dorecurse{8}{\expanded{\bTD\recurselevel\eTD}}<br />
\eTR<br />
\eTABLE<br />
</context><br />
<br />
Multi-dimensional tables offer another illustration:<br />
<br />
<context source="yes"><br />
\bTABLE<br />
\dorecurse{8}{<br />
\bTR<br />
\dorecurse{5}{\bTD #1,##1 \eTD}<br />
\eTR<br />
}<br />
\eTABLE<br />
</context><br />
<br />
Alternatively, (mkiv only?)<br />
<br />
<context source="yes"><br />
\bTABLE<br />
\dorecurse{8}{\bTR<br />
\dorecurse{5}{\bTD \currentTABLErow,\currentTABLEcolumn \eTD}<br />
\eTR}<br />
\eTABLE<br />
</context><br />
<br />
For further discussion on loops and expansion, see [[System_Macros/Expansion_Control|Expansion control]] as well as this [http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ blog post].<br />
<br />
< '''Prev:''' [[System Macros/Branches and Decisions|Branches & Decisions]] | '''Top:''' [[System Macros]] | '''Next:''' [[System Macros/Action Processing|Action Processing]] ><br />
<br />
[[Category:ConTeXt programming]]<br />
[[Category:Inside ConTeXt]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=System_Macros/Loops_and_Recursion&diff=20960System Macros/Loops and Recursion2012-10-26T13:55:39Z<p>Braslau: Added section Recursion and expansion</p>
<hr />
<div>< '''Prev:''' [[System Macros/Branches and Decisions|Branches & Decisions]] | '''Top:''' [[System Macros]] | '''Next:''' [[System Macros/Action Processing|Action Processing]] ><br />
<br />
TeX does not offer us powerful for-loop mechanisms. On<br />
the other hand its recursion engine is quite unique. We<br />
therefore identify the for-looping macros by this method.<br />
The most simple alternative is the one that only needs a<br />
number.<br />
<br />
=== <cmd>dorecurse</cmd> ===<br />
<texcode><br />
\dorecurse {n} {whatever we want}<br />
</texcode><br />
<br />
This macro can be nested without problems and therefore be<br />
used in situations where Plain TeX's <code>\loop</code> macro<br />
ungracefully fails. The current value of the counter is<br />
available in <code>\recurselevel</code>, before as well as after<br />
the <code>whatever we want</code> stuff.<br />
<br />
<context source="yes"><br />
\dorecurse % inner loop<br />
{10}<br />
{\recurselevel: % outer value<br />
\dorecurse % inner loop<br />
{\recurselevel} % outer value<br />
{\recurselevel} % inner value<br />
\dorecurse % inner loop<br />
{\recurselevel} % outer value<br />
{\recurselevel} % inner value<br />
\endgraf}<br />
</context><br />
<br />
In this example the first, second and fourth<br />
<code>\recurselevel</code> concern the outer loop, while the third<br />
and fifth one concern the inner loop. The depth of the<br />
nesting is available for inspection in <code>\recursedepth</code>.<br />
<br />
Both <code>\recurselevel</code> and <code>\recursedepth</code> are<br />
macros. The real conters are hidden from the user because<br />
we don't want any interference.<br />
<br />
<br />
=== <cmd>dostepwiserecurse</cmd> ===<br />
The simple command <code>\dorecurse</code> is<br />
a special case of the more general:<br />
<br />
<texcode><br />
\dostepwiserecurse {from} {to} {step} {action}<br />
</texcode><br />
<br />
This commands accepts positive and negative steps. Illegal<br />
values are handled as good as possible and the macro accepts<br />
numbers and counters.<br />
<br />
<texcode><br />
\dostepwiserecurse {1} {10} {2} {...}<br />
\dostepwiserecurse {10} {1} {-2} {...}<br />
</texcode><br />
<br />
=== <cmd>doloop</cmd> <cmd>exitloop</cmd> ===<br />
Sometimes loops are not determined by counters, but by<br />
(a combinations of) conditions. We therefore implement a<br />
straightforward loop, which can only be left when we<br />
explicitly exit it. Nesting is supported. First we present<br />
a more extensive alternative.<br />
<br />
<texcode><br />
\doloop<br />
{Some kind of typesetting punishment \par<br />
\ifnum\pageno>100 \exitloop \fi}<br />
</texcode><br />
<br />
When needed, one can call for <code>\looplevel</code> and<br />
<code>\loopdepth</code>.<br />
<br />
The loop is executed at least once, so beware of situations<br />
like:<br />
<br />
<texcode><br />
\doloop {\exitloop some commands}<br />
</texcode><br />
<br />
It's just a matter of putting the text into the <code>\if</code><br />
statement that should be there anyway, like in:<br />
<br />
<texcode><br />
\doloop {\ifwhatever \exitloop \else some commands\fi}<br />
</texcode><br />
<br />
You can also quit a loop immediately, by using <code><br />
\exitloopnow</code> instead. Beware, this is more sensitive<br />
for conditional errors.<br />
<br />
=== Recursion and expansion ===<br />
<br />
Using recursion to build tables requires some particular attention:<br />
<br />
<context source="yes"><br />
\bTABLE<br />
\bTR<br />
\dorecurse{8}{\expanded{\bTD\recurselevel\eTD}}<br />
\eTR<br />
\eTABLE<br />
</context><br />
<br />
Multi-dimensional tables offer another illustration:<br />
<br />
<context source="yes"><br />
\bTABLE<br />
\dorecurse{8}{<br />
\bTR<br />
\dorecurse{5}{\bTD #1,##1 \eTD}<br />
\eTR<br />
}<br />
\eTABLE<br />
</context><br />
<br />
Alternatively, (mkiv only?)<br />
<br />
<context source="yes"><br />
\bTABLE<br />
\dorecurse{8}{\bTR<br />
\dorecurse{5}{\bTD \currentTABLErow,\currentTABLEcolumn \eTD}<br />
\eTR}<br />
\eTABLE<br />
</context><br />
<br />
For further discussion on loops and expansion, see [[System_Macros/Expansion_Control]] as well as this [http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ blog post].<br />
<br />
< '''Prev:''' [[System Macros/Branches and Decisions|Brancjes & Decisions]] | '''Top:''' [[System Macros]] | '''Next:''' [[System Macros/Action Processing|Action Processing]] ><br />
<br />
[[Category:ConTeXt programming]]<br />
[[Category:Inside ConTeXt]]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Footnotes&diff=19186Footnotes2012-04-24T13:15:15Z<p>Braslau: \setupnote->\setupnotation</p>
<hr />
<div>< [[Structurals]] | [[References]] ><br />
<br />
==First View==<br />
<br />
<texcode><br />
\section{First}<br />
<br />
Way to \ConTeXt\footnote{First footnote.} is painful.<br />
<br />
\section{Second}<br />
<br />
But \ConTeXt\ is amazing.\footnote{Second footnote}<br />
<br />
\placetable<br />
{Complex Table\footnote{A table head footnote.}}<br />
{\startlocalfootnotes<br />
\placelegend<br />
{\starttable[|l|l|]<br />
\HL<br />
\NC First Column \NC Second Column \NC \FR<br />
\HL<br />
\NC East\footnote{Footnote inside graphic.} \NC North \NC \FR<br />
\NC West \NC South \NC \LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes}<br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\strut\vfill\<br />
\section{First}<br />
<br />
Way to \ConTeXt\footnote{First footnote.} is painful.<br />
<br />
\section{Second}<br />
<br />
But \ConTeXt\ is amazing.\footnote{Second footnote}<br />
<br />
\placetable<br />
{Complex Table\footnote{A table head footnote.}}<br />
{\startlocalfootnotes<br />
\placelegend<br />
{\starttable[|l|l|]<br />
\HL<br />
\NC First Column \NC Second Column \NC \FR<br />
\HL<br />
\NC East\footnote{Footnote inside graphic.} \NC North \NC \FR<br />
\NC West \NC South \NC \LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes}<br />
\stoptext<br />
</context><br />
<br />
Here we have footnotes of two outer ones, a local one (in the table) and a postponed one (in the graphic).<br />
<br />
==Basic Footnotes==<br />
<br />
For basic footnotes, simply use <cmd>footnote</cmd><tt>[reference]{footnote text}</tt>.<br />
The reference is optional, and can be used to refer to the same footnote again. Footnotes can be referenced with the usual <cmd>in</cmd> and <cmd>at</cmd> macros (see [[References]]), or the note itself can be reproduced with <cmd>note</cmd><tt>[reference]</tt>. For example:<br />
<br />
<texcode><br />
This\footnote[footA](Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and \in{footnote}[footA] on \at{page}[footA], denoted by \note[footA].}. <br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote[footA](Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and \in{footnote}[footA] on \at{page}[footA], denoted by \note[footA].}. <br />
\stoptext<br />
</context><br />
<br />
<br />
Thanks to Oblomov, it's also possible to use footnotes in footnotes, as in this example.<br />
<br />
<texcode><br />
This\footnote(Or that\footnote{Or possibly even the other.}, if you prefer.} is a sentence<br />
with a footnote. <br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote(Or that\footnote{Or possibly even the other.}, if you prefer.} is a sentence<br />
with a footnote. <br />
\stoptext<br />
</context><br />
<br />
<br />
==Footnote Numbering==<br />
<br />
You can setup the exact behaviour of footnotes as usual with <cmd>setupfootnotes</cmd>. For example, to use footnotes with standard footnote symbols (which ConTeXt has defined as the conversion "set 2"), with the footnote counter resetting on each page, one would use the following:<br />
<br />
<texcode><br />
\setupfootnotes[way=bypage, conversion=set 2]<br />
</texcode><br />
<br />
Beware, in MkIV this became<br />
<br />
<texcode><br />
\setupnotation[footnote][way=bypage,numberconversion=set 2]<br />
</texcode><br />
<br />
This produces the following footnotes, using the text of the previous example.<br />
<br />
<context><br />
\setupfootnotes[way=bypage, conversion=set 2]<br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote[footA](Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and \in{footnote}[footA] on \at{page}[footA], denoted by \note[footA].}. <br />
\stoptext<br />
</context><br />
<br />
==Alternate Footnote Locations==<br />
<br />
The <cmd>setupfootnotes</cmd> command offers some options for the placement of footnotes; for instance, the <code>location=columns</code> option places the footnotes in a single column (of a multicolumn page) rather than across the whole page. The <code>location=text</code> option places the footnotes in text at a location specified by <cmd>placefootnotes</cmd>; this can be easily used to create endnotes, or even to place footnotes after each paragraph or subsection.<br />
<br />
<texcode><br />
\setupfootnotes[location=text]<br />
This\footnote[footA]{Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and footnote \note[footA].}. <br />
\placefootnotes<br />
This is some more text, with more footnotes\footnote{Specifically, this one.}.<br />
\placefootnotes<br />
</texcode><br />
<br />
<context><br />
\starttext<br />
\setupfootnotes[location=text]<br />
This\footnote[footA]{Or that, if you prefer.} is a sentence with a footnote\footnote{Actually,<br />
two footnotes; this one and footnote \note[footA].}. <br />
\placefootnotes<br />
This is some more text, with more footnotes\footnote{Specifically, this one.}.<br />
\placefootnotes<br />
\stoptext<br />
</context><br />
<br />
==Footnote Formatting==<br />
<br />
You can change the font used in the footnotes with<br />
<cmd>setupfootnotedefinition</cmd><code>[before=\MyFontCommand]</code>.<br />
<br />
Footnotes can be placed in multiple columns, using the <tt>n=<i>number</i></tt> option in <cmd>setupfootnotes</cmd> (in latest betas it should be added to <cmd>setupnotes</cmd> or <cmd>setupnote</cmd> instead).<br />
<br />
<texcode><br />
\setupfootnotes[n=3]<br />
This\footnote[footA](Or that\footnote{Or the other.}, if you prefer.} is a sentence<br />
with a footnote\footnote{Actually, two footnotes; this one and \in{footnote}[footA]<br />
on \at{page}[footA], denoted by \note[footA].}. <br />
</texcode><br />
<br />
<context><br />
\setupfootnotes[n=3]<br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
This\footnote[footA](Or that\footnote{Or the other.}, if you prefer.} is a sentence<br />
with a footnote\footnote{Actually, two footnotes; this one and \in{footnote}[footA]<br />
on \at{page}[footA], denoted by \note[footA].}. <br />
\stoptext<br />
</context><br />
<br />
{{todo|This is ugly, and points up some ConTeXt bugs that need to be fixed.}}<br />
<br />
==Footnotes in Floats==<br />
<br />
[[Floating Objects|Floats]] cannot include normal footnotes, because they are likely to float to another page from the page on which they were defined, thus getting the footnotes out of order. Thus, to include footnotes in a float, one must use local footnotes. This table, which uses the <cmd>placelegend</cmd> command to create a place for the footnotes, illustrates the process:<br />
<br />
<texcode><br />
\startlocalfootnotes[n=2]<br />
\placetable{A table with footnotes.}<br />
\placelegend<br />
{\starttable[|l|r|]<br />
\HL<br />
\VL One\footnote{First} \VL Two\footnote{Second} \VL\FR<br />
\VL Three\footnote{Third} \VL Four\footnote{Fourth} \VL\LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes<br />
</texcode><br />
<br />
<context><br />
\startlocalfootnotes[n=2]<br />
\placetable{A table with footnotes.}<br />
\placelegend<br />
{\strut\starttable[|l|r|]<br />
\HL<br />
\VL One\footnote{First} \VL Two\footnote{Second} \VL\FR<br />
\VL Three\footnote{Third} \VL Four\footnote{Fourth} \VL\LR<br />
\HL<br />
\stoptable}<br />
{\placelocalfootnotes}<br />
\stoplocalfootnotes<br />
</context><br />
<br />
When using natural tables, the above leads to alignment problems. An alternative is to use:<br />
<br />
<texcode><br />
\defineframed[noteframed]<br />
\setupframed[noteframed]<br />
[width=\hsize,<br />
frame=off,<br />
align=right,<br />
%height=fit,<br />
top=\hbox\bgroup,<br />
bottom=\egroup]<br />
<br />
\starttext<br />
<br />
\startlocalfootnotes[n=0]<br />
\placetable<br />
{Caption}<br />
{\placelegend<br />
{\bTABLE<br />
\bTR\bTD One\footnote{First} \eTD\bTD Two\footnote{Second} \eTD\eTR<br />
\bTR\bTD Three\footnote{Third} \eTD\bTD Four\footnote{Fourth} \eTD\eTR<br />
\eTABLE}<br />
{\noteframed{\placelocalfootnotes}}}<br />
\stoplocalfootnotes<br />
<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
\defineframed[noteframed]<br />
\setupframed[noteframed]<br />
[width=\hsize,<br />
frame=off,<br />
align=right,<br />
%height=fit,<br />
top=\hbox\bgroup,<br />
bottom=\egroup]<br />
<br />
\starttext<br />
<br />
\startlocalfootnotes[n=0]<br />
\placetable<br />
{Caption}<br />
{\placelegend<br />
{\bTABLE<br />
\bTR\bTD One\footnote{First} \eTD\bTD Two\footnote{Second} \eTD\eTR<br />
\bTR\bTD Three\footnote{Third} \eTD\bTD Four\footnote{Fourth} \eTD\eTR<br />
\eTABLE}<br />
{\noteframed{\placelocalfootnotes}}}<br />
\stoplocalfootnotes<br />
<br />
\stoptext<br />
</context><br />
<br />
==Placing Footnotes Manually==<br />
<br />
In some cases, ConTeXt's footnoting system may not be able to do exactly what you want. For instance, you may want to place a footnote in a table so that the footnote appears with the rest of the footnotes on the page, or you may want to create a footnote to a footnote to a footnote. Many of these cases can be handled by using the <cmd>footnotetext</cmd> command (which creates a footnote without placing the corresponding symbol in the text) and the <cmd>note</cmd> command (which places the footnote symbol in the text, but does not create a footnote).<br />
<br />
For example, to create a footnote to a footnote to a footnote, all but the first footnotes are created with <cmd>footnotetext</cmd> commands, which are placed in the main text -- thereby ensuring that the footnotes are numbered and appear in the correct order. Then, these footnotes are referenced by <cmd>note</cmd> commands within the relevant footnotes. In this example, the lines are broken for clarity; note the <tt>%</tt> at the end of each line to prevent spurious spaces in the text.<br />
<br />
<texcode><br />
This%<br />
\footnote{Or that\note[footB], if you prefer.}%<br />
\footnotetext[footB]{Or possibly even the other\note[footC].}%<br />
\footnotetext[footC]{It could be something entirely different.}<br />
is a sentence with nested footnotes.<br />
</texcode><br />
<br />
<context><br />
\strut\vfill<br />
This%<br />
\footnote{Or that\note[footB], if you prefer.}%<br />
\footnotetext[footB]{Or possibly even the other\note[footC].}%<br />
\footnotetext[footC]{It could be something entirely different.}<br />
is a sentence with nested footnotes.<br />
</context><br />
<br />
== Color of Footnote Links that Refer to the Same Page ==<br />
<br />
If you have set footnotes to be interactive and have noticed that your footnote links become red, it is because they are linked to content on the same page on which they appear. This means they are governed by the \setupinteraction attribute of 'contrastcolor', rather than 'color'.<br />
<br />
To fix the redness (or change it to a different color), try:<br />
<br />
<texcode><br />
\setupinteraction[state=start,color=black,contrastcolor=black]<br />
</texcode><br />
<br />
== Special Needs ==<br />
There are numerous ways to display and format footnotes. The following section gathers solutions to some special tasks asked on the mailing list.<br />
<br />
* Is there a way to turn off hyphenation for the main body of my text, but enable it for the footnotes?<br />
<br />
<texcode><br />
\starttext<br />
<br />
\setupnote[footnote][align={normal,hyphenated}]<br />
<br />
\setupalign[hyphenated] \input tufte \footnote{\input tufte \relax} \par<br />
<br />
\setupalign[nothyphenated,stretch,tolerant] \input tufte<br />
\footnote{\input tufte \relax} \par<br />
<br />
\stoptext<br />
</texcode><br />
<br />
* Currently, footnotes are set so that the left end of the text of the footnote is aligned with the left edge of the text, and the footnote number hangs out into the margin. Is it possible to change this? (For instance, suppose I would like the number aligned to the text-edge, and then a fixed-width space, and then the text?)<br />
<br />
This behavior is controlled by the <code>location</code> key in the <code>\setupnotation</code> command. Here are some examples:<br />
<br />
Note number is typeset in an area with a width of 1cm, aligned at the left of the text area:<br />
<br />
<context source="yes" text="produces"><br />
\definepapersize[wiki][width=8cm,height=8cm]<br />
<br />
\setuppapersize[wiki][wiki]<br />
<br />
\starttext<br />
<br />
\showframe<br />
<br />
\setupnotation[footnote][location=left,width=1cm]<br />
\setupnote[footnote][location=page,numbercommand=]<br />
<br />
test \footnote{test}<br />
<br />
\stoptext <br />
</context><br />
<br />
<br />
Suppose that one wants a width of 1.5em. Then<br />
<br />
<texcode><br />
\setupnote[footnote][margindistance=0em,command=\myfootnotecommand]<br />
\setupnotation[footnote][location=left,hang=1]<br />
<br />
\def\myfootnotecommand#1{\hbox to 1.5em{#1.}}<br />
</texcode><br />
<br />
* Can I change the line spacing of a footnote independently of that of the main text?<br />
<br />
The way to do this is not obvious, but this is the code you need to use:<br />
<br />
<texcode><br />
\def\setnotebodyfont<br />
{\switchtobodyfont[your desired font size]\setupinterlinespace[your desired spacing]} <br />
</texcode></div>Braslauhttps://wiki.contextgarden.net/index.php?title=Description&diff=18995Description2012-03-27T12:54:20Z<p>Braslau: syntax has changed in mkiv - added a Todo (for now)</p>
<hr />
<div>< [[From LaTeX to ConTeXt]] | [[Structurals]] ><br />
<br />
{{Todo|descriptions and enumerations in mkiv share the same base, and all "location" values are now set with "alternative". Are there other changes? The present page (as well as the command syntax documentation) needs to be updated.}}<br />
<br />
= Basic Description Lists =<br />
<br />
== LaTeX ==<br />
<br />
LaTeX provides a <tt>description</tt> environment, which works just like an itemized or enumerated list except that the item labels are specified by an (optional) argument to the <tt>\item</tt> command, rather than being automatically generated. This is useful for making lists of definitions and other sorts of descriptions that are headed by a keyword.<br />
<br />
<texcode><br />
\documentclass{article}<br />
\begin{document}<br />
\begin{description}<br />
\item[Short] This is a shorter item label, and some text that talks about it.<br />
The text is wrapped into a paragraph, with successive lines indented.<br />
\item[Rather longer label] This is a longer item label. As you can see, the<br />
text is not started a specified distance in -- unlike with other lists -- but<br />
is spaced a fixed distance from the end of the label.<br />
\end{description}<br />
\end{document}<br />
</texcode><br />
<br />
== ConTeXt ==<br />
<br />
ConTeXt provides a similar mechanism. Unlike the LaTeX version, ConTeXt's description mechanism does not enclose the items in an environment, but instead formats them independently according to formats given in <cmd>setupdescriptions</cmd> or <cmd>definedescription</cmd>. The <cmd>definedescription</cmd> latter command is used to define a named description class, which can later be called using its name. This example defines a <tt>latexdesc</tt> description, with parameters that roughly approximate the LaTeX defaults.<br />
<br />
<texcode><br />
\definedescription[latexdesc][<br />
headstyle=bold,style=normal,align=left,location=hanging,<br />
width=broad,margin=1cm]<br />
<br />
\starttext<br />
\latexdesc{Short} This is a shorter item label, and some text that talks about it.<br />
The text is wrapped into a paragraph, with successive lines indented.<br />
<br />
\latexdesc{Rather longer label} This is a longer item label. As you can see, the<br />
text is not started a specified distance in -- unlike with other lists -- but<br />
is spaced a fixed distance from the end of the label.<br />
<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
\setuplayout[width=13cm]<br />
\definedescription[latexdesc][<br />
headstyle=bold,style=normal,align=left,location=hanging,<br />
width=broad,margin=1cm]<br />
<br />
\starttext<br />
\latexdesc{Short} This is a shorter item label, and some text that talks about it.<br />
The text is wrapped into a paragraph, with successive lines indented.<br />
<br />
\latexdesc{Rather longer label} This is a longer item label. As you can see, the<br />
text is not started a specified distance in -- unlike with other lists -- but<br />
is spaced a fixed distance from the end of the label.<br />
<br />
\stoptext<br />
</context><br />
<br />
The empty lines (or <cmd>par</cmd>) after each description (here, <tt>\latexdesc</tt>) line are required.<br />
<br />
The <tt>margin=<i>dimension</i></tt> key specifies the hanging indentation for lines after the first line. In addition, the separation between the label and the text can be specified using a <tt>distance=<i>dimension</i></tt> key.<br />
<br />
= Multi-Paragraph Descriptions =<br />
<br />
== LaTeX ==<br />
<br />
Because the LaTeX description mechanism is an environment, it is simple to include multiple paragraphs in a description environment, or even to embed sub-lists. For instance, consider the following example:<br />
<br />
<texcode><br />
\documentclass{article}<br />
\begin{document}<br />
\begin{description}<br />
\item[Para] This is a shorter item label, and some text that talks about it.<br />
The text is wrapped into a paragraph, with successive lines indented.<br />
<br />
This is another paragraph under the "Para" item.<br />
<br />
\begin{description}<br />
\item[Sub-Item] This is a description of an item which is within the<br />
"Para" item.<br />
<br />
\item[Sub-Item] Another sub-item.<br />
\end{description}<br />
\item[Short] A short item that's not part of that really long "Para" item.<br />
\end{description}<br />
\end{document}<br />
</texcode><br />
<br />
In this example, the code indentation has been used to illustrate the alignment of the typeset output. Everything between <code>\item[Para]</code> and <code>\item[Short]</code> is part of the "Para" item, and is indented by the same amount. The embedded description then embeds any following lines on the "Sub-Item"s by an additional indentation, as one would expect.<br />
<br />
== ConTeXt ==<br />
<br />
Multiple paragraphs (without first line indenting) can be created as follows:<br />
<br />
<texcode><br />
\definedescription[descr][<br />
headstyle=bold,style=normal,align=left,location=hanging,<br />
width=broad,margin=1cm]<br />
<br />
\starttext<br />
\startdescr{Para}<br />
This is a shorter item label, and some text that talks about it.<br />
The text is wrapped into a paragraph, with successive lines indented.<br />
<br />
This is another paragraph under the "Para" item.<br />
\startdescr{Sub Item} <br />
This is a description of an item which is within the<br />
"Para" item.<br />
\stopdescr<br />
\startdescr{Sub Item} <br />
Another Sub Item <br />
\stopdescr<br />
\stopdescr<br />
\startdescr{Short}<br />
A short item that's not part of that really long "Para" item.<br />
\stopdescr<br />
<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
\setuplayout[width=13cm]<br />
\definedescription[descr][<br />
headstyle=bold,style=normal,align=left,location=hanging,<br />
width=broad,margin=1cm]<br />
<br />
\starttext<br />
\startdescr{Para}<br />
This is a shorter item label, and some text that talks about it.<br />
The text is wrapped into a paragraph, with successive lines indented.<br />
<br />
This is another paragraph under the "Para" item.<br />
\startdescr{Sub Item} <br />
This is a description of an item which is within the<br />
"Para" item.<br />
\stopdescr<br />
\startdescr{Sub Item} <br />
Another Sub Item <br />
\stopdescr<br />
\stopdescr<br />
\startdescr{Short}<br />
A short item that's not part of that really long "Para" item.<br />
\stopdescr<br />
<br />
\stoptext<br />
</context><br />
<br />
= Descriptions with Fixed Label Width =<br />
<br />
== LaTeX ==<br />
<br />
In LaTeX, the <tt>mdwlist</tt> package can be used to set a fixed label width.<br />
<br />
<texcode><br />
\documentclass{article}<br />
\usepackage{mdwlist}<br />
\begin{document}<br />
\begin{basedescript}{\desclabelstyle{\pushlabel}\desclabelwidth{6em}}<br />
\item[Short] This is a shorter item label, and some text that talks about it.<br />
The text is wrapped into a paragraph, with successive lines indented.<br />
\item[Rather longer label] This is a longer item label. As you can see, the<br />
text is not started a specified distance in -- unlike with other lists -- but<br />
is spaced a fixed distance from the end of the label.<br />
\end{basedescript}<br />
\end{document}<br />
</texcode><br />
<br />
<br />
== ConTeXt ==<br />
<br />
Using an explicit dimension as argument for the 'width' parameter<br />
sets the label to 5em:<br />
<br />
<texcode><br />
\definedescription[notation][<br />
headstyle=bold,style=normal,align=left,location=hanging,<br />
width=5em]<br />
</texcode><br />
<br />
<context><br />
\definedescription[notation][<br />
headstyle=bold,style=normal,align=left,location=hanging,<br />
width=5em]<br />
<br />
\starttext<br />
\notation{Short} This is a shorter item label, and some text that talks about it.<br />
The text is wrapped into a paragraph, with successive lines indented.<br />
<br />
\notation{Rather longer label} This is a longer item label. As you can see, the<br />
text is not started a specified distance in -- unlike with other lists -- but<br />
is spaced a fixed distance from the end of the label.<br />
<br />
\stoptext<br />
</context><br />
<br />
Another example:<br />
<texcode><br />
\definedescription<br />
[Desc]<br />
[location=top,hang=20,<br />
headstyle={\bf\color[blue]},<br />
command=\hskip-1cm,margin=1cm]<br />
</texcode><br />
<br />
Gives the result:<br />
<br />
<context><br />
\setupcolors[state=start]<br />
\definedescription[Desc][location=top,hang=20,<br />
headstyle={\bf\color[blue]},<br />
command=\hskip-1cm,margin=1cm]<br />
<br />
\starttext<br />
\Desc{Short} This is a shorter item label, and some text that talks about it.<br />
The text is wrapped into a paragraph, with successive lines indented.<br />
<br />
\Desc{Rather longer label} This is a longer item label. As you can see, the<br />
text is not started a specified distance in -- unlike with other lists -- but<br />
is spaced a fixed distance from the end of the label.<br />
<br />
\stoptext<br />
</context><br />
<br />
== See also ==<br />
{{cmd|definedescription}}, {{cmd|startdescription}}</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Template:Main_Page/News&diff=13465Template:Main Page/News2011-11-03T14:36:06Z<p>Braslau: Added server change news</p>
<hr />
<div>=== News ===<br />
* December 2010: New context.deb [[Debian installation|package for debian]]<br />
* July 2011: [http://www.tug.org/texlive/ TeX Live 2011] released, including current ConTeXt.<br />
* October-November 2011: The garden is migrating to a new server...<br />
==== Revision of ConTeXt User Manual ====<br />
User feedback is appreciated on these new chapters:<br />
<br />
* Chapter on [http://context.aanhet.net/svn/contextman/context-reference/en/co-typography.pdf typography]<br />
* Chapter on [http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf fonts]<br />
* Chapter on [http://context.aanhet.net/svn/contextman/context-reference/en/co-pagedesign.pdf pagedesign]<br />
<br />
==== ConTeXt user meetings ====<br />
<table><br />
<tr><td><br />
The '''[http://meeting.contextgarden.net/2012 Sixth International ConTeXt User Meeting]''' will take place in Breskens in '''The Netherlands''' from '''October 8''' through '''October 12, 2012'''. <br />
</td></tr><br />
<tr><td><br />
The '''[http://meeting.contextgarden.net/2011 Fifth International ConTeXt User Meeting]''' took place in Bassenge in '''Belgium''' from '''September 19''' through '''September 24, 2011'''. <br />
</td></tr><br />
</table></div>Braslauhttps://wiki.contextgarden.net/index.php?title=Template:Main_Page/News&diff=13464Template:Main Page/News2011-11-03T14:31:33Z<p>Braslau: </p>
<hr />
<div>=== News ===<br />
* December 2010: New context.deb [[Debian installation|package for debian]]<br />
* July 2011: [http://www.tug.org/texlive/ TeX Live 2011] released, including current ConTeXt<br />
<br />
==== Revision of ConTeXt User Manual ====<br />
User feedback is appreciated on these new chapters:<br />
<br />
* Chapter on [http://context.aanhet.net/svn/contextman/context-reference/en/co-typography.pdf typography]<br />
* Chapter on [http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf fonts]<br />
* Chapter on [http://context.aanhet.net/svn/contextman/context-reference/en/co-pagedesign.pdf pagedesign]<br />
<br />
==== ConTeXt user meetings ====<br />
<table><br />
<tr><td><br />
The '''[http://meeting.contextgarden.net/2012 Sixth International ConTeXt User Meeting]''' will take place in Breskens in '''The Netherlands''' from '''October 8''' through '''October 12, 2012'''. <br />
</td></tr><br />
<tr><td><br />
The '''[http://meeting.contextgarden.net/2011 Fifth International ConTeXt User Meeting]''' took place in Bassenge in '''Belgium''' from '''September 19''' through '''September 24, 2011'''. <br />
</td></tr><br />
</table></div>Braslauhttps://wiki.contextgarden.net/index.php?title=Template:Main_Page/News&diff=13463Template:Main Page/News2011-11-03T14:26:40Z<p>Braslau: Experimenting with adding news</p>
<hr />
<div>=== News ===<br />
* December 2010: New context.deb [[Debian installation|package for debian]]<br />
* July 2011: [http://www.tug.org/texlive/ TeX Live 2011] released, including current ConTeXt<br />
<br />
==== Revision of ConTeXt User Manual ====<br />
User feedback is appreciated on these new chapters:<br />
<br />
* Chapter on [http://context.aanhet.net/svn/contextman/context-reference/en/co-typography.pdf typography]<br />
* Chapter on [http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf fonts]<br />
* Chapter on [http://context.aanhet.net/svn/contextman/context-reference/en/co-pagedesign.pdf pagedesign]<br />
<br />
==== ConTeXt user meeting ====<br />
<table><br />
<tr><td><br />
The '''[http://meeting.contextgarden.net/2012 Sixth International ConTeXt User Meeting]''' will take place in Breskens in '''The Netherlands''' from '''October 8''' through '''October 12, 2012'''. <br />
</td></tr><br />
<tr><td><br />
The '''[http://meeting.contextgarden.net/2011 Fifth International ConTeXt User Meeting]''' took place in Bassenge in '''Belgium''' from '''September 19''' through '''September 24, 2011'''. <br />
</td></tr><br />
</table></div>Braslauhttps://wiki.contextgarden.net/index.php?title=Talk:Main_Page&diff=13386Talk:Main Page2011-09-27T17:54:29Z<p>Braslau: /* Comments on Main Page */ new look</p>
<hr />
<div>= General Wiki Comments =<br />
== front page ==<br />
i think one should tidy up the wiki front page. There are to many links and too many with unclear naming. May be less, more precise words in frames and some piktograms help.--[[User:Jstein|Jstein]] 00:23, 27 November 2010 (UTC)<br />
Revision of ConTeXt User Manual appears twice. Thats a bit confusing.<br />
<br />
== GIFs ==<br />
Is it forbidden to upload GIFs? I wanted to upload one for the Animation page (I'm not sure if that's a good idea anyway; it would be used to get a feeling of what approximately Adobe Reader is capable to do/limited to). I get a warning <i>".gif" is not a recommended image file format.</i>, but then nothing happened any further. --Thanks, [[User:Mojca Miklavec|Mojca]]<br />
<br />
== function show_command ==<br />
it does '''still''' not work.<br />
<br />
the fuction is defined as such:<br />
<code><pre>function show_command(URL) {<br />
open_window().location.href='http://texshow.contextgarden.net/cmd/' + URL;<br />
}</pre></code><br />
and thus redirects to some url under http://texshow.contextgarden.net/<br />
<br />
no matter what that url is, the subdomain redirects to the page [[:Category:Reference/en]] (no, not [[:Category:Reference/en/URL]]!)<br />
<br />
please fix it.<br />
<br />
:Edit: Mojca did it, thanks!<br />
<br />
– [[User:Flying sheep|flying sheep]] 23:24, 22 August 2011 (CEST)<br />
<br />
= Comments on [[Main Page]] =<br />
Please add a link to the 'third party page'<br />
: Already there, but Hans got confused about its name. Left-side menu, in the middle of 'garden', you see 'third party modules'. That is the correct page, but a nice upload interface is currently still missing. [[User:Taco|Taco]]<br />
<br />
----<br />
Mojca recently asked (in the changelog) for comments on the reorganization of the [[Main Page]]. It looks quite good to me, overall. The "how to edit a Wiki page" should probably link to the existing [[Help:Editing]] page, or perhaps directly to MediaWiki's Help:Editing page.<br />
<br />
I do think a couple of the section headings should be changed. "Tips, Tricks, and Hacks" is becoming a storehouse of actual documentation as well as just small "tricks", and the name should reflect that: something like "ConTeXt Documentation and How-To", maybe. "Help & Guidelines" should be "Wiki Help & Guidelines", so as to distinguish it from "ConTeXt help".<br />
<br />
It may also be useful to put "short explanations" next to the links, much as I've been doing in the [[From LaTeX to ConTeXt]] page.<br />
<br />
--[[User:Brooks|Brooks]] 02:49, 4 Sep 2005 (UTC)<br />
<br />
: Brooks, you wrote too much today ;) ! You cannot expect people to read all your comments!!! (I didn't even notice your posting here until I wanted to add something).<br>Yes, "How to edit a Wiki page" should certainly be merged with [[Help:Editing]]. I forgot that this page ever existed as it somehow disappeared from my view. [[Help:Contents]] should ugently be changed as well. (Feel free to do it.)<br />
<br />
: I thought that "Help & Guidelines" could be used for guidelines about writing to the mailing list as well, but it's true that it should be distinguished from ConTeXt help. I agree to add comments next to links (but what comments?).<br> Also, quite some stuff is still missing on the main page, the "Main ConTeXt Documentation and HowTo-s" needs to be reorganized and <b>Categories</b> should be defined, so that we can start categorizing the majority of pages (I had no idea what Categories to define for pages under "Visuals", "Structurals", "Inside ConTeXt" (which should probably better be defined as "Programming" or something similar), ...). Quite some "secondary pages" are missing (connecting the first page and actual articles, just like your [[From LaTeX to ConTeXt]], one page with [[Links]] is certainly missing).<br />
<br />
: Despite the generally accepted decision to lock the first page, I hope that I'm not violating the rules too much if I unlock it for two days (sorry, Patrick), so that you can improve it by yourself if you want. If anyone spams the first page in the meantime, I take the responsibility to remove the spam from it (as soon as I come online).<br />
:--[[User:Mojca Miklavec|Mojca]] 19:37, 4 Sep 2005 (UTC)<br />
:: No problem at all, go ahead and feel free to unlock it. BTW: I really like the look of the new page, but I still need some time to make real comments --[[User:Patrick Gundlach|pg]] 10:55, 5 Sep 2005 (UTC)<br />
<br />
:: Thanks! I think I'll make a copy of the [[Main Page]], and put it in [[Main Page Sandbox]], so I can muck about with some organizational ideas without affecting the "live" version until they're finished. I was going to say that we could delete [[Main Page Sandbox]] after we're done, but it might be useful to leave it up for future things like this. --[[User:Brooks|Brooks]] 23:09, 4 Sep 2005 (UTC)<br />
<br />
:: Another idea for handling the main page, as far as editing goes -- see [http://sandbox.contextgarden.net/Brooks's_Sandbox_Two|This Page on the Sandbox]. There's no actual content on the page; it's all in a pair of templates. That page could then be locked, but people could still edit the templates and change the content, so long as they knew which templates to edit. I don't know how smart the spammers are, but it ought to at least block the lazy and/or automatic ones. --[[User:Brooks|Brooks]] 00:08, 5 Sep 2005 (UTC)<br />
<br />
::: This seems hidden enough for me (until I knew what Templates are about and where they are stored, I had to search really long until I was able to see the content) --[[User:Mojca Miklavec|Mojca]] 00:21, 5 Sep 2005 (UTC)<br />
<br />
:::: Let's try it. Good Idea. If it turns out wrong, we can still decide later. --[[User:Patrick Gundlach|pg]] 10:55, 5 Sep 2005 (UTC)<br />
<br />
----<br />
I '''really''' like the new look of the wiki! --[[User:Braslau|Alan]]<br />
<br />
= General ConTeXt Questions =<br />
<br />
This is not the place to ask general questions about ConTeXt. If you have a longer question, the best thing to do with it is create a new page (see [[Help:Editing]] for how to do that) with a description of the problem, and put the special text <code><nowiki>{{Howto}}</nowiki></code> in it, which will cause it to be listed on the [[Category:How to]] page. If you have a short question that is appropriate for the [[FAQ]], you can add it there, and leave the answer blank. If you have a question that you wish to discuss, the best place for that is the [http://www.ntg.nl/mailman/listinfo/ntg-context ConTeXt mailing list] or the "Discussion" page associated with a particularly relevant Wiki page, though you can also use the [[Talk:FAQ|FAQ's "Talk" page]] if there's not an obvious choice.<br />
<br />
<br />
{{Howto}}[http://wiki.contextgarden.net/How_to_configure_Scite_and_Context Configuring Scite and ConTeXt(I have some Compiling problem)]</div>Braslauhttps://wiki.contextgarden.net/index.php?title=Installation&diff=13381Installation2011-09-25T09:41:30Z<p>Braslau: /* freeBSD */</p>
<hr />
<div>< [[Installation hints]] | [[TeX Distributions]] ><br />
<br />
<br />
{{note | The officially recommended way of installing ConTeXt on all platforms is using [[ConTeXt Standalone]]}}<br />
<br />
<br />
= Look before you leap =<br />
<br />
Most [[TeX Distributions]] include an installation of ConTeXt already.<br />
To see if it's installed on your system run <br />
context --version<br />
<br />
If it is not installed, there are two important considerations.<br />
<br />
* Do you want a '''ConTeXt distribution''' or do you want a '''TeX distribution''' (plain TeX, LaTeX, ConTeXt, and lots of other goodies). <br />
* Do you want a '''stable''' version of ConTeXt, or do you want the '''bleeding edge''' version. Remember that ConTeXt gets updated frequently.<br />
<br />
If you are on a Linux system, there is also a third consideration:<br />
<br />
* Do you want a '''distribution package''', or do you want your own '''local TeX''' installation.<br />
<br />
= Installation =<br />
select your operating system<br />
<br />
== Unix (linux/bsd/...) ==<br />
In decreasing order of simplicity, here are a few options:<br />
<br />
* (simplest) If you distribution supports [[TeX Live]] packages, use them. Debian, Ubuntu, openSUSE, Gentoo, Fedora, Arch and Mandriva (if not too old) do so. See [[Debian installation]] or [[Ubuntu installation]].<br />
* Otherwise, use a fresh [[TeX Live]] installation. The problem with this method is that you'll probably have to redo the installation once a year, when the new TeX Live DVD comes out.<br />
If you will use TeX Live, you have to delete the distribution-provided teTeX packages (if they exist).<br />
<br />
If you are running an rpm-based distribution (RedHat, Fedora, Mandrake, Mandriva etc.), then you can most easily uninstall them like so:<br />
rpm --qa | grep tetex<br />
rpm --erase <package-names><br />
<code>rpm</code>'s dependencies will tell you what other TeX-related packages are installed but don't have 'tetex' in their names!<br />
<br />
FreeBSD also still contains teTeX in its ports distribution (with many dependencies). These packages can be deleted as follows:<br />
pkg_info | grep tetex<br />
pkg_delete tetex\*<br />
Note, however, that teTeX will again be pulled-in by other packages, for example if options installing formatted documentation are activated. <br />
<br />
* Alternatively, if you need '''just ConTeXt and no LaTeX''', you can use the [[ConTeXt Standalone]] installation. The ConTeXt Standalone installation does not require the de-installation of other TeX distributions and can be used in parallel.<br />
<br />
=== Debian / (K)Ubuntu ===<br />
Debian_TeXlive_install (Debian/linux and Debian/kfreebsd)<br />
* [[Debian installation| install ConTeXt on Debian]]<br />
* [[Ubuntu installation| install ConTeXt on Ubuntu]]<br />
* [[Debian TeXlive install| install TeXlive on Debian]]<br />
<br />
=== Fedora ===<br />
<br />
Detils for [http://fedoraproject.org Fedora] version 11, 12 and 13 are at [http://fedoraproject.org/wiki/Features/TeXLive Fedora Project Wiki TeX Live page] maintained by Jindrich Novy. The repository provides a snapshot of TeX Live 2010 tlpretest, and it includes very new ConTeXt packages and requires absolutely no manual configuration to get working Mk II and Mk IV. Highly recommended.<br />
<br />
=== funtoo ===<br />
<br />
If you are using [http://funtoo.org funtoo] there are ebuilds that will make an installation as easy as installing any other package from portage. Take a look at the [[ConTeXt Standalone Funtoo]] Howto. This might also work for [http://www.gentoo.org gentoo], but is untested right now.<br />
<br />
=== openSUSE ===<br />
<br />
OpenSUSE (starting from 10.3beta3) comes with TeX Live and offers also XeTeX. 10.3b3 contains ConTeXt 2007.01.12.<br />
<br />
You can [http://software.opensuse.org/search?q=context search for OpenSUSE packages online]<br />
In OpenSUSE 11.3 there are two packages available. <br />
* texlive-context-2010-33.1.noarch.rpm<br />
* texlive-context-2009-26.1.noarch.rpm<br />
<br />
=== freeBSD ===<br />
<br />
FreeBSD still relies on teTeX in the ports collection. Alternately, TeXlive is now available as a branch extension, see [http://code.google.com/p/freebsd-texlive/wiki/Installing] and [http://romain.blogreen.org/blog/2011/08/texlive-2011-on-freebsd/], until migration to the main ports branch is completed.<br />
<br />
[[TeX Live]] as a standalone installation will run "out of the box" on all recent versions of freeBSD (7, 8, 9) and extended support is available for earlier versions; The [[ConTeXt Standalone]] installation is compiled for the latest stable release (currently 8.2).<br />
<br />
=== OpenBSD ===<br />
<br />
The ConTeXt Standalone distribution does not currently support OpenBSD.<br />
* [[OpenBSD installation|OpenBSD]]<br />
<br />
== Mac OS X ==<br />
* [[Mac Installation]]<br />
<br />
== Windows ==<br />
There are two main TeX distributions for Windows wich contain a stable context<br />
* [[MikTeX]] (currently '''ConTeXt support is broken''')<br />
* [[TeX Live]] (provides stable ConTeXt)<br />
<br />
Use [[ConTeXt Standalone]], if you want up to date ConTeXt.<br />
<br />
* [[Windows Installation]]<br />
* [[Simple Windows Installation]]<br />
<br />
== Installation from source == <br />
* [[TeX-live | TeX-live installation]]: Specific installation instructions using the TeX-live source distribution.<br />
* [[Installation hints]]<br />
<br />
<br />
== external manuals on installation ==<br />
* [http://www.pragma-ade.com/general/manuals/minstall.pdf How to install context (outdated 2001)]<br />
<br />
<br />
[[Category:Installation]]</div>Braslau