https://wiki.contextgarden.net/api.php?action=feedcontributions&user=Thangalin&feedformat=atomWiki - User contributions [en]2024-03-29T10:26:22ZUser contributionsMediaWiki 1.34.1https://wiki.contextgarden.net/index.php?title=Command/placeinitial&diff=33932Command/placeinitial2023-06-19T02:59:28Z<p>Thangalin: </p>
<hr />
<div><cd:commandgroup name="placeinitial" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"><br />
<cd:shortdesc>Initials (also known as drop caps, dropped caps, or versals) can be made in ConTeXt using the {{cmd|placeinitial}} command detailed here.<br />
<br />
See {{cmd|setupinitial}} for customization.</cd:shortdesc><br />
<cd:variants><br />
<cd:command category="fonts" file="typo-drp.mkiv" interfacedate="2019-11-19T09:54" interfacefile="i-initial.xml" level="document" name="placeinitial" variantnumber="1"><br />
<cd:arguments><br />
<cd:keywords optional="yes" ordinal="1"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:name"></cd:constant><br />
</cd:keywords><br />
</cd:arguments><br />
</cd:command><br />
</cd:variants><br />
<cd:description><!-- the long description of the command goes here --><br />
</cd:description><br />
<cd:examples><cd:example title="basics"><context mode="mkiv" source="yes"><br />
\definepapersize[sheet][width=120mm,height=60mm]<br />
\setuppapersize[sheet]<br />
\setuppagenumbering[location=]<br />
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]<br />
<br />
\starttext<br />
<br />
\placeinitial<br />
\input knuth<br />
<br />
\stoptext<br />
</context></cd:example><cd:example title="Short Paragraphs">When the first paragraph does not take up the entire height of the drop-cap, there are a few ways to allow the second paragraph to be correctly aligned.<br />
<br />
Use the {{cmd|setupinitial}} command with the continue option to indicate that the drop-cap (lettrine) is to be protected (i.e., no text may overlap the lettrine):<br />
<br />
<context mode="mkiv" source="yes"><br />
\setupinitial[n=2,continue=yes]<br />
<br />
\setuphead[chapter][<br />
after={\placeinitial},<br />
page=no,<br />
]<br />
<br />
\starttext<br />
\chapter{one}<br />
Thomas Jefferson wrote:<br />
<br />
We hold these truths to be self-evident.<br />
<br />
\chapter{two}<br />
\input knuth<br />
<br />
We hold these truths to be self-evident.<br />
\stoptext<br />
</context><br />
<br />
Another way to indicate the end of the drop-cap is to use the {{cmd|forgetinitial}} command, as follows:<br />
<br />
<context mode="mkiv" source="yes"><br />
\enableexperiments[autoforgetinitials]<br />
\setupinitial[n=2, style=\tfd, location=text]<br />
\setuphead[chapter][after={\placeinitial}]<br />
<br />
\starttext<br />
\chapter<br />
<br />
Short paragraph \par<br />
<br />
\forgetinitial \input tufte<br />
<br />
\stoptext<br />
</context><br />
</cd:example></cd:examples><br />
<cd:notes></cd:notes><br />
<cd:seealso><br />
<cd:source file="typo-drp.mkiv" originator="system"></cd:source><br />
<cd:wikipage originator="system" page="Category:Fonts"></cd:wikipage><br />
<cd:commandref name="definefirstline">to apply specific style to the whole first line, or first words</cd:commandref><br />
<cd:commandref name="starthanging">to use an image as a drop cap</cd:commandref></cd:seealso><br />
</cd:commandgroup></div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Command/placeinitial&diff=33931Command/placeinitial2023-06-19T02:58:26Z<p>Thangalin: </p>
<hr />
<div><cd:commandgroup name="placeinitial" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"><br />
<cd:shortdesc>Initials (also known as drop caps, dropped caps, or versals) can be made in ConTeXt using the {{cmd|placeinitial}} command detailed here.<br />
<br />
See {{cmd|setupinitial}} for customization.</cd:shortdesc><br />
<cd:variants><br />
<cd:command category="fonts" file="typo-drp.mkiv" interfacedate="2019-11-19T09:54" interfacefile="i-initial.xml" level="document" name="placeinitial" variantnumber="1"><br />
<cd:arguments><br />
<cd:keywords optional="yes" ordinal="1"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:name"></cd:constant><br />
</cd:keywords><br />
</cd:arguments><br />
</cd:command><br />
</cd:variants><br />
<cd:description><!-- the long description of the command goes here --><br />
</cd:description><br />
<cd:examples><cd:example title="basics"><context mode="mkiv" source="yes"><br />
\definepapersize[sheet][width=120mm,height=60mm]<br />
\setuppapersize[sheet]<br />
\setuppagenumbering[location=]<br />
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]<br />
<br />
\starttext<br />
<br />
\placeinitial<br />
\input knuth<br />
<br />
\stoptext<br />
</context></cd:example><cd:example title="Short Paragraphs">When the first paragraph does not take up the entire height of the drop-cap, there are a few ways to allow the second paragraph to be correctly aligned.<br />
<br />
Use the {{cmd|setupinital}} command with the continue option to indicate that the drop-cap (lettrine) is to be protected (i.e., no text may overlap the lettrine):<br />
<br />
<context mode="mkiv" source="yes"><br />
\setupinitial[n=2,continue=yes]<br />
<br />
\setuphead[chapter][<br />
after={\placeinitial},<br />
page=no,<br />
]<br />
<br />
\starttext<br />
\chapter{one}<br />
Thomas Jefferson wrote:<br />
<br />
We hold these truths to be self-evident.<br />
<br />
\chapter{two}<br />
\input knuth<br />
<br />
We hold these truths to be self-evident.<br />
\stoptext<br />
</context><br />
<br />
Another way to indicate the end of the drop-cap is to use the {{cmd|forgetinitial}} command, as follows:<br />
<br />
<context mode="mkiv" source="yes"><br />
\enableexperiments[autoforgetinitials]<br />
\setupinitial[n=2, style=\tfd, location=text]<br />
\setuphead[chapter][after={\placeinitial}]<br />
<br />
\starttext<br />
\chapter<br />
<br />
Short paragraph \par<br />
<br />
\forgetinitial \input tufte<br />
<br />
\stoptext<br />
</context><br />
</cd:example></cd:examples><br />
<cd:notes></cd:notes><br />
<cd:seealso><br />
<cd:source file="typo-drp.mkiv" originator="system"></cd:source><br />
<cd:wikipage originator="system" page="Category:Fonts"></cd:wikipage><br />
<cd:commandref name="definefirstline">to apply specific style to the whole first line, or first words</cd:commandref><br />
<cd:commandref name="starthanging">to use an image as a drop cap</cd:commandref></cd:seealso><br />
</cd:commandgroup></div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Installation&diff=33785Installation2022-11-10T04:15:27Z<p>Thangalin: /* GNU/Linux */</p>
<hr />
<div>__NOTOC__<br />
Since April 2019, there is a new implementation of ConTeXt, named '''ConTeXt [[LMTX]]'''. It is tuned for LuaMetaTeX, the lean and mean successor of LuaTeX TeX engine (see [https://tug.org/TUGboat/tb40-1/tb124hagen-lmtx.pdf article]).<br />
<br />
= Download =<br />
<br />
<ul id="DownloadRework"><br />
<br />
<li><br />
=== Windows ===<br />
* X86 [http://lmtx.pragma-ade.com/install-lmtx/context-mswin.zip 32bits]<br />
* X86 [http://lmtx.pragma-ade.com/install-lmtx/context-win64.zip 64bits]<br />
* ARM [http://lmtx.pragma-ade.com/install-lmtx/context-windows-arm64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== MacOS ===<br />
* X86 [http://lmtx.pragma-ade.com/install-lmtx/context-osx-64.zip 64bits]<br />
* ARM [http://lmtx.pragma-ade.com/install-lmtx/context-osx-arm64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== GNU/Linux ===<br />
* X86 [http://lmtx.pragma-ade.com/install-lmtx/context-linux.zip 32b]|[http://lmtx.pragma-ade.com/install-lmtx/context-linux-64.zip 64b]<br />
* ARM [http://lmtx.pragma-ade.com/install-lmtx/context-linux-armhf.zip 32b]|[http://lmtx.pragma-ade.com/install-lmtx/context-linux-aarch64.zip 64b]<br />
* Musl [http://lmtx.pragma-ade.com/install-lmtx/context-linuxmusl.zip 64b]<br />
</li><br />
<br />
<br />
<li><br />
<br />
=== FreeBSD ===<br />
* [http://lmtx.pragma-ade.com/install-lmtx/context-freebsd.zip 32bits]<br />
* [http://lmtx.pragma-ade.com/install-lmtx/context-freebsd-amd64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== OpenBSD ===<br />
* 7.0 [http://lmtx.pragma-ade.com/install-lmtx/context-openbsd7.0-amd64.zip 64b]<br />
* 7.1 [http://lmtx.pragma-ade.com/install-lmtx/context-openbsd7.1-amd64.zip 64b]<br />
</li><br />
</ul><br />
</li><br />
<br />
</ul><br />
<br />
</li><br />
</ul><br />
<br />
<br />
You can [[Read Me| read the licence]] (Creative Commons GNU GPL for program code, and Creative Commons Attribution ShareAlike for documentation).<br />
<br />
= Installation =<br />
<br />
The general steps to install ConTeXt LMTX are as follows:<br />
<br />
# Create a directory for ConTeXt.<br />
# Download the platform-specific archive file into the ConTeXt directory.<br />
# Unpack the archive.<br />
# Execute the install program, which downloads the distribution.<br />
# Update the PATH environment variable.<br />
# Optionally, delete the archive file.<br />
<br />
See the next sections for instructions specific to various platforms.<br />
<br />
== Unix ==<br />
<br />
The steps in this section show how to download and install ConTeXt for a 64-bit Linux system. Change the archive file download link as needed for your target platform. Open a new terminal then run the following commands:<br />
<br />
# mkdir $HOME/context<br />
# cd $HOME/context<br />
# wget https://lmtx.pragma-ade.com/install-lmtx/context-linux-64.zip<br />
# unzip context-linux-64.zip<br />
# sh install.sh<br />
<br />
Update the PATH environment variable by using the path instructions displayed when the install program finishes. The instructions will vary depending on the type of shell being used:<br />
<br />
* '''Bash''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.bashrc</code><br />
* '''Zsh''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.zshenv</code><br />
* '''Sh'''/'''Ksh''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.profile</code><br />
* '''Tcsh'''/'''csh''': <code>echo 'set path = ($path ...instructions...)' >> ~/.cshrc</code><br />
<br />
For example, if ConTeXt was downloaded into `$HOME/context` on a system running bash, then the following line would update the PATH environment variable:<br />
<br />
<code>echo 'export PATH=$HOME/context/tex/texmf-linux-64/bin:$PATH' >> ~/.bashrc</code><br />
<br />
== MacOS ==<br />
<br />
The instructions for MacOS are the same as for Unix, but note that:<br />
<br />
* MacOS versions from Catalina (10.15) and newer use '''Zsh''' by default.<br />
* MacOS versions before Catalina use '''Bash''' by default.<br />
<br />
== Windows ==<br />
<br />
Complete the following steps to set up ConTeXt on Windows:<br />
<br />
# Create a directory for ConTeXt, such as `C:\context`.<br />
# Download the architecture-specific version into the ConTeXt directory.<br />
# Extract the archive.<br />
# Run: <code>install.bat</code><br />
# Run: <code>setpath.bat</code><br />
<br />
Installation is complete.<br />
<br />
= First Run =<br />
<br />
This section describes how to run ConTeXt to transform your first TeX document into a PDF.<br />
<br />
# Download the tex input file [[Media:Hello-world.tex|Hello-World.tex]] from our [[Detailed_Example|Detailed example]].<br />
# Run <code>context Hello-world.tex</code> in your terminal (or command prompt).<br />
# Check the PDF output <code>Hello-world.pdf</code>.<br />
<br />
Additional tutorials include:<br />
<br />
* [[First Document| Your first document]]<br />
* [[Detailed Example|Detailed example]]<br />
<br />
See the [[Sample documents]] page for even more examples.<br />
<br />
= Upgrade =<br />
<br />
Re-run the install program to upgrade, which will update the distribution incrementally:<br />
<br />
* Windows: <code>install.bat</code><br />
* Unix: <code>sh install.sh</code><br />
<br />
= Running MkIV =<br />
<br />
The new distribution has all the files to run the previous version of ConTeXt. <br />
* Run <code>context --luatex Hello-world.tex</code> to use the `luatex` binary and [[MkIV]].<br />
<br />
= Further installation instructions =<br />
<br />
* [[Installing ConTeXt LMTX on MacOS]]<br />
* [[Modules#ConTeXt_LMTX|Installing Modules for ConTeXt LMTX]]<br />
* The official page '''[http://www.pragma-ade.nl/install.htm Installing ConTeXt LMTX ]''' is hosted by Pragma ADE.<br />
* Pragma ADE also provides the '''[http://www.pragma-ade.nl/download-1.htm ConTeXt MkIV distribution]''' (version MkIV is the predecessor of LMTX) for which there are also [[ConTeXt_Standalone|detailed installation instructions]].<br />
<br />
<br />
----<br />
<br />
{{Installation navbox}}<br />
<br />
[[Category:Basics]]<br />
[[Category:Installation]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Installation&diff=33784Installation2022-11-10T04:14:01Z<p>Thangalin: /* Download */</p>
<hr />
<div>__NOTOC__<br />
Since April 2019, there is a new implementation of ConTeXt, named '''ConTeXt [[LMTX]]'''. It is tuned for LuaMetaTeX, the lean and mean successor of LuaTeX TeX engine (see [https://tug.org/TUGboat/tb40-1/tb124hagen-lmtx.pdf article]).<br />
<br />
= Download =<br />
<br />
<ul id="DownloadRework"><br />
<br />
<li><br />
=== Windows ===<br />
* X86 [http://lmtx.pragma-ade.com/install-lmtx/context-mswin.zip 32bits]<br />
* X86 [http://lmtx.pragma-ade.com/install-lmtx/context-win64.zip 64bits]<br />
* ARM [http://lmtx.pragma-ade.com/install-lmtx/context-windows-arm64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== MacOS ===<br />
* X86 [http://lmtx.pragma-ade.com/install-lmtx/context-osx-64.zip 64bits]<br />
* ARM [http://lmtx.pragma-ade.com/install-lmtx/context-osx-arm64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== GNU/Linux ===<br />
* X86 [http://lmtx.pragma-ade.com/install-lmtx/context-linux.zip 32b]|[http://lmtx.pragma-ade.nl/install-lmtx/context-linux-64.zip 64b]<br />
* ARM [http://lmtx.pragma-ade.com/install-lmtx/context-linux-armhf.zip 32b]|[http://lmtx.pragma-ade.nl/install-lmtx/context-linux-aarch64.zip 64b]<br />
* Musl [http://lmtx.pragma-ade.com/install-lmtx/context-linuxmusl.zip 64b]<br />
</li><br />
<br />
<br />
<li><br />
<br />
=== FreeBSD ===<br />
* [http://lmtx.pragma-ade.com/install-lmtx/context-freebsd.zip 32bits]<br />
* [http://lmtx.pragma-ade.com/install-lmtx/context-freebsd-amd64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== OpenBSD ===<br />
* 7.0 [http://lmtx.pragma-ade.com/install-lmtx/context-openbsd7.0-amd64.zip 64b]<br />
* 7.1 [http://lmtx.pragma-ade.com/install-lmtx/context-openbsd7.1-amd64.zip 64b]<br />
</li><br />
</ul><br />
</li><br />
<br />
</ul><br />
<br />
</li><br />
</ul><br />
<br />
<br />
You can [[Read Me| read the licence]] (Creative Commons GNU GPL for program code, and Creative Commons Attribution ShareAlike for documentation).<br />
<br />
= Installation =<br />
<br />
The general steps to install ConTeXt LMTX are as follows:<br />
<br />
# Create a directory for ConTeXt.<br />
# Download the platform-specific archive file into the ConTeXt directory.<br />
# Unpack the archive.<br />
# Execute the install program, which downloads the distribution.<br />
# Update the PATH environment variable.<br />
# Optionally, delete the archive file.<br />
<br />
See the next sections for instructions specific to various platforms.<br />
<br />
== Unix ==<br />
<br />
The steps in this section show how to download and install ConTeXt for a 64-bit Linux system. Change the archive file download link as needed for your target platform. Open a new terminal then run the following commands:<br />
<br />
# mkdir $HOME/context<br />
# cd $HOME/context<br />
# wget https://lmtx.pragma-ade.com/install-lmtx/context-linux-64.zip<br />
# unzip context-linux-64.zip<br />
# sh install.sh<br />
<br />
Update the PATH environment variable by using the path instructions displayed when the install program finishes. The instructions will vary depending on the type of shell being used:<br />
<br />
* '''Bash''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.bashrc</code><br />
* '''Zsh''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.zshenv</code><br />
* '''Sh'''/'''Ksh''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.profile</code><br />
* '''Tcsh'''/'''csh''': <code>echo 'set path = ($path ...instructions...)' >> ~/.cshrc</code><br />
<br />
For example, if ConTeXt was downloaded into `$HOME/context` on a system running bash, then the following line would update the PATH environment variable:<br />
<br />
<code>echo 'export PATH=$HOME/context/tex/texmf-linux-64/bin:$PATH' >> ~/.bashrc</code><br />
<br />
== MacOS ==<br />
<br />
The instructions for MacOS are the same as for Unix, but note that:<br />
<br />
* MacOS versions from Catalina (10.15) and newer use '''Zsh''' by default.<br />
* MacOS versions before Catalina use '''Bash''' by default.<br />
<br />
== Windows ==<br />
<br />
Complete the following steps to set up ConTeXt on Windows:<br />
<br />
# Create a directory for ConTeXt, such as `C:\context`.<br />
# Download the architecture-specific version into the ConTeXt directory.<br />
# Extract the archive.<br />
# Run: <code>install.bat</code><br />
# Run: <code>setpath.bat</code><br />
<br />
Installation is complete.<br />
<br />
= First Run =<br />
<br />
This section describes how to run ConTeXt to transform your first TeX document into a PDF.<br />
<br />
# Download the tex input file [[Media:Hello-world.tex|Hello-World.tex]] from our [[Detailed_Example|Detailed example]].<br />
# Run <code>context Hello-world.tex</code> in your terminal (or command prompt).<br />
# Check the PDF output <code>Hello-world.pdf</code>.<br />
<br />
Additional tutorials include:<br />
<br />
* [[First Document| Your first document]]<br />
* [[Detailed Example|Detailed example]]<br />
<br />
See the [[Sample documents]] page for even more examples.<br />
<br />
= Upgrade =<br />
<br />
Re-run the install program to upgrade, which will update the distribution incrementally:<br />
<br />
* Windows: <code>install.bat</code><br />
* Unix: <code>sh install.sh</code><br />
<br />
= Running MkIV =<br />
<br />
The new distribution has all the files to run the previous version of ConTeXt. <br />
* Run <code>context --luatex Hello-world.tex</code> to use the `luatex` binary and [[MkIV]].<br />
<br />
= Further installation instructions =<br />
<br />
* [[Installing ConTeXt LMTX on MacOS]]<br />
* [[Modules#ConTeXt_LMTX|Installing Modules for ConTeXt LMTX]]<br />
* The official page '''[http://www.pragma-ade.nl/install.htm Installing ConTeXt LMTX ]''' is hosted by Pragma ADE.<br />
* Pragma ADE also provides the '''[http://www.pragma-ade.nl/download-1.htm ConTeXt MkIV distribution]''' (version MkIV is the predecessor of LMTX) for which there are also [[ConTeXt_Standalone|detailed installation instructions]].<br />
<br />
<br />
----<br />
<br />
{{Installation navbox}}<br />
<br />
[[Category:Basics]]<br />
[[Category:Installation]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Installation&diff=33783Installation2022-11-10T04:11:37Z<p>Thangalin: /* Unix */</p>
<hr />
<div>__NOTOC__<br />
Since April 2019, there is a new implementation of ConTeXt, named '''ConTeXt [[LMTX]]'''. It is tuned for LuaMetaTeX, the lean and mean successor of LuaTeX TeX engine (see [https://tug.org/TUGboat/tb40-1/tb124hagen-lmtx.pdf article]).<br />
<br />
= Download =<br />
<br />
<ul id="DownloadRework"><br />
<br />
<li><br />
=== Windows ===<br />
* X86 [http://lmtx.pragma-ade.nl/install-lmtx/context-mswin.zip 32bits]<br />
* X86 [http://lmtx.pragma-ade.nl/install-lmtx/context-win64.zip 64bits]<br />
* ARM [http://lmtx.pragma-ade.nl/install-lmtx/context-windows-arm64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== MacOS ===<br />
* X86 [http://lmtx.pragma-ade.nl/install-lmtx/context-osx-64.zip 64bits]<br />
* ARM [http://lmtx.pragma-ade.nl/install-lmtx/context-osx-arm64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== GNU/Linux ===<br />
* X86 [http://lmtx.pragma-ade.nl/install-lmtx/context-linux.zip 32b]|[http://lmtx.pragma-ade.nl/install-lmtx/context-linux-64.zip 64b]<br />
* ARM [http://lmtx.pragma-ade.nl/install-lmtx/context-linux-armhf.zip 32b]|[http://lmtx.pragma-ade.nl/install-lmtx/context-linux-aarch64.zip 64b]<br />
* Musl [http://lmtx.pragma-ade.nl/install-lmtx/context-linuxmusl.zip 64b]<br />
</li><br />
<br />
<br />
<li><br />
<br />
=== FreeBSD ===<br />
* [http://lmtx.pragma-ade.nl/install-lmtx/context-freebsd.zip 32bits]<br />
* [http://lmtx.pragma-ade.nl/install-lmtx/context-freebsd-amd64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== OpenBSD ===<br />
* 7.0 [http://lmtx.pragma-ade.nl/install-lmtx/context-openbsd7.0-amd64.zip 64b]<br />
* 7.1 [http://lmtx.pragma-ade.nl/install-lmtx/context-openbsd7.1-amd64.zip 64b]<br />
</li><br />
</ul><br />
</li><br />
<br />
</ul><br />
<br />
</li><br />
</ul><br />
<br />
<br />
You can [[Read Me| read the licence]] (Creative Commons GNU GPL for program code, and Creative Commons Attribution ShareAlike for documentation).<br />
<br />
= Installation =<br />
<br />
The general steps to install ConTeXt LMTX are as follows:<br />
<br />
# Create a directory for ConTeXt.<br />
# Download the platform-specific archive file into the ConTeXt directory.<br />
# Unpack the archive.<br />
# Execute the install program, which downloads the distribution.<br />
# Update the PATH environment variable.<br />
# Optionally, delete the archive file.<br />
<br />
See the next sections for instructions specific to various platforms.<br />
<br />
== Unix ==<br />
<br />
The steps in this section show how to download and install ConTeXt for a 64-bit Linux system. Change the archive file download link as needed for your target platform. Open a new terminal then run the following commands:<br />
<br />
# mkdir $HOME/context<br />
# cd $HOME/context<br />
# wget https://lmtx.pragma-ade.com/install-lmtx/context-linux-64.zip<br />
# unzip context-linux-64.zip<br />
# sh install.sh<br />
<br />
Update the PATH environment variable by using the path instructions displayed when the install program finishes. The instructions will vary depending on the type of shell being used:<br />
<br />
* '''Bash''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.bashrc</code><br />
* '''Zsh''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.zshenv</code><br />
* '''Sh'''/'''Ksh''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.profile</code><br />
* '''Tcsh'''/'''csh''': <code>echo 'set path = ($path ...instructions...)' >> ~/.cshrc</code><br />
<br />
For example, if ConTeXt was downloaded into `$HOME/context` on a system running bash, then the following line would update the PATH environment variable:<br />
<br />
<code>echo 'export PATH=$HOME/context/tex/texmf-linux-64/bin:$PATH' >> ~/.bashrc</code><br />
<br />
== MacOS ==<br />
<br />
The instructions for MacOS are the same as for Unix, but note that:<br />
<br />
* MacOS versions from Catalina (10.15) and newer use '''Zsh''' by default.<br />
* MacOS versions before Catalina use '''Bash''' by default.<br />
<br />
== Windows ==<br />
<br />
Complete the following steps to set up ConTeXt on Windows:<br />
<br />
# Create a directory for ConTeXt, such as `C:\context`.<br />
# Download the architecture-specific version into the ConTeXt directory.<br />
# Extract the archive.<br />
# Run: <code>install.bat</code><br />
# Run: <code>setpath.bat</code><br />
<br />
Installation is complete.<br />
<br />
= First Run =<br />
<br />
This section describes how to run ConTeXt to transform your first TeX document into a PDF.<br />
<br />
# Download the tex input file [[Media:Hello-world.tex|Hello-World.tex]] from our [[Detailed_Example|Detailed example]].<br />
# Run <code>context Hello-world.tex</code> in your terminal (or command prompt).<br />
# Check the PDF output <code>Hello-world.pdf</code>.<br />
<br />
Additional tutorials include:<br />
<br />
* [[First Document| Your first document]]<br />
* [[Detailed Example|Detailed example]]<br />
<br />
See the [[Sample documents]] page for even more examples.<br />
<br />
= Upgrade =<br />
<br />
Re-run the install program to upgrade, which will update the distribution incrementally:<br />
<br />
* Windows: <code>install.bat</code><br />
* Unix: <code>sh install.sh</code><br />
<br />
= Running MkIV =<br />
<br />
The new distribution has all the files to run the previous version of ConTeXt. <br />
* Run <code>context --luatex Hello-world.tex</code> to use the `luatex` binary and [[MkIV]].<br />
<br />
= Further installation instructions =<br />
<br />
* [[Installing ConTeXt LMTX on MacOS]]<br />
* [[Modules#ConTeXt_LMTX|Installing Modules for ConTeXt LMTX]]<br />
* The official page '''[http://www.pragma-ade.nl/install.htm Installing ConTeXt LMTX ]''' is hosted by Pragma ADE.<br />
* Pragma ADE also provides the '''[http://www.pragma-ade.nl/download-1.htm ConTeXt MkIV distribution]''' (version MkIV is the predecessor of LMTX) for which there are also [[ConTeXt_Standalone|detailed installation instructions]].<br />
<br />
<br />
----<br />
<br />
{{Installation navbox}}<br />
<br />
[[Category:Basics]]<br />
[[Category:Installation]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Command/startbuffer&diff=33770Command/startbuffer2022-10-19T01:27:13Z<p>Thangalin: </p>
<hr />
<div><cd:commandgroup name="buffer" type="environment" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"><br />
<cd:shortdesc><!-- a short command summary goes here --><br />
The environment <tt>\startbuffer ... \stopbuffer</tt> is used for temporarily storing content.<br />
</cd:shortdesc><br />
<cd:variants><br />
<cd:command category="buffer" file="buff-ini.mkiv" interfacedate="2020-07-14T09:24" interfacefile="i-buffer.xml" level="document" name="buffer" type="environment" variantnumber="1"><br />
<cd:arguments><br />
<cd:keywords optional="yes" ordinal="1"><br />
<cd:keywordsdoc>You can give a name to the buffer if you want.</cd:keywordsdoc><br />
<cd:constant type="cd:name"></cd:constant><br />
</cd:keywords><br />
</cd:arguments><br />
</cd:command><br />
</cd:variants><br />
<cd:description>You can store information temporarily for future use in your document with:<br />
<br />
<texcode><br />
\startbuffer[visit]<br />
If you want to see what Hasselt has in store you should come and visit it<br />
some time.<br />
\stopbuffer<br />
\getbuffer[visit]<br />
</texcode><br />
<br />
With<br />
<br />
<texcode><br />
\getbuffer[visit]<br />
</texcode><br />
you recall the stored text. The logical name is optional. With<br />
<br />
<texcode><br />
\typebuffer[visit]<br />
</texcode><br />
you get back the verbatim contents of the buffer, typeset as though inside <code>\starttyping...\stoptyping</code>.<br />
<br />
Buffers are set up with:<br />
<br />
<texcode><br />
\setupbuffer[..,..=..,..]<br />
</texcode><br />
<br />
You can also create your own named buffers as an instance of {{gen|startbuffer}} by using {{cmd|definebuffer}}.<br />
<br />
Note that the default {{cmd|startbuffer}} is not an instance of {{gen|startbuffer}}; it has its own (equivalent) definition.<br />
</cd:description><br />
<cd:examples><cd:example title=""><context source="yes"><br />
\startbuffer[buffer-name]<br />
Text...<br />
\stopbuffer<br />
<br />
\getbuffer[buffer-name] % insert content of \startbuffer ... \stopbuffer<br />
<br />
\typebuffer[buffer-name] % type content in verbatim mode<br />
</context></cd:example></cd:examples><br />
<cd:notes><br />
<cd:note author="Benjamin" date="2021-08-02T20:37:54+0200"><br />
<br />
To test if a (potentially empty) buffer exists: `\doifelsebuffer{buffername}{yes}{no}`<br />
<br />
To test if a buffer has content (more than blank lines): `\doiftextelse{\getbuffer[buffername]}{yes}{no}`<br />
<br />
</cd:note></cd:notes><br />
<cd:seealso><br />
<cd:source file="buff-ini.mkiv" originator="system"></cd:source><br />
<cd:wikipage originator="system" page="Category:Buffer"></cd:wikipage><br />
<cd:commandref name="_startbuffer"></cd:commandref><br />
<cd:commandref name="definebuffer"></cd:commandref><br />
<cd:commandref name="setupbuffer"></cd:commandref><br />
<cd:commandref name="includesvgbuffer"></cd:commandref></cd:seealso><br />
</cd:commandgroup></div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Using_Graphics&diff=33672Using Graphics2022-08-01T19:16:54Z<p>Thangalin: /* Custom Processing */</p>
<hr />
<div>= Usage =<br />
<br />
The simplest way to insert an image is to use:<br />
<br />
<texcode>\externalfigure[logo.pdf]</texcode><br />
<br />
This command places the PDF image <tt>logo.pdf</tt> in a {{cmd|vbox}}; the width and height of the image are equal to the natural dimensions of the image.<br />
<br />
To set the width of the image to a specific size, say <tt>1cm</tt>, use:<br />
<br />
<texcode>\externalfigure[logo.pdf][width=1cm]</texcode><br />
<br />
Similarly, to set the height of the image to a specific size, say <tt>2cm</tt>, use:<br />
<br />
<texcode>\externalfigure[logo.pdf][height=2cm]</texcode><br />
<br />
If only the <tt>width</tt> or <tt>height</tt> of the image is specified, the other dimension is scaled appropriately to keep the aspect ratio.<br />
<br />
To include a specific page, say page 5, of a multi-page PDF file, use:<br />
<br />
<texcode>\externalfigure[logo.pdf][page=5]</texcode><br />
<br />
These four variations cover the most common use cases.<br />
<br />
== File Formats ==<br />
<br />
ConTeXt supports the image formats enumerated below. The image format is determined from the file extension (case insensitive).<br />
<br />
* '''PDF''': File extension <tt>.pdf</tt><br />
* '''MPS''' (MetaPost output): File extension <tt>.mps</tt> or <tt>.&lt;digits&gt;</tt><br />
* '''JPEG''': File extension <tt>.jpg</tt> or <tt>.jpeg</tt><br />
* '''PNG''': File extension <tt>.png</tt><br />
* '''JPEG 2000''': File extension <tt>.jp2</tt><br />
* '''JBIG''' or '''JBIG2''': File extension <tt>.jbig</tt>, <tt>.jbig2</tt>, or <tt>.jb2</tt><br />
<br />
An old page (2010), gives details on supported [[File Formats|file formats]]<br />
<br />
== Image Conversion ==<br />
<br />
The image file formats listed in the previous section are the ones that may be embedded directly in a PDF. ConTeXt also supports a few other formats that are first converted to PDF using an external program. Of course, for such a conversion to work, the corresponding converter must be in the <tt>PATH</tt>.<br />
<br />
<table><br />
<tr class="odd"><br />
<td align="left">Format</td><br />
<td align="left">Extension</td><br />
<td align="left">Converter</td><br />
</tr><br />
<tr class="even"><br />
<td align="left"><strong>SVG</strong></td><br />
<td align="left"><code>.svg</code>, <code>.svgz</code></td><br />
<td align="left"><code>inkscape</code></td><br />
</tr><br />
<tr class="odd"><br />
<td align="left"><strong>EPS</strong></td><br />
<td align="left"><code>.eps</code>, <code>.ai</code></td><br />
<td align="left"><code>gs</code> (or <code>gswin32c</code> on Windows) from Ghostscript</td><br />
</tr><br />
<tr class="even"><br />
<td align="left"><strong>GIF</strong></td><br />
<td align="left"><code>.gif</code></td><br />
<td align="left"><code>gm</code> from GraphicsMagick</td><br />
</tr><br />
<tr class="odd"><br />
<td align="left"><strong>TIFF</strong></td><br />
<td align="left"><code>.tiff</code></td><br />
<td align="left"><code>gm</code> from GraphicsMagick</td><br />
</tr><br />
</table><br />
<br />
The conversion generates a PDF file with prefix <tt>m_k_i_v_</tt> and a suffix <tt>.pdf</tt> added to the name of the original file. The result is cached, and the conversion is rerun if the timestamp of the original file is newer than that of the converted file.<br />
<br />
In LMTX file name contains md5sum of hash of the relevant source image parameters (resolution, dimensions, ...), e.g.:<br />
<br />
<pre><br />
hacker_jpg_c60ccda70ef92e32d7a6334f31c23259.gray.pdf <br />
</pre><br />
<br />
It is possible to change the converter used with the following code:<br />
<br />
<pre><br />
\startluacode<br />
local function converter(oldname, newname, resolution)<br />
if not resolution or resolution == "" then<br />
resolution = 50<br />
end<br />
os.execute(string.format(<br />
'convert -density %ix%i "%s" "%s"',<br />
resolution, resolution, oldname, newname)<br />
)<br />
end<br />
<br />
-- Set the PDF and default TIFF converters to the above function.<br />
figures.converters.tif.pdf = converter<br />
figures.converters.tif.default = converter<br />
\stopluacode<br />
<br />
\starttext<br />
% Substitute any TIFF here.<br />
\externalfigure[cow.tiff]<br />
\stoptext<br />
</pre><br />
<br />
See also: https://source.contextgarden.net/tex/context/base/mkiv/grph-inc.lua<br />
<br />
== Interaction ==<br />
<br />
By default, the interactive elements of the included PDF file are discarded. To enable the interactive elements of the included PDF file, use<br />
<texcode>\externalfigure[filename.pdf][interaction=yes]</texcode><br />
<br />
For further reading, don't forget [[Including pages from PDF documents]].<br />
<br />
== Image Directory ==<br />
<br />
By default, ConTeXt searches an image in the current directory, the parent directory, and the grand-parent directory.<br />
<br />
To search for images in other directories, for example a <tt>./images</tt> subdirectory and <tt>/home/user/images</tt>, use:<br />
<br />
<texcode>\setupexternalfigures[directory={images, /home/user/images}]</texcode><br />
<br />
Note: always use forward slashes (`/`) in path names, regardless of operating system.<br />
<br />
The default search order is: the current directory, the parent directory, the grand-parent directory, and then the paths specified by the <tt>directory</tt> key. To restrict image search only to the paths specified by the <tt>directory</tt> key, use:<br />
<br />
<texcode>\setupexternalfigures[location=global]</texcode><br />
<br />
To restore the default search behavior, use:<br />
<br />
<texcode>\setupexternalfigures[location={local,global}]</texcode><br />
<br />
The ConTeXt distribution includes three sample images: <tt>cow.pdf</tt>, <tt>mill.png</tt>, and <tt>hacker.jpg</tt>, that are useful when creating minimum working examples to illustrate a bug on the mailing list. These images are locating in the <tt>TEXMF</tt> directory. To add the <tt>TEXMF</tt> directory to the image search path, use:<br />
<br />
<texcode>\setupexternalfigures[location={local,global,default}]</texcode><br />
<br />
The above alternative adds the ''entire'' <tt>TEXMF</tt> directory to the search path, ''including the'' <tt>doc/</tt> ''directory!'' Therefore, one needs to be extremely careful when using this option. In fact, I would advise not using <tt>location=default</tt> except for illustrative minimal working examples.<br />
<br />
== Remote Images ==<br />
<br />
The {{cmd|externalfigure}} command supports reading files from web servers, for example:<br />
<br />
<texcode>\externalfigure[http://tug.org/images/logobw.jpg]</texcode><br />
When a document containing a remote file is compiled for the first time, the remote file is downloaded from the server and stored in the LuaTeX cache directory. This cached file is used during subsequent runs.<br />
<br />
Normally, the remote image is downloaded again if the image in the cache is older than 1~day. To change this threshold to, for example, 2<sub>minutes (120</sub>seconds), either add<br />
<br />
<texcode>\enabledirectives[schemes.threshold=120]</texcode><br />
<br />
in the ConTeXt file, or compile the ConTeXt file using the command<br />
<br />
<pre>context --directives=schemes.threshold=120 <em>filename</em></pre><br />
The variable <tt>schemes.threshold</tt> is global, so changing its value affects all other macros like <tt>\input</tt>, <tt>\usemodule</tt>, <tt>\component</tt>, etc. that load remote files.<br />
<br />
=== HTTP Proxy ===<br />
<br />
To use an http proxy for fetching images, the http variable ([http://w3.impa.br/~diego/software/luasocket/http.html LuaSocket]) has to be set up as follows:<br />
<br />
<texcode><br />
\ctxlua{http = require("socket.http"); http.PROXY = "http://proxy.example.com:3128"}<br />
</texcode><br />
<br />
Replace `http://proxy.example.com:3128` with the proxy URL.<br />
<br />
To disable the proxy again:<br />
<br />
<texcode><br />
\ctxlua{http = require("socket.http"); http.PROXY = nil}<br />
</texcode><br />
<br />
=== HTTPS ===<br />
<br />
For self-signed certificates retrieved over HTTPS, the `curl` command requires a flag to retrieve insecure files, which is not enabled by default. Open `tex/texmf-context/tex/context/base/mkiv/data-sch.lua` to find:<br />
<br />
<pre><br />
local function runcurl(name,cachename) -- we use sockets instead or the curl library when possible<br />
local command = "curl --silent --create-dirs --output " .. cachename .. " " .. name<br />
os.spawn(command)<br />
end<br />
</pre><br />
<br />
Insert the `-k` or `--insecure` option:<br />
<br />
<pre><br />
local command = "curl --insecure --silent --create-dirs --output " .. cachename .. " " .. name<br />
</pre><br />
<br />
== Inline Images ==<br />
<br />
Embedding inline images via base64 encoding using the memstream function (supports pdf and png streams):<br />
<br />
<texcode><br />
\startluacode<br />
local cow = mime.unb64("JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURlY29kZT4+CnN0cmVhbQp4nJWayY40SW6E7/UUcRaQIafvfp6bAAkY9SM0oHXmMBAgvb7sM0ZmVf86CYNB/+HpC500Ghevv13ljqvwv+e/v//16+//eV3/+l9f8y4nRlz/8xVx99XW9Y9fcf2D/v8f+v+/a9q5/vSb/vnbn/7p629a+oq79L639jpjRKzcmC1fsUe927xaO3fRLwydsu/Q0C7afmj5Pv3WMb32+6zGgP61rz77Xdu4fv/KkWjXiHH3xpp12r3ONeq+W3QG1r7G6Pc8yyvmOHev19LBbXtFb/fo1zkan6GBqS3qFTWaBnLN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ZgowIDEyCjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwNDYzNiAwMDAwMCBuIAowMDAwMDA0OTg2IDAwMDAwIG4gCjAwMDAwMDQ1NzcgMDAwMDAgbiAKMDAwMDAwNDQyNiAwMDAwMCBuIAowMDAwMDAwMDE1IDAwMDAwIG4gCjAwMDAwMDQ0MDYgMDAwMDAgbiAKMDAwMDAwNDY4NCAwMDAwMCBuIAowMDAwMDA0ODM4IDAwMDAwIG4gCjAwMDAwMDQ3MjUgMDAwMDAgbiAKMDAwMDAwNDc3OCAwMDAwMCBuIAowMDAwMDA0ODA4IDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgMTIgL1Jvb3QgMSAwIFIgL0luZm8gMiAwIFIKL0lEIFs8ODE0NjQ5NTc3Qzg3MTE1QzRDQzBDQjg0QkU3RTQ1MEY+PDgxNDY0OTU3N0M4NzExNUM0Q0MwQ0I4NEJFN0U0NTBGPl0KPj4Kc3RhcnR4cmVmCjUxMzMKJSVFT0YK")<br />
figures.setmemstream("inline",cow)<br />
context.externalfigure({"memstream:///inline"})<br />
\stopluacode<br />
</texcode><br />
<br />
== Custom Processing ==<br />
<br />
The following example changes the width of images based on file name extensions:<br />
<br />
<texcode><br />
\setupexternalfigures[<br />
location={local,global,default},<br />
width=\textwidth<br />
]<br />
\defineexternalfigure[svg][width=1cm]<br />
\defineexternalfigure[jpg][width=2cm]<br />
\defineexternalfigure[png][width=4cm]<br />
<br />
% Won't be applied because there's no process action.<br />
% Default (\textwidth) is used, as defined above.<br />
\defineexternalfigure[pdf][width=6cm]<br />
<br />
\starttexdefinition includegraphics #1<br />
\splitfilename{#1}<br />
<br />
\processaction[\splitofftype][<br />
jpg=>{\externalfigure[#1][jpg]},<br />
png=>{\externalfigure[#1][png]},<br />
svg=>{\externalfigure[#1][svg][conversion=mp]},<br />
default=>{\externalfigure[#1]},<br />
unknown=>{\externalfigure[#1]}<br />
]<br />
\stoptexdefinition<br />
<br />
\starttext<br />
\includegraphics{kitten.jpg}<br />
\includegraphics{mill.png}<br />
\includegraphics{cow.pdf}<br />
\includegraphics{tiger.svg}<br />
\stoptext<br />
</texcode><br />
<br />
It's also possible to use {{cmd|setfigureconversion}} to instruct ConTeXt to use MetaPost when rendering SVG files. Such as:<br />
<br />
<texcode><br />
\setfigureconversion[svg][mp]<br />
<br />
\starttext<br />
\externalfigure[kitten.jpg][width=2cm]<br />
\externalfigure[mill.png] [width=4cm]<br />
\externalfigure[cow.pdf] [width=6cm]<br />
\externalfigure[tiger.svg] [width=1cm]<br />
\stoptext<br />
</texcode><br />
<br />
= Transformations =<br />
<br />
== Image Scaling ==<br />
<br />
{{ note | If either <tt>width</tt> or <tt>height</tt> is specified, then the <tt>scale</tt> key has no effect. }}<br />
<br />
<br />
To scale an image use the <tt>scale</tt> key: <tt>scale=1000</tt> corresponds to the original dimensions of the image, <tt>scale=500</tt> scales the image to 50% of the original size, <tt>scale=1500</tt> scales the images to 150% of the original size, and so on. For example:<br />
<br />
<texcode>\externalfigure[logo.pdf][scale=500]</texcode><br />
<br />
scales the image to 50% of its size.<br />
<br />
Use <tt>\setupexternalfigures</tt> to set the scale of all images. For example, to scale all images to be twice their original size, use:<br />
<br />
<texcode>\setupexternalfigures[scale=2000]</texcode><br />
<br />
In addition, the <tt>xscale</tt> and <tt>yscale</tt> keys scale the image in only one dimension. For example:<br />
<br />
<texcode>\externalfigure[logo.pdf][xscale=500]<br />
\externalfigure[logo.pdf][yscale=500]</texcode><br />
<br />
Scaling changes the visible size of a picture, but not the data or file size. If you want to reduce your file size by decreasing image resolution, see [[Downsampling]].<br />
<br />
== Image Dimension Restriction ==<br />
<br />
ConTeXt can limit included images to particular dimensions. For example, to ensure that an included image is not more than <tt>0.2\textwidth</tt>:<br />
<br />
<texcode>\externalfigure[logo.pdf][maxwidth=0.2\textwidth]</texcode><br />
<br />
If <tt>maxwidth</tt> is specified and the width of the image is less than <tt>maxwidth</tt>, then the image is not scaled; if the width of the image is greater than <tt>maxwidth</tt>, then the width is restricted to <tt>maxwidth</tt> and the height is scaled appropriately to maintain the original aspect ratio.<br />
<br />
The option <tt>maxheight</tt> is analogous to <tt>maxwidth</tt>, for checking the height of the image.<br />
<br />
For example, to ensure that figures do not overflow the text~area, one may set:<br />
<br />
<texcode>\setupexternalfigures<br />
[maxwidth=\textwidth,<br />
maxheight=0.8\textheight]</texcode><br />
<br />
== Image Rotation ==<br />
<br />
Rotate included images by 90°, 180°, or 270° using the <tt>orientation</tt> key. For example:<br />
<br />
<texcode>\externalfigure[logo.pdf][orientation=90]</texcode><br />
<br />
To rotate by an arbitrary angle, use the {{cmd|rotate}} command. For example:<br />
<br />
<texcode>\rotate[rotation=45]{\externalfigure[logo.pdf]}</texcode><br />
<br />
== Image Mirroring ==<br />
<br />
To mirror (flip) an image, use the generic {{cmd|mirror}} command. For example, to mirror horizontally:<br />
<br />
<texcode>\mirror{\externalfigure[logo.pdf]}</texcode><br />
<br />
To mirror vertically, first rotate the image by 180° and then mirror it:<br />
<br />
<texcode>\mirror{\externalfigure[logo.pdf][orientation=180]}</texcode><br />
<br />
== Image Clipping ==<br />
<br />
Clip an image using the generic {{cmd|clip}} command. For example, to clip the original image to a <tt>1cm x 2cm</tt> rectangle at an offset of <tt>(3mm,5mm)</tt> from the top left corner:<br />
<br />
<texcode>\clip[width=1cm, height=2cm, hoffset=3mm, voffset=5mm]<br />
{\externalfigure[logo.pdf]}</texcode><br />
<br />
As another example, this cuts the image into a <tt>3x3</tt> pieces and then outputs the <tt>(2,2)</tt> piece:<br />
<br />
<texcode>\clip[nx=3,ny=3,x=2,y=2]<br />
{\externalfigure[logo.pdf]}</texcode><br />
<br />
<br />
In PDF files, it is possible to specify different size information in PDF headers MediaBox, TrimBox, CropBox, and ArtBox. To clip to one of these sizes, use<br />
<br />
<texcode>\externalfigure[logo.pdf][size=art]</texcode><br />
<br />
Other options are: `none` (detault), `media` for MediaBox, `crop` for CropBox, `trim` for TrimBox, and `art` for ArtBox.<br />
<br />
= Troubleshooting =<br />
<br />
This section describes various tips for discovering problems with embedded images.<br />
<br />
== Visualize Bounding Box ==<br />
<br />
If, for instance, the image is taking more space than expected, it can be useful to visualize the bounding box of the image. To do this:<br />
<br />
<texcode>\externalfigure[logo.pdf][frame=on]</texcode><br />
<br />
ConTeXt includes a Perl script <tt>pdftrimwhite</tt> that removes extra white space at the borders of a PDF file. To run this script:<br />
<br />
<pre>mtxrun --script pdftrimwhite [flags] input output</pre><br />
<br />
The most important flag is <tt>--offset=dimen</tt>, which keeps some extra space around the trimmed image.<br />
<br />
Similar functionality is provided by another Perl script, <tt>pdfcrop</tt>, that is included in most TeX distributions.<br />
<br />
== Diagnostic Tracking ==<br />
<br />
To get diagnostic information about image inclusion, enable the tracker <tt>graphics.locating</tt> by editing the ConTeXt file and adding:<br />
<br />
<texcode>\enabletrackers[graphics.locating]</texcode><br />
<br />
Alternatively, compile the ConTeXt file using:<br />
<br />
<texcode>context --trackers=graphics.locating filename</texcode><br />
<br />
The tracker writes diagnostics to the console. Suppose we use <tt>\externalfigure[somefile.pdf]</tt> and ConTeXt finds the file in the current search path; then the following information is printed on the console:<br />
<br />
<pre>graphics &gt; inclusion &gt; locations: local,global<br />
graphics &gt; inclusion &gt; path list: . .. ../..<br />
graphics &gt; inclusion &gt; strategy: forced format pdf<br />
graphics &gt; inclusion &gt; found: somefile.pdf -&gt; somefile.pdf<br />
graphics &gt; inclusion &gt; format natively supported by backend: pdf</pre><br />
If the file <tt>somefile.pdf</tt> is not found in the current search path, then the following information is printed on the console (even if the <tt>graphics.locating</tt> tracker is not set):<br />
<br />
<pre>graphics &gt; inclusion &gt; strategy: forced format pdf<br />
graphics &gt; inclusion &gt; not found: somefile.pdf<br />
graphics &gt; inclusion &gt; not found: ./somefile.pdf<br />
graphics &gt; inclusion &gt; not found: ../somefile.pdf<br />
graphics &gt; inclusion &gt; not found: ../../somefile.pdf<br />
graphics &gt; inclusion &gt; not found: images/somefile.pdf<br />
graphics &gt; inclusion &gt; not found: /home/user/images/somefile.pdf<br />
graphics &gt; inclusion &gt; format not supported: </pre><br />
and a placeholder gray box is put in the output:<br />
<br />
<context> </context><br />
<br />
Sometimes, one would rather use a placeholder image for an image that is yet to be made. In such cases, load the MP library <tt>dum</tt> via:<br />
<br />
<texcode>\useMPlibrary[dum]</texcode><br />
<br />
Then, whenever an image file is not found in the current search path, a random MetaPost image is shown in the output.<br />
<br />
<context> </context><br />
<br />
== Leading Paragraph ==<br />
<br />
Using {{cmd|externalfigure}}<tt>[...]</tt> at the beginning of a paragraph results in a line break after the image. This is because {{cmd|externalfigure}} is a {{cmd|vbox}} and when a {{cmd|vbox}} is encountered at (what appears to be) the beginning of a paragraph, it remains in vertical mode. To prevent this, add {{cmd|dontleavehmode}} before {{cmd|externalfigure}}, like this:<br />
<br />
<texcode>\dontleavehmode<br />
\externalfigure[...] ... first line ...</texcode><br />
<br />
= Multiple Image Settings =<br />
<br />
== Image Settings ==<br />
<br />
Suppose your document contains many side-by-side images, and you want all of these images to be of the same size. In addition, you want to control the size of all images by changing only one setup. To do this, you can use the {{cmd|defineexternalfigure}} macro, which defines a named collection of image settings. For example, to define a collection where the image width is <tt>3cm</tt>, use:<br />
<br />
<texcode>\defineexternalfigure[logo-settings]<br />
[width=3cm]</texcode><br />
<br />
And then to use these settings in an image, use:<br />
<br />
<texcode>\externalfigure[group.pdf][logo-settings]</texcode><br />
<br />
or, if you want to add or override settings, use:<br />
<br />
<texcode>\externalfigure[group.pdf][logo-settings]<br />
[height=2cm]</texcode><br />
<br />
== Image Labels ==<br />
<br />
Suppose your document contains an image at multiple locations; all of these images are to be of the same size, which is not necessarily the same as the natural size of the image. Furthermore, as before, you want to set the size of all the images by changing only one setup. Here, the macro to use is {{cmd|useexternalfigure}}, which defines a symbolic label for inserting an image plus settings. For example:<br />
<br />
<texcode>\useexternalfigure[mylogo]<br />
[logo.pdf][width=2cm]</texcode><br />
<br />
defines an image label <tt>mylogo</tt> that maps to the image file <tt>logo.pdf</tt> and sets its width to <tt>2cm</tt>. This image label may be used as a normal image filename:<br />
<br />
<texcode>\externalfigure[mylogo]</texcode><br />
<br />
<br />
= Movies =<br />
<br />
Movies aren't recognized automatically yet; they must be delcared verbosely:<br />
<br />
<texcode><br />
\externalfigure[demo.mov][label=demo,width=4cm,height=4cm,preview=yes]<br />
</texcode><br />
<br />
<tt>preview=yes</tt> shows the first image as preview.<br />
You find more about interactive Elements in [http://www.pragma-ade.nl/general/manuals/mwidget-s.pdf mwidget-s.pdf]<br />
<br />
Unfortunately, people who are fond of Linux cannot embed movies because the linux release of acroread doesn't support that. An alternative solution consists in launching your prefered player (MPlayer) from acroread:<br />
<br />
<texcode><br />
\defineprogram[dummy.mpeg][dummy.mpeg.sh]<br />
<br />
\starttext<br />
\goto{\externalfigure[dummy-preview][width=0.48\textwidth]}[program(dummy.mpeg{})]<br />
\stoptext<br />
</texcode><br />
<br />
The script dummy.mpeg.sh should contain:<br />
<pre><nowiki><br />
FILE=$(basename "$0"); mplayer -fs -zoom ${FILE/.sh/}<br />
</nowiki></pre><br />
<br />
<br />
[[Category:Graphics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Command/replaceword&diff=33671Command/replaceword2022-08-01T18:52:22Z<p>Thangalin: </p>
<hr />
<div><cd:commandgroup name="replaceword" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"><br />
<cd:shortdesc><!-- a short command summary goes here --><br />
The command <tt>\replaceword</tt> can add replacement words to ligature exception dictionaries. Define different replacement sets and activate them with {{cmd|setreplacements}}.</cd:shortdesc><br />
<cd:variants><br />
<cd:command category="language" file="lang-rep.mkiv" interfacedate="2021-03-02T11:08" interfacefile="i-replacement.xml" level="style" name="replaceword" variantnumber="1"><br />
<cd:arguments><br />
<cd:keywords ordinal="1"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:name"></cd:constant><br />
</cd:keywords><br />
<cd:keywords optional="yes" ordinal="2"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:text"></cd:constant><br />
</cd:keywords><br />
<cd:keywords ordinal="3"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:text"></cd:constant><br />
</cd:keywords><br />
</cd:arguments><br />
</cd:command><br />
</cd:variants><br />
<cd:description><!-- the long description of the command goes here --><br />
</cd:description><br />
<cd:examples></cd:examples><br />
<cd:notes></cd:notes><br />
<cd:seealso><br />
<cd:source file="lang-rep.mkiv" originator="system"></cd:source><br />
<cd:wikipage originator="system" page="Category:Language"></cd:wikipage></cd:seealso><br />
</cd:commandgroup></div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Command/replaceword&diff=33670Command/replaceword2022-08-01T18:51:55Z<p>Thangalin: </p>
<hr />
<div><cd:commandgroup name="replaceword" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"><br />
<cd:shortdesc><!-- a short command summary goes here --><br />
The command <tt>\replaceword</tt> can add replacement words to ligature exception dictionaries. Define different replacement sets and activate them with \setreplacements.</cd:shortdesc><br />
<cd:variants><br />
<cd:command category="language" file="lang-rep.mkiv" interfacedate="2021-03-02T11:08" interfacefile="i-replacement.xml" level="style" name="replaceword" variantnumber="1"><br />
<cd:arguments><br />
<cd:keywords ordinal="1"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:name"></cd:constant><br />
</cd:keywords><br />
<cd:keywords optional="yes" ordinal="2"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:text"></cd:constant><br />
</cd:keywords><br />
<cd:keywords ordinal="3"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:text"></cd:constant><br />
</cd:keywords><br />
</cd:arguments><br />
</cd:command><br />
</cd:variants><br />
<cd:description><!-- the long description of the command goes here --><br />
</cd:description><br />
<cd:examples></cd:examples><br />
<cd:notes></cd:notes><br />
<cd:seealso><br />
<cd:source file="lang-rep.mkiv" originator="system"></cd:source><br />
<cd:wikipage originator="system" page="Category:Language"></cd:wikipage></cd:seealso><br />
</cd:commandgroup></div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Command/replaceword&diff=33669Command/replaceword2022-08-01T18:51:16Z<p>Thangalin: </p>
<hr />
<div><cd:commandgroup name="replaceword" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"><br />
<cd:shortdesc><!-- a short command summary goes here --><br />
The command <tt>\replaceword</tt> can add replacement words to ligature exception dictionaries.</cd:shortdesc><br />
<cd:variants><br />
<cd:command category="language" file="lang-rep.mkiv" interfacedate="2021-03-02T11:08" interfacefile="i-replacement.xml" level="style" name="replaceword" variantnumber="1"><br />
<cd:arguments><br />
<cd:keywords ordinal="1"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:name"></cd:constant><br />
</cd:keywords><br />
<cd:keywords optional="yes" ordinal="2"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:text"></cd:constant><br />
</cd:keywords><br />
<cd:keywords ordinal="3"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:text"></cd:constant><br />
</cd:keywords><br />
</cd:arguments><br />
</cd:command><br />
</cd:variants><br />
<cd:description><!-- the long description of the command goes here --><br />
</cd:description><br />
<cd:examples></cd:examples><br />
<cd:notes></cd:notes><br />
<cd:seealso><br />
<cd:source file="lang-rep.mkiv" originator="system"></cd:source><br />
<cd:wikipage originator="system" page="Category:Language"></cd:wikipage></cd:seealso><br />
</cd:commandgroup></div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Command/replaceword&diff=33668Command/replaceword2022-08-01T18:50:46Z<p>Thangalin: Created page with "Documentation for \replaceword"</p>
<hr />
<div><cd:commandgroup name="replaceword" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"><br />
<cd:shortdesc><!-- a short command summary goes here --><br />
The command <tt>\replaceword</tt> can replace words to ligature exception dictionaries.</cd:shortdesc><br />
<cd:variants><br />
<cd:command category="language" file="lang-rep.mkiv" interfacedate="2021-03-02T11:08" interfacefile="i-replacement.xml" level="style" name="replaceword" variantnumber="1"><br />
<cd:arguments><br />
<cd:keywords ordinal="1"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:name"></cd:constant><br />
</cd:keywords><br />
<cd:keywords optional="yes" ordinal="2"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:text"></cd:constant><br />
</cd:keywords><br />
<cd:keywords ordinal="3"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:text"></cd:constant><br />
</cd:keywords><br />
</cd:arguments><br />
</cd:command><br />
</cd:variants><br />
<cd:description><!-- the long description of the command goes here --><br />
</cd:description><br />
<cd:examples></cd:examples><br />
<cd:notes></cd:notes><br />
<cd:seealso><br />
<cd:source file="lang-rep.mkiv" originator="system"></cd:source><br />
<cd:wikipage originator="system" page="Category:Language"></cd:wikipage></cd:seealso><br />
</cd:commandgroup></div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Using_Graphics&diff=33667Using Graphics2022-08-01T06:38:25Z<p>Thangalin: /* Custom Processing */</p>
<hr />
<div>= Usage =<br />
<br />
The simplest way to insert an image is to use:<br />
<br />
<texcode>\externalfigure[logo.pdf]</texcode><br />
<br />
This command places the PDF image <tt>logo.pdf</tt> in a {{cmd|vbox}}; the width and height of the image are equal to the natural dimensions of the image.<br />
<br />
To set the width of the image to a specific size, say <tt>1cm</tt>, use:<br />
<br />
<texcode>\externalfigure[logo.pdf][width=1cm]</texcode><br />
<br />
Similarly, to set the height of the image to a specific size, say <tt>2cm</tt>, use:<br />
<br />
<texcode>\externalfigure[logo.pdf][height=2cm]</texcode><br />
<br />
If only the <tt>width</tt> or <tt>height</tt> of the image is specified, the other dimension is scaled appropriately to keep the aspect ratio.<br />
<br />
To include a specific page, say page 5, of a multi-page PDF file, use:<br />
<br />
<texcode>\externalfigure[logo.pdf][page=5]</texcode><br />
<br />
These four variations cover the most common use cases.<br />
<br />
== File Formats ==<br />
<br />
ConTeXt supports the image formats enumerated below. The image format is determined from the file extension (case insensitive).<br />
<br />
* '''PDF''': File extension <tt>.pdf</tt><br />
* '''MPS''' (MetaPost output): File extension <tt>.mps</tt> or <tt>.&lt;digits&gt;</tt><br />
* '''JPEG''': File extension <tt>.jpg</tt> or <tt>.jpeg</tt><br />
* '''PNG''': File extension <tt>.png</tt><br />
* '''JPEG 2000''': File extension <tt>.jp2</tt><br />
* '''JBIG''' or '''JBIG2''': File extension <tt>.jbig</tt>, <tt>.jbig2</tt>, or <tt>.jb2</tt><br />
<br />
An old page (2010), gives details on supported [[File Formats|file formats]]<br />
<br />
== Image Conversion ==<br />
<br />
The image file formats listed in the previous section are the ones that may be embedded directly in a PDF. ConTeXt also supports a few other formats that are first converted to PDF using an external program. Of course, for such a conversion to work, the corresponding converter must be in the <tt>PATH</tt>.<br />
<br />
<table><br />
<tr class="odd"><br />
<td align="left">Format</td><br />
<td align="left">Extension</td><br />
<td align="left">Converter</td><br />
</tr><br />
<tr class="even"><br />
<td align="left"><strong>SVG</strong></td><br />
<td align="left"><code>.svg</code>, <code>.svgz</code></td><br />
<td align="left"><code>inkscape</code></td><br />
</tr><br />
<tr class="odd"><br />
<td align="left"><strong>EPS</strong></td><br />
<td align="left"><code>.eps</code>, <code>.ai</code></td><br />
<td align="left"><code>gs</code> (or <code>gswin32c</code> on Windows) from Ghostscript</td><br />
</tr><br />
<tr class="even"><br />
<td align="left"><strong>GIF</strong></td><br />
<td align="left"><code>.gif</code></td><br />
<td align="left"><code>gm</code> from GraphicsMagick</td><br />
</tr><br />
<tr class="odd"><br />
<td align="left"><strong>TIFF</strong></td><br />
<td align="left"><code>.tiff</code></td><br />
<td align="left"><code>gm</code> from GraphicsMagick</td><br />
</tr><br />
</table><br />
<br />
The conversion generates a PDF file with prefix <tt>m_k_i_v_</tt> and a suffix <tt>.pdf</tt> added to the name of the original file. The result is cached, and the conversion is rerun if the timestamp of the original file is newer than that of the converted file.<br />
<br />
In LMTX file name contains md5sum of hash of the relevant source image parameters (resolution, dimensions, ...), e.g.:<br />
<br />
<pre><br />
hacker_jpg_c60ccda70ef92e32d7a6334f31c23259.gray.pdf <br />
</pre><br />
<br />
It is possible to change the converter used with the following code:<br />
<br />
<pre><br />
\startluacode<br />
local function converter(oldname, newname, resolution)<br />
if not resolution or resolution == "" then<br />
resolution = 50<br />
end<br />
os.execute(string.format(<br />
'convert -density %ix%i "%s" "%s"',<br />
resolution, resolution, oldname, newname)<br />
)<br />
end<br />
<br />
-- Set the PDF and default TIFF converters to the above function.<br />
figures.converters.tif.pdf = converter<br />
figures.converters.tif.default = converter<br />
\stopluacode<br />
<br />
\starttext<br />
% Substitute any TIFF here.<br />
\externalfigure[cow.tiff]<br />
\stoptext<br />
</pre><br />
<br />
See also: https://source.contextgarden.net/tex/context/base/mkiv/grph-inc.lua<br />
<br />
== Interaction ==<br />
<br />
By default, the interactive elements of the included PDF file are discarded. To enable the interactive elements of the included PDF file, use<br />
<texcode>\externalfigure[filename.pdf][interaction=yes]</texcode><br />
<br />
For further reading, don't forget [[Including pages from PDF documents]].<br />
<br />
== Image Directory ==<br />
<br />
By default, ConTeXt searches an image in the current directory, the parent directory, and the grand-parent directory.<br />
<br />
To search for images in other directories, for example a <tt>./images</tt> subdirectory and <tt>/home/user/images</tt>, use:<br />
<br />
<texcode>\setupexternalfigures[directory={images, /home/user/images}]</texcode><br />
<br />
Note: always use forward slashes (`/`) in path names, regardless of operating system.<br />
<br />
The default search order is: the current directory, the parent directory, the grand-parent directory, and then the paths specified by the <tt>directory</tt> key. To restrict image search only to the paths specified by the <tt>directory</tt> key, use:<br />
<br />
<texcode>\setupexternalfigures[location=global]</texcode><br />
<br />
To restore the default search behavior, use:<br />
<br />
<texcode>\setupexternalfigures[location={local,global}]</texcode><br />
<br />
The ConTeXt distribution includes three sample images: <tt>cow.pdf</tt>, <tt>mill.png</tt>, and <tt>hacker.jpg</tt>, that are useful when creating minimum working examples to illustrate a bug on the mailing list. These images are locating in the <tt>TEXMF</tt> directory. To add the <tt>TEXMF</tt> directory to the image search path, use:<br />
<br />
<texcode>\setupexternalfigures[location={local,global,default}]</texcode><br />
<br />
The above alternative adds the ''entire'' <tt>TEXMF</tt> directory to the search path, ''including the'' <tt>doc/</tt> ''directory!'' Therefore, one needs to be extremely careful when using this option. In fact, I would advise not using <tt>location=default</tt> except for illustrative minimal working examples.<br />
<br />
== Remote Images ==<br />
<br />
The {{cmd|externalfigure}} command supports reading files from web servers, for example:<br />
<br />
<texcode>\externalfigure[http://tug.org/images/logobw.jpg]</texcode><br />
When a document containing a remote file is compiled for the first time, the remote file is downloaded from the server and stored in the LuaTeX cache directory. This cached file is used during subsequent runs.<br />
<br />
Normally, the remote image is downloaded again if the image in the cache is older than 1~day. To change this threshold to, for example, 2<sub>minutes (120</sub>seconds), either add<br />
<br />
<texcode>\enabledirectives[schemes.threshold=120]</texcode><br />
<br />
in the ConTeXt file, or compile the ConTeXt file using the command<br />
<br />
<pre>context --directives=schemes.threshold=120 <em>filename</em></pre><br />
The variable <tt>schemes.threshold</tt> is global, so changing its value affects all other macros like <tt>\input</tt>, <tt>\usemodule</tt>, <tt>\component</tt>, etc. that load remote files.<br />
<br />
=== HTTP Proxy ===<br />
<br />
To use an http proxy for fetching images, the http variable ([http://w3.impa.br/~diego/software/luasocket/http.html LuaSocket]) has to be set up as follows:<br />
<br />
<texcode><br />
\ctxlua{http = require("socket.http"); http.PROXY = "http://proxy.example.com:3128"}<br />
</texcode><br />
<br />
Replace `http://proxy.example.com:3128` with the proxy URL.<br />
<br />
To disable the proxy again:<br />
<br />
<texcode><br />
\ctxlua{http = require("socket.http"); http.PROXY = nil}<br />
</texcode><br />
<br />
=== HTTPS ===<br />
<br />
For self-signed certificates retrieved over HTTPS, the `curl` command requires a flag to retrieve insecure files, which is not enabled by default. Open `tex/texmf-context/tex/context/base/mkiv/data-sch.lua` to find:<br />
<br />
<pre><br />
local function runcurl(name,cachename) -- we use sockets instead or the curl library when possible<br />
local command = "curl --silent --create-dirs --output " .. cachename .. " " .. name<br />
os.spawn(command)<br />
end<br />
</pre><br />
<br />
Insert the `-k` or `--insecure` option:<br />
<br />
<pre><br />
local command = "curl --insecure --silent --create-dirs --output " .. cachename .. " " .. name<br />
</pre><br />
<br />
== Inline Images ==<br />
<br />
Embedding inline images via base64 encoding using the memstream function (supports pdf and png streams):<br />
<br />
<texcode><br />
\startluacode<br />
local cow = mime.unb64("JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURlY29kZT4+CnN0cmVhbQp4nJWayY40SW6E7/UUcRaQIafvfp6bAAkY9SM0oHXmMBAgvb7sM0ZmVf86CYNB/+HpC500Ghevv13ljqvwv+e/v//16+//eV3/+l9f8y4nRlz/8xVx99XW9Y9fcf2D/v8f+v+/a9q5/vSb/vnbn/7p629a+oq79L639jpjRKzcmC1fsUe927xaO3fRLwydsu/Q0C7afmj5Pv3WMb32+6zGgP61rz77Xdu4fv/KkWjXiHH3xpp12r3ONeq+W3QG1r7G6Pc8yyvmOHev19LBbXtFb/fo1zkan6GBqS3qFTWaBnLNLLfmRuvnPocpq96jXdFHu8/0ms4mMYaEP160usSMK9bUTZnS9l32VUurjGuC9LjWVWvM+1ky1t3qVZumxGZKPVftTb/zNbclraPW+/TnNkP31NAKycwh6+58Hx3C7cYJtqqzzHvkKT3qXXTKlGBoqOqnsr6/S5RbuqzzTKTRkmOl9s/Q68x1j6U9FvpfGqiyY2kMLG6nRbtqbkiWNePeUtIOWUE214AMer2WFLKbLrjWfNasVm5J+hl6zaLtuoTZq3PBga4O32PfVsHQLq3phrsvIVRThu2m7wnCXqPrWqhtozYviXPPxSblcOOu2+SmghFLescOEn3LEMvHdB0jIDKHW7Co3Xsh/T73lmgd3Pp6Sygx2LqwtiZa2fMWDr93WTJl0f16FYAWSpIBnzWyXGGKzIEs0l6UwYwC1L+lNVpmrnlv23/dtg8brOFKGH1JK8W+AwxCuKpy5RRuAFg2lpJ9RYEooqZRE3BjCk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4NzExNUM0Q0MwQ0I4NEJFN0U0NTBGPl0KPj4Kc3RhcnR4cmVmCjUxMzMKJSVFT0YK")<br />
figures.setmemstream("inline",cow)<br />
context.externalfigure({"memstream:///inline"})<br />
\stopluacode<br />
</texcode><br />
<br />
== Custom Processing ==<br />
<br />
The following example changes the width of images based on file name extensions:<br />
<br />
<texcode><br />
\setupexternalfigures[<br />
location={local,global,default},<br />
width=\textwidth<br />
]<br />
\defineexternalfigure[svg][width=1cm]<br />
\defineexternalfigure[jpg][width=2cm]<br />
\defineexternalfigure[png][width=4cm]<br />
<br />
% Won't be applied because there's no process action.<br />
% Default (\textwidth) is used, as defined above.<br />
\defineexternalfigure[pdf][width=6cm]<br />
<br />
\starttexdefinition includegraphics #1<br />
\splitfilename{#1}<br />
<br />
\processaction[\splitofftype][<br />
jpg=>{\externalfigure[#1][jpg]},<br />
png=>{\externalfigure[#1][png]},<br />
svg=>{\externalfigure[#1][svg][conversion=mp]},<br />
default=>{\externalfigure[#1]},<br />
unknown=>{\externalfigure[#1]}<br />
]<br />
\stoptexdefinition<br />
<br />
\starttext<br />
\includegraphics{kitten.jpg}<br />
\includegraphics{mill.png}<br />
\includegraphics{cow.pdf}<br />
\includegraphics{tiger.svg}<br />
\stoptext<br />
</texcode><br />
<br />
= Transformations =<br />
<br />
== Image Scaling ==<br />
<br />
{{ note | If either <tt>width</tt> or <tt>height</tt> is specified, then the <tt>scale</tt> key has no effect. }}<br />
<br />
<br />
To scale an image use the <tt>scale</tt> key: <tt>scale=1000</tt> corresponds to the original dimensions of the image, <tt>scale=500</tt> scales the image to 50% of the original size, <tt>scale=1500</tt> scales the images to 150% of the original size, and so on. For example:<br />
<br />
<texcode>\externalfigure[logo.pdf][scale=500]</texcode><br />
<br />
scales the image to 50% of its size.<br />
<br />
Use <tt>\setupexternalfigures</tt> to set the scale of all images. For example, to scale all images to be twice their original size, use:<br />
<br />
<texcode>\setupexternalfigures[scale=2000]</texcode><br />
<br />
In addition, the <tt>xscale</tt> and <tt>yscale</tt> keys scale the image in only one dimension. For example:<br />
<br />
<texcode>\externalfigure[logo.pdf][xscale=500]<br />
\externalfigure[logo.pdf][yscale=500]</texcode><br />
<br />
Scaling changes the visible size of a picture, but not the data or file size. If you want to reduce your file size by decreasing image resolution, see [[Downsampling]].<br />
<br />
== Image Dimension Restriction ==<br />
<br />
ConTeXt can limit included images to particular dimensions. For example, to ensure that an included image is not more than <tt>0.2\textwidth</tt>:<br />
<br />
<texcode>\externalfigure[logo.pdf][maxwidth=0.2\textwidth]</texcode><br />
<br />
If <tt>maxwidth</tt> is specified and the width of the image is less than <tt>maxwidth</tt>, then the image is not scaled; if the width of the image is greater than <tt>maxwidth</tt>, then the width is restricted to <tt>maxwidth</tt> and the height is scaled appropriately to maintain the original aspect ratio.<br />
<br />
The option <tt>maxheight</tt> is analogous to <tt>maxwidth</tt>, for checking the height of the image.<br />
<br />
For example, to ensure that figures do not overflow the text~area, one may set:<br />
<br />
<texcode>\setupexternalfigures<br />
[maxwidth=\textwidth,<br />
maxheight=0.8\textheight]</texcode><br />
<br />
== Image Rotation ==<br />
<br />
Rotate included images by 90°, 180°, or 270° using the <tt>orientation</tt> key. For example:<br />
<br />
<texcode>\externalfigure[logo.pdf][orientation=90]</texcode><br />
<br />
To rotate by an arbitrary angle, use the {{cmd|rotate}} command. For example:<br />
<br />
<texcode>\rotate[rotation=45]{\externalfigure[logo.pdf]}</texcode><br />
<br />
== Image Mirroring ==<br />
<br />
To mirror (flip) an image, use the generic {{cmd|mirror}} command. For example, to mirror horizontally:<br />
<br />
<texcode>\mirror{\externalfigure[logo.pdf]}</texcode><br />
<br />
To mirror vertically, first rotate the image by 180° and then mirror it:<br />
<br />
<texcode>\mirror{\externalfigure[logo.pdf][orientation=180]}</texcode><br />
<br />
== Image Clipping ==<br />
<br />
Clip an image using the generic {{cmd|clip}} command. For example, to clip the original image to a <tt>1cm x 2cm</tt> rectangle at an offset of <tt>(3mm,5mm)</tt> from the top left corner:<br />
<br />
<texcode>\clip[width=1cm, height=2cm, hoffset=3mm, voffset=5mm]<br />
{\externalfigure[logo.pdf]}</texcode><br />
<br />
As another example, this cuts the image into a <tt>3x3</tt> pieces and then outputs the <tt>(2,2)</tt> piece:<br />
<br />
<texcode>\clip[nx=3,ny=3,x=2,y=2]<br />
{\externalfigure[logo.pdf]}</texcode><br />
<br />
<br />
In PDF files, it is possible to specify different size information in PDF headers MediaBox, TrimBox, CropBox, and ArtBox. To clip to one of these sizes, use<br />
<br />
<texcode>\externalfigure[logo.pdf][size=art]</texcode><br />
<br />
Other options are: `none` (detault), `media` for MediaBox, `crop` for CropBox, `trim` for TrimBox, and `art` for ArtBox.<br />
<br />
= Troubleshooting =<br />
<br />
This section describes various tips for discovering problems with embedded images.<br />
<br />
== Visualize Bounding Box ==<br />
<br />
If, for instance, the image is taking more space than expected, it can be useful to visualize the bounding box of the image. To do this:<br />
<br />
<texcode>\externalfigure[logo.pdf][frame=on]</texcode><br />
<br />
ConTeXt includes a Perl script <tt>pdftrimwhite</tt> that removes extra white space at the borders of a PDF file. To run this script:<br />
<br />
<pre>mtxrun --script pdftrimwhite [flags] input output</pre><br />
<br />
The most important flag is <tt>--offset=dimen</tt>, which keeps some extra space around the trimmed image.<br />
<br />
Similar functionality is provided by another Perl script, <tt>pdfcrop</tt>, that is included in most TeX distributions.<br />
<br />
== Diagnostic Tracking ==<br />
<br />
To get diagnostic information about image inclusion, enable the tracker <tt>graphics.locating</tt> by editing the ConTeXt file and adding:<br />
<br />
<texcode>\enabletrackers[graphics.locating]</texcode><br />
<br />
Alternatively, compile the ConTeXt file using:<br />
<br />
<texcode>context --trackers=graphics.locating filename</texcode><br />
<br />
The tracker writes diagnostics to the console. Suppose we use <tt>\externalfigure[somefile.pdf]</tt> and ConTeXt finds the file in the current search path; then the following information is printed on the console:<br />
<br />
<pre>graphics &gt; inclusion &gt; locations: local,global<br />
graphics &gt; inclusion &gt; path list: . .. ../..<br />
graphics &gt; inclusion &gt; strategy: forced format pdf<br />
graphics &gt; inclusion &gt; found: somefile.pdf -&gt; somefile.pdf<br />
graphics &gt; inclusion &gt; format natively supported by backend: pdf</pre><br />
If the file <tt>somefile.pdf</tt> is not found in the current search path, then the following information is printed on the console (even if the <tt>graphics.locating</tt> tracker is not set):<br />
<br />
<pre>graphics &gt; inclusion &gt; strategy: forced format pdf<br />
graphics &gt; inclusion &gt; not found: somefile.pdf<br />
graphics &gt; inclusion &gt; not found: ./somefile.pdf<br />
graphics &gt; inclusion &gt; not found: ../somefile.pdf<br />
graphics &gt; inclusion &gt; not found: ../../somefile.pdf<br />
graphics &gt; inclusion &gt; not found: images/somefile.pdf<br />
graphics &gt; inclusion &gt; not found: /home/user/images/somefile.pdf<br />
graphics &gt; inclusion &gt; format not supported: </pre><br />
and a placeholder gray box is put in the output:<br />
<br />
<context> </context><br />
<br />
Sometimes, one would rather use a placeholder image for an image that is yet to be made. In such cases, load the MP library <tt>dum</tt> via:<br />
<br />
<texcode>\useMPlibrary[dum]</texcode><br />
<br />
Then, whenever an image file is not found in the current search path, a random MetaPost image is shown in the output.<br />
<br />
<context> </context><br />
<br />
== Leading Paragraph ==<br />
<br />
Using {{cmd|externalfigure}}<tt>[...]</tt> at the beginning of a paragraph results in a line break after the image. This is because {{cmd|externalfigure}} is a {{cmd|vbox}} and when a {{cmd|vbox}} is encountered at (what appears to be) the beginning of a paragraph, it remains in vertical mode. To prevent this, add {{cmd|dontleavehmode}} before {{cmd|externalfigure}}, like this:<br />
<br />
<texcode>\dontleavehmode<br />
\externalfigure[...] ... first line ...</texcode><br />
<br />
= Multiple Image Settings =<br />
<br />
== Image Settings ==<br />
<br />
Suppose your document contains many side-by-side images, and you want all of these images to be of the same size. In addition, you want to control the size of all images by changing only one setup. To do this, you can use the {{cmd|defineexternalfigure}} macro, which defines a named collection of image settings. For example, to define a collection where the image width is <tt>3cm</tt>, use:<br />
<br />
<texcode>\defineexternalfigure[logo-settings]<br />
[width=3cm]</texcode><br />
<br />
And then to use these settings in an image, use:<br />
<br />
<texcode>\externalfigure[group.pdf][logo-settings]</texcode><br />
<br />
or, if you want to add or override settings, use:<br />
<br />
<texcode>\externalfigure[group.pdf][logo-settings]<br />
[height=2cm]</texcode><br />
<br />
== Image Labels ==<br />
<br />
Suppose your document contains an image at multiple locations; all of these images are to be of the same size, which is not necessarily the same as the natural size of the image. Furthermore, as before, you want to set the size of all the images by changing only one setup. Here, the macro to use is {{cmd|useexternalfigure}}, which defines a symbolic label for inserting an image plus settings. For example:<br />
<br />
<texcode>\useexternalfigure[mylogo]<br />
[logo.pdf][width=2cm]</texcode><br />
<br />
defines an image label <tt>mylogo</tt> that maps to the image file <tt>logo.pdf</tt> and sets its width to <tt>2cm</tt>. This image label may be used as a normal image filename:<br />
<br />
<texcode>\externalfigure[mylogo]</texcode><br />
<br />
<br />
= Movies =<br />
<br />
Movies aren't recognized automatically yet; they must be delcared verbosely:<br />
<br />
<texcode><br />
\externalfigure[demo.mov][label=demo,width=4cm,height=4cm,preview=yes]<br />
</texcode><br />
<br />
<tt>preview=yes</tt> shows the first image as preview.<br />
You find more about interactive Elements in [http://www.pragma-ade.nl/general/manuals/mwidget-s.pdf mwidget-s.pdf]<br />
<br />
Unfortunately, people who are fond of Linux cannot embed movies because the linux release of acroread doesn't support that. An alternative solution consists in launching your prefered player (MPlayer) from acroread:<br />
<br />
<texcode><br />
\defineprogram[dummy.mpeg][dummy.mpeg.sh]<br />
<br />
\starttext<br />
\goto{\externalfigure[dummy-preview][width=0.48\textwidth]}[program(dummy.mpeg{})]<br />
\stoptext<br />
</texcode><br />
<br />
The script dummy.mpeg.sh should contain:<br />
<pre><nowiki><br />
FILE=$(basename "$0"); mplayer -fs -zoom ${FILE/.sh/}<br />
</nowiki></pre><br />
<br />
<br />
[[Category:Graphics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Using_Graphics&diff=33666Using Graphics2022-08-01T06:37:51Z<p>Thangalin: /* Usage */</p>
<hr />
<div>= Usage =<br />
<br />
The simplest way to insert an image is to use:<br />
<br />
<texcode>\externalfigure[logo.pdf]</texcode><br />
<br />
This command places the PDF image <tt>logo.pdf</tt> in a {{cmd|vbox}}; the width and height of the image are equal to the natural dimensions of the image.<br />
<br />
To set the width of the image to a specific size, say <tt>1cm</tt>, use:<br />
<br />
<texcode>\externalfigure[logo.pdf][width=1cm]</texcode><br />
<br />
Similarly, to set the height of the image to a specific size, say <tt>2cm</tt>, use:<br />
<br />
<texcode>\externalfigure[logo.pdf][height=2cm]</texcode><br />
<br />
If only the <tt>width</tt> or <tt>height</tt> of the image is specified, the other dimension is scaled appropriately to keep the aspect ratio.<br />
<br />
To include a specific page, say page 5, of a multi-page PDF file, use:<br />
<br />
<texcode>\externalfigure[logo.pdf][page=5]</texcode><br />
<br />
These four variations cover the most common use cases.<br />
<br />
== File Formats ==<br />
<br />
ConTeXt supports the image formats enumerated below. The image format is determined from the file extension (case insensitive).<br />
<br />
* '''PDF''': File extension <tt>.pdf</tt><br />
* '''MPS''' (MetaPost output): File extension <tt>.mps</tt> or <tt>.&lt;digits&gt;</tt><br />
* '''JPEG''': File extension <tt>.jpg</tt> or <tt>.jpeg</tt><br />
* '''PNG''': File extension <tt>.png</tt><br />
* '''JPEG 2000''': File extension <tt>.jp2</tt><br />
* '''JBIG''' or '''JBIG2''': File extension <tt>.jbig</tt>, <tt>.jbig2</tt>, or <tt>.jb2</tt><br />
<br />
An old page (2010), gives details on supported [[File Formats|file formats]]<br />
<br />
== Image Conversion ==<br />
<br />
The image file formats listed in the previous section are the ones that may be embedded directly in a PDF. ConTeXt also supports a few other formats that are first converted to PDF using an external program. Of course, for such a conversion to work, the corresponding converter must be in the <tt>PATH</tt>.<br />
<br />
<table><br />
<tr class="odd"><br />
<td align="left">Format</td><br />
<td align="left">Extension</td><br />
<td align="left">Converter</td><br />
</tr><br />
<tr class="even"><br />
<td align="left"><strong>SVG</strong></td><br />
<td align="left"><code>.svg</code>, <code>.svgz</code></td><br />
<td align="left"><code>inkscape</code></td><br />
</tr><br />
<tr class="odd"><br />
<td align="left"><strong>EPS</strong></td><br />
<td align="left"><code>.eps</code>, <code>.ai</code></td><br />
<td align="left"><code>gs</code> (or <code>gswin32c</code> on Windows) from Ghostscript</td><br />
</tr><br />
<tr class="even"><br />
<td align="left"><strong>GIF</strong></td><br />
<td align="left"><code>.gif</code></td><br />
<td align="left"><code>gm</code> from GraphicsMagick</td><br />
</tr><br />
<tr class="odd"><br />
<td align="left"><strong>TIFF</strong></td><br />
<td align="left"><code>.tiff</code></td><br />
<td align="left"><code>gm</code> from GraphicsMagick</td><br />
</tr><br />
</table><br />
<br />
The conversion generates a PDF file with prefix <tt>m_k_i_v_</tt> and a suffix <tt>.pdf</tt> added to the name of the original file. The result is cached, and the conversion is rerun if the timestamp of the original file is newer than that of the converted file.<br />
<br />
In LMTX file name contains md5sum of hash of the relevant source image parameters (resolution, dimensions, ...), e.g.:<br />
<br />
<pre><br />
hacker_jpg_c60ccda70ef92e32d7a6334f31c23259.gray.pdf <br />
</pre><br />
<br />
It is possible to change the converter used with the following code:<br />
<br />
<pre><br />
\startluacode<br />
local function converter(oldname, newname, resolution)<br />
if not resolution or resolution == "" then<br />
resolution = 50<br />
end<br />
os.execute(string.format(<br />
'convert -density %ix%i "%s" "%s"',<br />
resolution, resolution, oldname, newname)<br />
)<br />
end<br />
<br />
-- Set the PDF and default TIFF converters to the above function.<br />
figures.converters.tif.pdf = converter<br />
figures.converters.tif.default = converter<br />
\stopluacode<br />
<br />
\starttext<br />
% Substitute any TIFF here.<br />
\externalfigure[cow.tiff]<br />
\stoptext<br />
</pre><br />
<br />
See also: https://source.contextgarden.net/tex/context/base/mkiv/grph-inc.lua<br />
<br />
== Interaction ==<br />
<br />
By default, the interactive elements of the included PDF file are discarded. To enable the interactive elements of the included PDF file, use<br />
<texcode>\externalfigure[filename.pdf][interaction=yes]</texcode><br />
<br />
For further reading, don't forget [[Including pages from PDF documents]].<br />
<br />
== Image Directory ==<br />
<br />
By default, ConTeXt searches an image in the current directory, the parent directory, and the grand-parent directory.<br />
<br />
To search for images in other directories, for example a <tt>./images</tt> subdirectory and <tt>/home/user/images</tt>, use:<br />
<br />
<texcode>\setupexternalfigures[directory={images, /home/user/images}]</texcode><br />
<br />
Note: always use forward slashes (`/`) in path names, regardless of operating system.<br />
<br />
The default search order is: the current directory, the parent directory, the grand-parent directory, and then the paths specified by the <tt>directory</tt> key. To restrict image search only to the paths specified by the <tt>directory</tt> key, use:<br />
<br />
<texcode>\setupexternalfigures[location=global]</texcode><br />
<br />
To restore the default search behavior, use:<br />
<br />
<texcode>\setupexternalfigures[location={local,global}]</texcode><br />
<br />
The ConTeXt distribution includes three sample images: <tt>cow.pdf</tt>, <tt>mill.png</tt>, and <tt>hacker.jpg</tt>, that are useful when creating minimum working examples to illustrate a bug on the mailing list. These images are locating in the <tt>TEXMF</tt> directory. To add the <tt>TEXMF</tt> directory to the image search path, use:<br />
<br />
<texcode>\setupexternalfigures[location={local,global,default}]</texcode><br />
<br />
The above alternative adds the ''entire'' <tt>TEXMF</tt> directory to the search path, ''including the'' <tt>doc/</tt> ''directory!'' Therefore, one needs to be extremely careful when using this option. In fact, I would advise not using <tt>location=default</tt> except for illustrative minimal working examples.<br />
<br />
== Remote Images ==<br />
<br />
The {{cmd|externalfigure}} command supports reading files from web servers, for example:<br />
<br />
<texcode>\externalfigure[http://tug.org/images/logobw.jpg]</texcode><br />
When a document containing a remote file is compiled for the first time, the remote file is downloaded from the server and stored in the LuaTeX cache directory. This cached file is used during subsequent runs.<br />
<br />
Normally, the remote image is downloaded again if the image in the cache is older than 1~day. To change this threshold to, for example, 2<sub>minutes (120</sub>seconds), either add<br />
<br />
<texcode>\enabledirectives[schemes.threshold=120]</texcode><br />
<br />
in the ConTeXt file, or compile the ConTeXt file using the command<br />
<br />
<pre>context --directives=schemes.threshold=120 <em>filename</em></pre><br />
The variable <tt>schemes.threshold</tt> is global, so changing its value affects all other macros like <tt>\input</tt>, <tt>\usemodule</tt>, <tt>\component</tt>, etc. that load remote files.<br />
<br />
=== HTTP Proxy ===<br />
<br />
To use an http proxy for fetching images, the http variable ([http://w3.impa.br/~diego/software/luasocket/http.html LuaSocket]) has to be set up as follows:<br />
<br />
<texcode><br />
\ctxlua{http = require("socket.http"); http.PROXY = "http://proxy.example.com:3128"}<br />
</texcode><br />
<br />
Replace `http://proxy.example.com:3128` with the proxy URL.<br />
<br />
To disable the proxy again:<br />
<br />
<texcode><br />
\ctxlua{http = require("socket.http"); http.PROXY = nil}<br />
</texcode><br />
<br />
=== HTTPS ===<br />
<br />
For self-signed certificates retrieved over HTTPS, the `curl` command requires a flag to retrieve insecure files, which is not enabled by default. Open `tex/texmf-context/tex/context/base/mkiv/data-sch.lua` to find:<br />
<br />
<pre><br />
local function runcurl(name,cachename) -- we use sockets instead or the curl library when possible<br />
local command = "curl --silent --create-dirs --output " .. cachename .. " " .. name<br />
os.spawn(command)<br />
end<br />
</pre><br />
<br />
Insert the `-k` or `--insecure` option:<br />
<br />
<pre><br />
local command = "curl --insecure --silent --create-dirs --output " .. cachename .. " " .. name<br />
</pre><br />
<br />
== Inline Images ==<br />
<br />
Embedding inline images via base64 encoding using the memstream function (supports pdf and png streams):<br />
<br />
<texcode><br />
\startluacode<br />
local cow = mime.unb64("JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURlY29kZT4+CnN0cmVhbQp4nJWayY40SW6E7/UUcRaQIafvfp6bAAkY9SM0oHXmMBAgvb7sM0ZmVf86CYNB/+HpC500Ghevv13ljqvwv+e/v//16+//eV3/+l9f8y4nRlz/8xVx99XW9Y9fcf2D/v8f+v+/a9q5/vSb/vnbn/7p629a+oq79L639jpjRKzcmC1fsUe927xaO3fRLwydsu/Q0C7afmj5Pv3WMb32+6zGgP61rz77Xdu4fv/KkWjXiHH3xpp12r3ONeq+W3QG1r7G6Pc8yyvmOHev19LBbXtFb/fo1zkan6GBqS3qFTWaBnLNLLfmRuvnPocpq96jXdFHu8/0ms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jU1MzUgZiAKMDAwMDAwNDYzNiAwMDAwMCBuIAowMDAwMDA0OTg2IDAwMDAwIG4gCjAwMDAwMDQ1NzcgMDAwMDAgbiAKMDAwMDAwNDQyNiAwMDAwMCBuIAowMDAwMDAwMDE1IDAwMDAwIG4gCjAwMDAwMDQ0MDYgMDAwMDAgbiAKMDAwMDAwNDY4NCAwMDAwMCBuIAowMDAwMDA0ODM4IDAwMDAwIG4gCjAwMDAwMDQ3MjUgMDAwMDAgbiAKMDAwMDAwNDc3OCAwMDAwMCBuIAowMDAwMDA0ODA4IDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgMTIgL1Jvb3QgMSAwIFIgL0luZm8gMiAwIFIKL0lEIFs8ODE0NjQ5NTc3Qzg3MTE1QzRDQzBDQjg0QkU3RTQ1MEY+PDgxNDY0OTU3N0M4NzExNUM0Q0MwQ0I4NEJFN0U0NTBGPl0KPj4Kc3RhcnR4cmVmCjUxMzMKJSVFT0YK")<br />
figures.setmemstream("inline",cow)<br />
context.externalfigure({"memstream:///inline"})<br />
\stopluacode<br />
</texcode><br />
<br />
== Custom Processing ==<br />
<br />
The following example changes the width of images based on the file name extensions:<br />
<br />
<texcode><br />
\setupexternalfigures[<br />
location={local,global,default},<br />
width=\textwidth<br />
]<br />
\defineexternalfigure[svg][width=1cm]<br />
\defineexternalfigure[jpg][width=2cm]<br />
\defineexternalfigure[png][width=4cm]<br />
<br />
% Won't be applied because there's no process action.<br />
% Default (\textwidth) is used, as defined above.<br />
\defineexternalfigure[pdf][width=6cm]<br />
<br />
\starttexdefinition includegraphics #1<br />
\splitfilename{#1}<br />
<br />
\processaction[\splitofftype][<br />
jpg=>{\externalfigure[#1][jpg]},<br />
png=>{\externalfigure[#1][png]},<br />
svg=>{\externalfigure[#1][svg][conversion=mp]},<br />
default=>{\externalfigure[#1]},<br />
unknown=>{\externalfigure[#1]}<br />
]<br />
\stoptexdefinition<br />
<br />
\starttext<br />
\includegraphics{kitten.jpg}<br />
\includegraphics{mill.png}<br />
\includegraphics{cow.pdf}<br />
\includegraphics{tiger.svg}<br />
\stoptext<br />
</texcode><br />
<br />
= Transformations =<br />
<br />
== Image Scaling ==<br />
<br />
{{ note | If either <tt>width</tt> or <tt>height</tt> is specified, then the <tt>scale</tt> key has no effect. }}<br />
<br />
<br />
To scale an image use the <tt>scale</tt> key: <tt>scale=1000</tt> corresponds to the original dimensions of the image, <tt>scale=500</tt> scales the image to 50% of the original size, <tt>scale=1500</tt> scales the images to 150% of the original size, and so on. For example:<br />
<br />
<texcode>\externalfigure[logo.pdf][scale=500]</texcode><br />
<br />
scales the image to 50% of its size.<br />
<br />
Use <tt>\setupexternalfigures</tt> to set the scale of all images. For example, to scale all images to be twice their original size, use:<br />
<br />
<texcode>\setupexternalfigures[scale=2000]</texcode><br />
<br />
In addition, the <tt>xscale</tt> and <tt>yscale</tt> keys scale the image in only one dimension. For example:<br />
<br />
<texcode>\externalfigure[logo.pdf][xscale=500]<br />
\externalfigure[logo.pdf][yscale=500]</texcode><br />
<br />
Scaling changes the visible size of a picture, but not the data or file size. If you want to reduce your file size by decreasing image resolution, see [[Downsampling]].<br />
<br />
== Image Dimension Restriction ==<br />
<br />
ConTeXt can limit included images to particular dimensions. For example, to ensure that an included image is not more than <tt>0.2\textwidth</tt>:<br />
<br />
<texcode>\externalfigure[logo.pdf][maxwidth=0.2\textwidth]</texcode><br />
<br />
If <tt>maxwidth</tt> is specified and the width of the image is less than <tt>maxwidth</tt>, then the image is not scaled; if the width of the image is greater than <tt>maxwidth</tt>, then the width is restricted to <tt>maxwidth</tt> and the height is scaled appropriately to maintain the original aspect ratio.<br />
<br />
The option <tt>maxheight</tt> is analogous to <tt>maxwidth</tt>, for checking the height of the image.<br />
<br />
For example, to ensure that figures do not overflow the text~area, one may set:<br />
<br />
<texcode>\setupexternalfigures<br />
[maxwidth=\textwidth,<br />
maxheight=0.8\textheight]</texcode><br />
<br />
== Image Rotation ==<br />
<br />
Rotate included images by 90°, 180°, or 270° using the <tt>orientation</tt> key. For example:<br />
<br />
<texcode>\externalfigure[logo.pdf][orientation=90]</texcode><br />
<br />
To rotate by an arbitrary angle, use the {{cmd|rotate}} command. For example:<br />
<br />
<texcode>\rotate[rotation=45]{\externalfigure[logo.pdf]}</texcode><br />
<br />
== Image Mirroring ==<br />
<br />
To mirror (flip) an image, use the generic {{cmd|mirror}} command. For example, to mirror horizontally:<br />
<br />
<texcode>\mirror{\externalfigure[logo.pdf]}</texcode><br />
<br />
To mirror vertically, first rotate the image by 180° and then mirror it:<br />
<br />
<texcode>\mirror{\externalfigure[logo.pdf][orientation=180]}</texcode><br />
<br />
== Image Clipping ==<br />
<br />
Clip an image using the generic {{cmd|clip}} command. For example, to clip the original image to a <tt>1cm x 2cm</tt> rectangle at an offset of <tt>(3mm,5mm)</tt> from the top left corner:<br />
<br />
<texcode>\clip[width=1cm, height=2cm, hoffset=3mm, voffset=5mm]<br />
{\externalfigure[logo.pdf]}</texcode><br />
<br />
As another example, this cuts the image into a <tt>3x3</tt> pieces and then outputs the <tt>(2,2)</tt> piece:<br />
<br />
<texcode>\clip[nx=3,ny=3,x=2,y=2]<br />
{\externalfigure[logo.pdf]}</texcode><br />
<br />
<br />
In PDF files, it is possible to specify different size information in PDF headers MediaBox, TrimBox, CropBox, and ArtBox. To clip to one of these sizes, use<br />
<br />
<texcode>\externalfigure[logo.pdf][size=art]</texcode><br />
<br />
Other options are: `none` (detault), `media` for MediaBox, `crop` for CropBox, `trim` for TrimBox, and `art` for ArtBox.<br />
<br />
= Troubleshooting =<br />
<br />
This section describes various tips for discovering problems with embedded images.<br />
<br />
== Visualize Bounding Box ==<br />
<br />
If, for instance, the image is taking more space than expected, it can be useful to visualize the bounding box of the image. To do this:<br />
<br />
<texcode>\externalfigure[logo.pdf][frame=on]</texcode><br />
<br />
ConTeXt includes a Perl script <tt>pdftrimwhite</tt> that removes extra white space at the borders of a PDF file. To run this script:<br />
<br />
<pre>mtxrun --script pdftrimwhite [flags] input output</pre><br />
<br />
The most important flag is <tt>--offset=dimen</tt>, which keeps some extra space around the trimmed image.<br />
<br />
Similar functionality is provided by another Perl script, <tt>pdfcrop</tt>, that is included in most TeX distributions.<br />
<br />
== Diagnostic Tracking ==<br />
<br />
To get diagnostic information about image inclusion, enable the tracker <tt>graphics.locating</tt> by editing the ConTeXt file and adding:<br />
<br />
<texcode>\enabletrackers[graphics.locating]</texcode><br />
<br />
Alternatively, compile the ConTeXt file using:<br />
<br />
<texcode>context --trackers=graphics.locating filename</texcode><br />
<br />
The tracker writes diagnostics to the console. Suppose we use <tt>\externalfigure[somefile.pdf]</tt> and ConTeXt finds the file in the current search path; then the following information is printed on the console:<br />
<br />
<pre>graphics &gt; inclusion &gt; locations: local,global<br />
graphics &gt; inclusion &gt; path list: . .. ../..<br />
graphics &gt; inclusion &gt; strategy: forced format pdf<br />
graphics &gt; inclusion &gt; found: somefile.pdf -&gt; somefile.pdf<br />
graphics &gt; inclusion &gt; format natively supported by backend: pdf</pre><br />
If the file <tt>somefile.pdf</tt> is not found in the current search path, then the following information is printed on the console (even if the <tt>graphics.locating</tt> tracker is not set):<br />
<br />
<pre>graphics &gt; inclusion &gt; strategy: forced format pdf<br />
graphics &gt; inclusion &gt; not found: somefile.pdf<br />
graphics &gt; inclusion &gt; not found: ./somefile.pdf<br />
graphics &gt; inclusion &gt; not found: ../somefile.pdf<br />
graphics &gt; inclusion &gt; not found: ../../somefile.pdf<br />
graphics &gt; inclusion &gt; not found: images/somefile.pdf<br />
graphics &gt; inclusion &gt; not found: /home/user/images/somefile.pdf<br />
graphics &gt; inclusion &gt; format not supported: </pre><br />
and a placeholder gray box is put in the output:<br />
<br />
<context> </context><br />
<br />
Sometimes, one would rather use a placeholder image for an image that is yet to be made. In such cases, load the MP library <tt>dum</tt> via:<br />
<br />
<texcode>\useMPlibrary[dum]</texcode><br />
<br />
Then, whenever an image file is not found in the current search path, a random MetaPost image is shown in the output.<br />
<br />
<context> </context><br />
<br />
== Leading Paragraph ==<br />
<br />
Using {{cmd|externalfigure}}<tt>[...]</tt> at the beginning of a paragraph results in a line break after the image. This is because {{cmd|externalfigure}} is a {{cmd|vbox}} and when a {{cmd|vbox}} is encountered at (what appears to be) the beginning of a paragraph, it remains in vertical mode. To prevent this, add {{cmd|dontleavehmode}} before {{cmd|externalfigure}}, like this:<br />
<br />
<texcode>\dontleavehmode<br />
\externalfigure[...] ... first line ...</texcode><br />
<br />
= Multiple Image Settings =<br />
<br />
== Image Settings ==<br />
<br />
Suppose your document contains many side-by-side images, and you want all of these images to be of the same size. In addition, you want to control the size of all images by changing only one setup. To do this, you can use the {{cmd|defineexternalfigure}} macro, which defines a named collection of image settings. For example, to define a collection where the image width is <tt>3cm</tt>, use:<br />
<br />
<texcode>\defineexternalfigure[logo-settings]<br />
[width=3cm]</texcode><br />
<br />
And then to use these settings in an image, use:<br />
<br />
<texcode>\externalfigure[group.pdf][logo-settings]</texcode><br />
<br />
or, if you want to add or override settings, use:<br />
<br />
<texcode>\externalfigure[group.pdf][logo-settings]<br />
[height=2cm]</texcode><br />
<br />
== Image Labels ==<br />
<br />
Suppose your document contains an image at multiple locations; all of these images are to be of the same size, which is not necessarily the same as the natural size of the image. Furthermore, as before, you want to set the size of all the images by changing only one setup. Here, the macro to use is {{cmd|useexternalfigure}}, which defines a symbolic label for inserting an image plus settings. For example:<br />
<br />
<texcode>\useexternalfigure[mylogo]<br />
[logo.pdf][width=2cm]</texcode><br />
<br />
defines an image label <tt>mylogo</tt> that maps to the image file <tt>logo.pdf</tt> and sets its width to <tt>2cm</tt>. This image label may be used as a normal image filename:<br />
<br />
<texcode>\externalfigure[mylogo]</texcode><br />
<br />
<br />
= Movies =<br />
<br />
Movies aren't recognized automatically yet; they must be delcared verbosely:<br />
<br />
<texcode><br />
\externalfigure[demo.mov][label=demo,width=4cm,height=4cm,preview=yes]<br />
</texcode><br />
<br />
<tt>preview=yes</tt> shows the first image as preview.<br />
You find more about interactive Elements in [http://www.pragma-ade.nl/general/manuals/mwidget-s.pdf mwidget-s.pdf]<br />
<br />
Unfortunately, people who are fond of Linux cannot embed movies because the linux release of acroread doesn't support that. An alternative solution consists in launching your prefered player (MPlayer) from acroread:<br />
<br />
<texcode><br />
\defineprogram[dummy.mpeg][dummy.mpeg.sh]<br />
<br />
\starttext<br />
\goto{\externalfigure[dummy-preview][width=0.48\textwidth]}[program(dummy.mpeg{})]<br />
\stoptext<br />
</texcode><br />
<br />
The script dummy.mpeg.sh should contain:<br />
<pre><nowiki><br />
FILE=$(basename "$0"); mplayer -fs -zoom ${FILE/.sh/}<br />
</nowiki></pre><br />
<br />
<br />
[[Category:Graphics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=SVG&diff=33568SVG2022-06-30T16:56:53Z<p>Thangalin: /* Text Rendering */</p>
<hr />
<div>< [[Graphics]] | [[Using_Graphics]] | [[MetaPost]] | [[File_Formats]] | [[Inkscape]] ><br />
<br />
SVG (Scalable Vector Graphics, a [[XML]] based format) can be converted to the PDF format at runtime by ConTeXt MkIV (LuaTeX), provided you have Inkscape installed as below.<br />
<br />
Supported vector graphics formats of MkII/MKIV are [[MetaPost]] (and [[MetaFun - MetaPost in ConTeXt|MetaFun]]).<br />
<br />
There is a workaround, though, using Inkscape to convert SVG to PDF. Inkscape must be installed and callable (i.e. in your PATH):<br />
<br />
<texcode><br />
\setupexternalfigures[location=local,directory=.,conversion=pdf] % lowres,prefix=lowres/]<br />
<br />
\starttext<br />
<br />
\externalfigure[svg/sample.svg][frame=on]<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== ConTeXt and Inkscape ==<br />
<br />
Inkscape changed its command line interface in version 1.0.<br />
As a consequence, if you use an old version of ConTeXt and you have Inkscape 1.0 or newer installed, the conversion from SVG to PDF fails.<br />
<br />
Newer versions of ConTeXt (since May 7th, 2020) will detect Inkscape's version and manage to convert SVG to PDF anyway.<br />
But it's a temporary workaround, until version 1.0 of Inkscape gets widespread, because version detection has a performance cost.<br />
<br />
== LMTX and SVG ==<br />
<br />
LMTX uses MetaPost (MetaFun) to process SVG directly; a third-party tool, such as Inkscape, is no longer needed. Using MetaPost to process SVG opens many opportunities. It's a work in progress and not every SVG feature is supported. If you encounter issues, send a question to the mailing list.<br />
<br />
See the LMTX distribution documentation, svg-lmtx.pdf and luametafun.pdf, for more details.<br />
<br />
=== Text Rendering ===<br />
<br />
Pixel-perfect rendering of SVG text elements may not align as desired in all cases. To work around any layout issues, convert the text to a path. This can be accomplished in Inkscape as follows:<br />
<br />
# Open the SVG file.<br />
# Select all text elements.<br />
# Click '''Path > Object to Path'''.<br />
# Save the SVG file.<br />
<br />
Rebuild the document again, the text elements will now be placed correctly.<br />
<br />
==General information on SVG:==<br />
===Specs and References===<br />
* [http://www.w3.org/Graphics/SVG/ SVG Standard Specs] (by W3C)<br />
* [http://www.zvon.org/xxl/svgReference/Output/index.html SVG 1.1 reference] (by Systinet)<br />
<br />
===Tutorials and Examples===<br />
* [http://www.adobe.com/svg/basics/getstarted.html Basic SVG: Getting started] (by Adobe)<br />
* [http://svglbc.datenverdrahten.de/ SVG - learning by coding] (by Thomas Meinike)<br />
* [http://www.scale-a-vector.de/home-e.htm Scale a Vector] (by Petra Kukofka; also in German)<br />
* [http://learnsvg.com/ Learn SVG]<br />
* [http://support.adobe.com/devsup/devsup.nsf/svgkb.htm?OpenView&Start=1&Count=500&Expand=12#12 SVG Developer Knowledgebase] (by Adobe)<br />
<br />
===Community===<br />
* [http://wiki.svg.org/Main_Page SVG Wiki]<br />
* [http://svg.org/ SVG.org community]<br />
<br />
===Libraries and Tools===<br />
* [http://inkscape.org/ Inkscape vector graphics editor]<br />
* [http://xmlgraphics.apache.org/batik/ Batik Java SVG Toolkit] (by Apache)<br />
* [http://cairographics.org Cairo graphics library]<br />
* [http://jan.kollhof.net/wiki/projects/svg samples and tools] (by Jan Kollhof)<br />
<br />
[[Category:Graphics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=SVG&diff=33567SVG2022-06-30T16:56:06Z<p>Thangalin: /* Text Rendering */</p>
<hr />
<div>< [[Graphics]] | [[Using_Graphics]] | [[MetaPost]] | [[File_Formats]] | [[Inkscape]] ><br />
<br />
SVG (Scalable Vector Graphics, a [[XML]] based format) can be converted to the PDF format at runtime by ConTeXt MkIV (LuaTeX), provided you have Inkscape installed as below.<br />
<br />
Supported vector graphics formats of MkII/MKIV are [[MetaPost]] (and [[MetaFun - MetaPost in ConTeXt|MetaFun]]).<br />
<br />
There is a workaround, though, using Inkscape to convert SVG to PDF. Inkscape must be installed and callable (i.e. in your PATH):<br />
<br />
<texcode><br />
\setupexternalfigures[location=local,directory=.,conversion=pdf] % lowres,prefix=lowres/]<br />
<br />
\starttext<br />
<br />
\externalfigure[svg/sample.svg][frame=on]<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== ConTeXt and Inkscape ==<br />
<br />
Inkscape changed its command line interface in version 1.0.<br />
As a consequence, if you use an old version of ConTeXt and you have Inkscape 1.0 or newer installed, the conversion from SVG to PDF fails.<br />
<br />
Newer versions of ConTeXt (since May 7th, 2020) will detect Inkscape's version and manage to convert SVG to PDF anyway.<br />
But it's a temporary workaround, until version 1.0 of Inkscape gets widespread, because version detection has a performance cost.<br />
<br />
== LMTX and SVG ==<br />
<br />
LMTX uses MetaPost (MetaFun) to process SVG directly; a third-party tool, such as Inkscape, is no longer needed. Using MetaPost to process SVG opens many opportunities. It's a work in progress and not every SVG feature is supported. If you encounter issues, send a question to the mailing list.<br />
<br />
See the LMTX distribution documentation, svg-lmtx.pdf and luametafun.pdf, for more details.<br />
<br />
=== Text Rendering ===<br />
<br />
Pixel-perfect rendering of SVG text elements may not align as desired in all cases. To work around any layout issues, convert the text to a path. This can be accomplished in Inkscape as follows:<br />
<br />
# Open the SVG file.<br />
# Select all text elements.<br />
# Click '''Path > Object to Path'''.<br />
# Save the SVG file.<br />
<br />
==General information on SVG:==<br />
===Specs and References===<br />
* [http://www.w3.org/Graphics/SVG/ SVG Standard Specs] (by W3C)<br />
* [http://www.zvon.org/xxl/svgReference/Output/index.html SVG 1.1 reference] (by Systinet)<br />
<br />
===Tutorials and Examples===<br />
* [http://www.adobe.com/svg/basics/getstarted.html Basic SVG: Getting started] (by Adobe)<br />
* [http://svglbc.datenverdrahten.de/ SVG - learning by coding] (by Thomas Meinike)<br />
* [http://www.scale-a-vector.de/home-e.htm Scale a Vector] (by Petra Kukofka; also in German)<br />
* [http://learnsvg.com/ Learn SVG]<br />
* [http://support.adobe.com/devsup/devsup.nsf/svgkb.htm?OpenView&Start=1&Count=500&Expand=12#12 SVG Developer Knowledgebase] (by Adobe)<br />
<br />
===Community===<br />
* [http://wiki.svg.org/Main_Page SVG Wiki]<br />
* [http://svg.org/ SVG.org community]<br />
<br />
===Libraries and Tools===<br />
* [http://inkscape.org/ Inkscape vector graphics editor]<br />
* [http://xmlgraphics.apache.org/batik/ Batik Java SVG Toolkit] (by Apache)<br />
* [http://cairographics.org Cairo graphics library]<br />
* [http://jan.kollhof.net/wiki/projects/svg samples and tools] (by Jan Kollhof)<br />
<br />
[[Category:Graphics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=SVG&diff=33566SVG2022-06-30T16:55:44Z<p>Thangalin: </p>
<hr />
<div>< [[Graphics]] | [[Using_Graphics]] | [[MetaPost]] | [[File_Formats]] | [[Inkscape]] ><br />
<br />
SVG (Scalable Vector Graphics, a [[XML]] based format) can be converted to the PDF format at runtime by ConTeXt MkIV (LuaTeX), provided you have Inkscape installed as below.<br />
<br />
Supported vector graphics formats of MkII/MKIV are [[MetaPost]] (and [[MetaFun - MetaPost in ConTeXt|MetaFun]]).<br />
<br />
There is a workaround, though, using Inkscape to convert SVG to PDF. Inkscape must be installed and callable (i.e. in your PATH):<br />
<br />
<texcode><br />
\setupexternalfigures[location=local,directory=.,conversion=pdf] % lowres,prefix=lowres/]<br />
<br />
\starttext<br />
<br />
\externalfigure[svg/sample.svg][frame=on]<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== ConTeXt and Inkscape ==<br />
<br />
Inkscape changed its command line interface in version 1.0.<br />
As a consequence, if you use an old version of ConTeXt and you have Inkscape 1.0 or newer installed, the conversion from SVG to PDF fails.<br />
<br />
Newer versions of ConTeXt (since May 7th, 2020) will detect Inkscape's version and manage to convert SVG to PDF anyway.<br />
But it's a temporary workaround, until version 1.0 of Inkscape gets widespread, because version detection has a performance cost.<br />
<br />
== LMTX and SVG ==<br />
<br />
LMTX uses MetaPost (MetaFun) to process SVG directly; a third-party tool, such as Inkscape, is no longer needed. Using MetaPost to process SVG opens many opportunities. It's a work in progress and not every SVG feature is supported. If you encounter issues, send a question to the mailing list.<br />
<br />
See the LMTX distribution documentation, svg-lmtx.pdf and luametafun.pdf, for more details.<br />
<br />
=== Text Rendering ===<br />
<br />
Pixel-perfect rendering of SVG text elements may not function correctly in all cases. To work around any layout issues, convert the text to a path. This can be accomplished in Inkscape as follows:<br />
<br />
# Open the SVG file.<br />
# Select all text elements.<br />
# Click '''Path > Object to Path'''.<br />
# Save the SVG file.<br />
<br />
==General information on SVG:==<br />
===Specs and References===<br />
* [http://www.w3.org/Graphics/SVG/ SVG Standard Specs] (by W3C)<br />
* [http://www.zvon.org/xxl/svgReference/Output/index.html SVG 1.1 reference] (by Systinet)<br />
<br />
===Tutorials and Examples===<br />
* [http://www.adobe.com/svg/basics/getstarted.html Basic SVG: Getting started] (by Adobe)<br />
* [http://svglbc.datenverdrahten.de/ SVG - learning by coding] (by Thomas Meinike)<br />
* [http://www.scale-a-vector.de/home-e.htm Scale a Vector] (by Petra Kukofka; also in German)<br />
* [http://learnsvg.com/ Learn SVG]<br />
* [http://support.adobe.com/devsup/devsup.nsf/svgkb.htm?OpenView&Start=1&Count=500&Expand=12#12 SVG Developer Knowledgebase] (by Adobe)<br />
<br />
===Community===<br />
* [http://wiki.svg.org/Main_Page SVG Wiki]<br />
* [http://svg.org/ SVG.org community]<br />
<br />
===Libraries and Tools===<br />
* [http://inkscape.org/ Inkscape vector graphics editor]<br />
* [http://xmlgraphics.apache.org/batik/ Batik Java SVG Toolkit] (by Apache)<br />
* [http://cairographics.org Cairo graphics library]<br />
* [http://jan.kollhof.net/wiki/projects/svg samples and tools] (by Jan Kollhof)<br />
<br />
[[Category:Graphics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=SVG&diff=33565SVG2022-06-30T16:49:32Z<p>Thangalin: </p>
<hr />
<div>< [[Graphics]] | [[Using_Graphics]] | [[MetaPost]] | [[File_Formats]] | [[Inkscape]] ><br />
<br />
SVG (Scalable Vector Graphics, a [[XML]] based format) can be converted to the PDF format at runtime by ConTeXt MkIV (LuaTeX), provided you have Inkscape installed as below.<br />
<br />
Supported vector graphics formats of MkII/MKIV are [[MetaPost]] (and [[MetaFun - MetaPost in ConTeXt|MetaFun]]).<br />
<br />
There is a workaround, though, using Inkscape to convert SVG to PDF. Inkscape must be installed and callable (i.e. in your PATH):<br />
<br />
<texcode><br />
\setupexternalfigures[location=local,directory=.,conversion=pdf] % lowres,prefix=lowres/]<br />
<br />
\starttext<br />
<br />
\externalfigure[svg/sample.svg][frame=on]<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== ConTeXt and Inkscape ==<br />
<br />
Inkscape changed its command line interface in version 1.0.<br />
As a consequence, if you use an old version of ConTeXt and you have Inkscape 1.0 or newer installed, the conversion from SVG to PDF fails.<br />
<br />
Newer versions of ConTeXt (since May 7th, 2020) will detect Inkscape's version and manage to convert SVG to PDF anyway.<br />
But it's a temporary workaround, until version 1.0 of Inkscape gets widespread, because version detection has a performance cost.<br />
<br />
== LMTX and SVG ==<br />
<br />
LMTX uses MetaPost (MetaFun) to process SVG directly; a third-party tool, such as Inkscape, is no longer needed. Using MetaPost to process SVG opens many opportunities. It's a work in progress and not every SVG feature is supported. If you encounter issues, send a question to the mailing list.<br />
<br />
See the LMTX distribution documentation, svg-lmtx.pdf and luametafun.pdf, for more details.<br />
<br />
==General information on SVG:==<br />
===Specs and References===<br />
* [http://www.w3.org/Graphics/SVG/ SVG Standard Specs] (by W3C)<br />
* [http://www.zvon.org/xxl/svgReference/Output/index.html SVG 1.1 reference] (by Systinet)<br />
<br />
===Tutorials and Examples===<br />
* [http://www.adobe.com/svg/basics/getstarted.html Basic SVG: Getting started] (by Adobe)<br />
* [http://svglbc.datenverdrahten.de/ SVG - learning by coding] (by Thomas Meinike)<br />
* [http://www.scale-a-vector.de/home-e.htm Scale a Vector] (by Petra Kukofka; also in German)<br />
* [http://learnsvg.com/ Learn SVG]<br />
* [http://support.adobe.com/devsup/devsup.nsf/svgkb.htm?OpenView&Start=1&Count=500&Expand=12#12 SVG Developer Knowledgebase] (by Adobe)<br />
<br />
===Community===<br />
* [http://wiki.svg.org/Main_Page SVG Wiki]<br />
* [http://svg.org/ SVG.org community]<br />
<br />
===Libraries and Tools===<br />
* [http://inkscape.org/ Inkscape vector graphics editor]<br />
* [http://xmlgraphics.apache.org/batik/ Batik Java SVG Toolkit] (by Apache)<br />
* [http://cairographics.org Cairo graphics library]<br />
* [http://jan.kollhof.net/wiki/projects/svg samples and tools] (by Jan Kollhof)<br />
<br />
[[Category:Graphics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Ligatures&diff=33549Ligatures2022-06-05T21:47:41Z<p>Thangalin: /* Word suppression */</p>
<hr />
<div>= Introduction =<br />
<br />
Ligatures are combinations of letters that use different glyph shapes to avoid clashing of parts like i-dots and f-arcs. Many fonts contain at least fi and fl ligatures, well-furnished fonts have also ft, ffl, ffi, fft, fb, ffb, fh, ffh and maybe some traditional ones like st, sp, ct, ch and combinations with long s – German ß was originally a long-s + end-s ligature (even if it looks like s+z and is called szlig).<br />
<br />
While the use of ligatures is a feature of good typography, there are places where they don’t belong, namely at syllable seams where hyphenation can or should take place.<br />
<br />
Some typical German examples are Auf-lage, auf-laden, auf-fallen, Zupf-instrument, Schiff-fahrt. English examples would be chief-ly, shelf-ful, elf-like, wolf-trap, clothes-pin.<br />
<br />
= Traditional TeX methods to break ligatures =<br />
<br />
* Auf\/lage – breaks the ligature, but also kills hyphenation and kerning<br />
* Auf{}lage – worked in pdfTeX (MkII), but not in modern TeX engines<br />
* For LaTeX, there’s the [https://www.ctan.org/pkg/selnolig selnolig] package (English and German).<br />
<br />
= Enabling Ligatures in fonts =<br />
<br />
Ligatures in OpenType fonts are defined via "features" that you can/must enable. Usual ligature features are liga and tlig, but some fonts my have others for more/exotic ligatures.<br />
Here’s an example for a good set of default features:<br />
<br />
<texcode><br />
\definefontfeature[default]<br />
[mode=node,kern=yes,<br />
liga=yes,tlig=yes,<br />
ccmp=yes,language=dflt,<br />
protrusion=quality,<br />
expansion=quality]<br />
</texcode><br />
<br />
The other way round – if you don’t enable ligatures in your font features, you won’t get any; this might be desirable for mono width (typewriter) fonts.<br />
<br />
= Single places =<br />
<br />
If you only want to fix a few occurrences, you can use {{cmd|noligature}}. Compare:<br />
<br />
<texcode><br />
Auflage Zupfinstrument<br />
Au\noligature{fl}age Zup\noligature{fi}nstrument<br />
</texcode><br />
<br />
= Replacements =<br />
<br />
ConTeXt has a method of replacing words that you can use for ligature exception dictionaries:<br />
<br />
<texcode><br />
\mainlanguage[de]<br />
\definefontfeature[default]<br />
[mode=node,liga=yes,kern=yes,tlig=yes,<br />
ccmp=yes,language=dflt,<br />
protrusion=quality,<br />
expansion=quality]<br />
<br />
\replaceword[eg][Auflage][Au{fl}age]<br />
\replaceword[eg][Zupfinstrument][Zup{fi}nstrument]<br />
<br />
\starttext<br />
Auflage Zupfinstrument<br />
<br />
\setreplacements[eg]<br />
Auflage Zupfinstrument<br />
\stoptext<br />
</texcode><br />
<br />
Much better.<br />
The first parameter os {{cmd|replaceword}} is a set (collection) keycode, i.e. you can define different sets of replacements and activate them with {{cmd|setreplacements}}.<br />
<br />
[http://wiki.contextgarden.net/images/b/be/nolig-german-wordlist.tex Here’s] a list of German ligature exceptions, derived from [https://www.ctan.org/pkg/selnolig selnolig] LaTeX package. Just {{cmd|input}} it in your environment.<br />
<br />
In current versions (after 2017-09-28) you may also define several exceptions at once, like<br />
<br />
<texcode><br />
\replaceword [eg] [Au{fl}age Schiff{f}ahrt Zup{fi}nstrument]<br />
</texcode><br />
<br />
Find more details in the source: {{src|lang-rep.mkiv}} <br />
<br />
= Blocking =<br />
<br />
You can also define blocking of ligatures as a font feature:<br />
<br />
<texcode><br />
\blockligatures[fi,ff]<br />
\blockligatures[fl]<br />
\blockligatures[au:fl:age]<br />
\definefontfeature[default:nolig][default][blockligatures=yes]<br />
<br />
\definedfont[Serif*default:nolig] % no ligatures<br />
fi ff fl Auflage Zupfinstrument<br />
<br />
\definedfont[Serif*default] % yes ligatures<br />
fi ff fl Auflage Zupfinstrument<br />
</texcode><br />
<br />
While general blocking ({{cmd|blockligatures}}[fi,fl]) works, the exception handling ({{cmd|blockligatures}}[au:fl:age]) might depend on a version unpublished as of this writing (i.e. after 2017-09-28).<br />
<br />
= Word suppression =<br />
<br />
In English, one principle suggests not using specific ligatures in certain words because <em>ligatures should not cross morpheme boundaries</em>. For instance, the <em>fi</em> ligature in wolfish is to be suppressed because the <em>f</em> and <em>i</em> belong to distinct morphemes (<em>wolf</em> and <em>ish</em>, in contrast to <em>fish</em>, where <em>fi</em> is a single morpheme). The following code shows how to apply this rule to prevent unwanted ligatures:<br />
<br />
<texcode><br />
\setuplanguage[en][goodies={lang-en.llg}]<br />
<br />
\starttext<br />
wolfish huffily puffily<br />
\stoptext<br />
</texcode><br />
<br />
Other languages will need a corresponding ligature suppression word list.<br />
<br />
[[Category:Fonts]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Ligatures&diff=33548Ligatures2022-06-05T21:47:16Z<p>Thangalin: /* Word suppression */</p>
<hr />
<div>= Introduction =<br />
<br />
Ligatures are combinations of letters that use different glyph shapes to avoid clashing of parts like i-dots and f-arcs. Many fonts contain at least fi and fl ligatures, well-furnished fonts have also ft, ffl, ffi, fft, fb, ffb, fh, ffh and maybe some traditional ones like st, sp, ct, ch and combinations with long s – German ß was originally a long-s + end-s ligature (even if it looks like s+z and is called szlig).<br />
<br />
While the use of ligatures is a feature of good typography, there are places where they don’t belong, namely at syllable seams where hyphenation can or should take place.<br />
<br />
Some typical German examples are Auf-lage, auf-laden, auf-fallen, Zupf-instrument, Schiff-fahrt. English examples would be chief-ly, shelf-ful, elf-like, wolf-trap, clothes-pin.<br />
<br />
= Traditional TeX methods to break ligatures =<br />
<br />
* Auf\/lage – breaks the ligature, but also kills hyphenation and kerning<br />
* Auf{}lage – worked in pdfTeX (MkII), but not in modern TeX engines<br />
* For LaTeX, there’s the [https://www.ctan.org/pkg/selnolig selnolig] package (English and German).<br />
<br />
= Enabling Ligatures in fonts =<br />
<br />
Ligatures in OpenType fonts are defined via "features" that you can/must enable. Usual ligature features are liga and tlig, but some fonts my have others for more/exotic ligatures.<br />
Here’s an example for a good set of default features:<br />
<br />
<texcode><br />
\definefontfeature[default]<br />
[mode=node,kern=yes,<br />
liga=yes,tlig=yes,<br />
ccmp=yes,language=dflt,<br />
protrusion=quality,<br />
expansion=quality]<br />
</texcode><br />
<br />
The other way round – if you don’t enable ligatures in your font features, you won’t get any; this might be desirable for mono width (typewriter) fonts.<br />
<br />
= Single places =<br />
<br />
If you only want to fix a few occurrences, you can use {{cmd|noligature}}. Compare:<br />
<br />
<texcode><br />
Auflage Zupfinstrument<br />
Au\noligature{fl}age Zup\noligature{fi}nstrument<br />
</texcode><br />
<br />
= Replacements =<br />
<br />
ConTeXt has a method of replacing words that you can use for ligature exception dictionaries:<br />
<br />
<texcode><br />
\mainlanguage[de]<br />
\definefontfeature[default]<br />
[mode=node,liga=yes,kern=yes,tlig=yes,<br />
ccmp=yes,language=dflt,<br />
protrusion=quality,<br />
expansion=quality]<br />
<br />
\replaceword[eg][Auflage][Au{fl}age]<br />
\replaceword[eg][Zupfinstrument][Zup{fi}nstrument]<br />
<br />
\starttext<br />
Auflage Zupfinstrument<br />
<br />
\setreplacements[eg]<br />
Auflage Zupfinstrument<br />
\stoptext<br />
</texcode><br />
<br />
Much better.<br />
The first parameter os {{cmd|replaceword}} is a set (collection) keycode, i.e. you can define different sets of replacements and activate them with {{cmd|setreplacements}}.<br />
<br />
[http://wiki.contextgarden.net/images/b/be/nolig-german-wordlist.tex Here’s] a list of German ligature exceptions, derived from [https://www.ctan.org/pkg/selnolig selnolig] LaTeX package. Just {{cmd|input}} it in your environment.<br />
<br />
In current versions (after 2017-09-28) you may also define several exceptions at once, like<br />
<br />
<texcode><br />
\replaceword [eg] [Au{fl}age Schiff{f}ahrt Zup{fi}nstrument]<br />
</texcode><br />
<br />
Find more details in the source: {{src|lang-rep.mkiv}} <br />
<br />
= Blocking =<br />
<br />
You can also define blocking of ligatures as a font feature:<br />
<br />
<texcode><br />
\blockligatures[fi,ff]<br />
\blockligatures[fl]<br />
\blockligatures[au:fl:age]<br />
\definefontfeature[default:nolig][default][blockligatures=yes]<br />
<br />
\definedfont[Serif*default:nolig] % no ligatures<br />
fi ff fl Auflage Zupfinstrument<br />
<br />
\definedfont[Serif*default] % yes ligatures<br />
fi ff fl Auflage Zupfinstrument<br />
</texcode><br />
<br />
While general blocking ({{cmd|blockligatures}}[fi,fl]) works, the exception handling ({{cmd|blockligatures}}[au:fl:age]) might depend on a version unpublished as of this writing (i.e. after 2017-09-28).<br />
<br />
= Word suppression =<br />
<br />
In English, one principle suggests not using specific ligatures in certain words because <em>ligatures should not cross morpheme boundaries</em>. For instance, the <em>fi</em> ligature in wolfish is to be suppressed because the <em>f</em> and <em>i</em> belong to distinct morphemes (<em>wolf</em> and <me>ish</em>, in contrast to <em>fish</em>, where <em>fi</em> is a single morpheme). The following code shows how to apply this rule to prevent unwanted ligatures:<br />
<br />
<texcode><br />
\setuplanguage[en][goodies={lang-en.llg}]<br />
<br />
\starttext<br />
wolfish huffily puffily<br />
\stoptext<br />
</texcode><br />
<br />
Other languages will need a corresponding ligature suppression word list.<br />
<br />
[[Category:Fonts]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Ligatures&diff=33547Ligatures2022-06-05T21:45:57Z<p>Thangalin: /* Word suppression */</p>
<hr />
<div>= Introduction =<br />
<br />
Ligatures are combinations of letters that use different glyph shapes to avoid clashing of parts like i-dots and f-arcs. Many fonts contain at least fi and fl ligatures, well-furnished fonts have also ft, ffl, ffi, fft, fb, ffb, fh, ffh and maybe some traditional ones like st, sp, ct, ch and combinations with long s – German ß was originally a long-s + end-s ligature (even if it looks like s+z and is called szlig).<br />
<br />
While the use of ligatures is a feature of good typography, there are places where they don’t belong, namely at syllable seams where hyphenation can or should take place.<br />
<br />
Some typical German examples are Auf-lage, auf-laden, auf-fallen, Zupf-instrument, Schiff-fahrt. English examples would be chief-ly, shelf-ful, elf-like, wolf-trap, clothes-pin.<br />
<br />
= Traditional TeX methods to break ligatures =<br />
<br />
* Auf\/lage – breaks the ligature, but also kills hyphenation and kerning<br />
* Auf{}lage – worked in pdfTeX (MkII), but not in modern TeX engines<br />
* For LaTeX, there’s the [https://www.ctan.org/pkg/selnolig selnolig] package (English and German).<br />
<br />
= Enabling Ligatures in fonts =<br />
<br />
Ligatures in OpenType fonts are defined via "features" that you can/must enable. Usual ligature features are liga and tlig, but some fonts my have others for more/exotic ligatures.<br />
Here’s an example for a good set of default features:<br />
<br />
<texcode><br />
\definefontfeature[default]<br />
[mode=node,kern=yes,<br />
liga=yes,tlig=yes,<br />
ccmp=yes,language=dflt,<br />
protrusion=quality,<br />
expansion=quality]<br />
</texcode><br />
<br />
The other way round – if you don’t enable ligatures in your font features, you won’t get any; this might be desirable for mono width (typewriter) fonts.<br />
<br />
= Single places =<br />
<br />
If you only want to fix a few occurrences, you can use {{cmd|noligature}}. Compare:<br />
<br />
<texcode><br />
Auflage Zupfinstrument<br />
Au\noligature{fl}age Zup\noligature{fi}nstrument<br />
</texcode><br />
<br />
= Replacements =<br />
<br />
ConTeXt has a method of replacing words that you can use for ligature exception dictionaries:<br />
<br />
<texcode><br />
\mainlanguage[de]<br />
\definefontfeature[default]<br />
[mode=node,liga=yes,kern=yes,tlig=yes,<br />
ccmp=yes,language=dflt,<br />
protrusion=quality,<br />
expansion=quality]<br />
<br />
\replaceword[eg][Auflage][Au{fl}age]<br />
\replaceword[eg][Zupfinstrument][Zup{fi}nstrument]<br />
<br />
\starttext<br />
Auflage Zupfinstrument<br />
<br />
\setreplacements[eg]<br />
Auflage Zupfinstrument<br />
\stoptext<br />
</texcode><br />
<br />
Much better.<br />
The first parameter os {{cmd|replaceword}} is a set (collection) keycode, i.e. you can define different sets of replacements and activate them with {{cmd|setreplacements}}.<br />
<br />
[http://wiki.contextgarden.net/images/b/be/nolig-german-wordlist.tex Here’s] a list of German ligature exceptions, derived from [https://www.ctan.org/pkg/selnolig selnolig] LaTeX package. Just {{cmd|input}} it in your environment.<br />
<br />
In current versions (after 2017-09-28) you may also define several exceptions at once, like<br />
<br />
<texcode><br />
\replaceword [eg] [Au{fl}age Schiff{f}ahrt Zup{fi}nstrument]<br />
</texcode><br />
<br />
Find more details in the source: {{src|lang-rep.mkiv}} <br />
<br />
= Blocking =<br />
<br />
You can also define blocking of ligatures as a font feature:<br />
<br />
<texcode><br />
\blockligatures[fi,ff]<br />
\blockligatures[fl]<br />
\blockligatures[au:fl:age]<br />
\definefontfeature[default:nolig][default][blockligatures=yes]<br />
<br />
\definedfont[Serif*default:nolig] % no ligatures<br />
fi ff fl Auflage Zupfinstrument<br />
<br />
\definedfont[Serif*default] % yes ligatures<br />
fi ff fl Auflage Zupfinstrument<br />
</texcode><br />
<br />
While general blocking ({{cmd|blockligatures}}[fi,fl]) works, the exception handling ({{cmd|blockligatures}}[au:fl:age]) might depend on a version unpublished as of this writing (i.e. after 2017-09-28).<br />
<br />
= Word suppression =<br />
<br />
In English, one principle suggests not using specific ligatures in certain words because <em>ligatures should not cross morpheme boundaries</em>. For instance, the <em>fi</em> ligature in wolfish is to be suppressed because the <em>f</em> and <em>i</em> belong to distinct morphemes. The following code shows how to apply this rule to prevent unwanted ligatures:<br />
<br />
<texcode><br />
\setuplanguage[en][goodies={lang-en.llg}]<br />
<br />
\starttext<br />
wolfish huffily puffily<br />
\stoptext<br />
</texcode><br />
<br />
Other languages will need a corresponding ligature suppression word list.<br />
<br />
[[Category:Fonts]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Ligatures&diff=33546Ligatures2022-06-05T21:45:06Z<p>Thangalin: </p>
<hr />
<div>= Introduction =<br />
<br />
Ligatures are combinations of letters that use different glyph shapes to avoid clashing of parts like i-dots and f-arcs. Many fonts contain at least fi and fl ligatures, well-furnished fonts have also ft, ffl, ffi, fft, fb, ffb, fh, ffh and maybe some traditional ones like st, sp, ct, ch and combinations with long s – German ß was originally a long-s + end-s ligature (even if it looks like s+z and is called szlig).<br />
<br />
While the use of ligatures is a feature of good typography, there are places where they don’t belong, namely at syllable seams where hyphenation can or should take place.<br />
<br />
Some typical German examples are Auf-lage, auf-laden, auf-fallen, Zupf-instrument, Schiff-fahrt. English examples would be chief-ly, shelf-ful, elf-like, wolf-trap, clothes-pin.<br />
<br />
= Traditional TeX methods to break ligatures =<br />
<br />
* Auf\/lage – breaks the ligature, but also kills hyphenation and kerning<br />
* Auf{}lage – worked in pdfTeX (MkII), but not in modern TeX engines<br />
* For LaTeX, there’s the [https://www.ctan.org/pkg/selnolig selnolig] package (English and German).<br />
<br />
= Enabling Ligatures in fonts =<br />
<br />
Ligatures in OpenType fonts are defined via "features" that you can/must enable. Usual ligature features are liga and tlig, but some fonts my have others for more/exotic ligatures.<br />
Here’s an example for a good set of default features:<br />
<br />
<texcode><br />
\definefontfeature[default]<br />
[mode=node,kern=yes,<br />
liga=yes,tlig=yes,<br />
ccmp=yes,language=dflt,<br />
protrusion=quality,<br />
expansion=quality]<br />
</texcode><br />
<br />
The other way round – if you don’t enable ligatures in your font features, you won’t get any; this might be desirable for mono width (typewriter) fonts.<br />
<br />
= Single places =<br />
<br />
If you only want to fix a few occurrences, you can use {{cmd|noligature}}. Compare:<br />
<br />
<texcode><br />
Auflage Zupfinstrument<br />
Au\noligature{fl}age Zup\noligature{fi}nstrument<br />
</texcode><br />
<br />
= Replacements =<br />
<br />
ConTeXt has a method of replacing words that you can use for ligature exception dictionaries:<br />
<br />
<texcode><br />
\mainlanguage[de]<br />
\definefontfeature[default]<br />
[mode=node,liga=yes,kern=yes,tlig=yes,<br />
ccmp=yes,language=dflt,<br />
protrusion=quality,<br />
expansion=quality]<br />
<br />
\replaceword[eg][Auflage][Au{fl}age]<br />
\replaceword[eg][Zupfinstrument][Zup{fi}nstrument]<br />
<br />
\starttext<br />
Auflage Zupfinstrument<br />
<br />
\setreplacements[eg]<br />
Auflage Zupfinstrument<br />
\stoptext<br />
</texcode><br />
<br />
Much better.<br />
The first parameter os {{cmd|replaceword}} is a set (collection) keycode, i.e. you can define different sets of replacements and activate them with {{cmd|setreplacements}}.<br />
<br />
[http://wiki.contextgarden.net/images/b/be/nolig-german-wordlist.tex Here’s] a list of German ligature exceptions, derived from [https://www.ctan.org/pkg/selnolig selnolig] LaTeX package. Just {{cmd|input}} it in your environment.<br />
<br />
In current versions (after 2017-09-28) you may also define several exceptions at once, like<br />
<br />
<texcode><br />
\replaceword [eg] [Au{fl}age Schiff{f}ahrt Zup{fi}nstrument]<br />
</texcode><br />
<br />
Find more details in the source: {{src|lang-rep.mkiv}} <br />
<br />
= Blocking =<br />
<br />
You can also define blocking of ligatures as a font feature:<br />
<br />
<texcode><br />
\blockligatures[fi,ff]<br />
\blockligatures[fl]<br />
\blockligatures[au:fl:age]<br />
\definefontfeature[default:nolig][default][blockligatures=yes]<br />
<br />
\definedfont[Serif*default:nolig] % no ligatures<br />
fi ff fl Auflage Zupfinstrument<br />
<br />
\definedfont[Serif*default] % yes ligatures<br />
fi ff fl Auflage Zupfinstrument<br />
</texcode><br />
<br />
While general blocking ({{cmd|blockligatures}}[fi,fl]) works, the exception handling ({{cmd|blockligatures}}[au:fl:age]) might depend on a version unpublished as of this writing (i.e. after 2017-09-28).<br />
<br />
= Word suppression =<br />
<br />
In English, one principle suggests not using specific ligatures in certain words because <em>ligatures should not cross morpheme boundaries</em>. For instance, the <em>fi</em> ligature in wolfish is to be suppressed because the <me>f</em> and <em>i</em> belong to distinct morphemes. The following code shows how to apply this rule to prevent unwanted ligatures:<br />
<br />
<texcode><br />
\setuplanguage[en][goodies={lang-en.llg}]<br />
<br />
\starttext<br />
wolfish huffily puffily<br />
\stoptext<br />
</texcode><br />
<br />
Other languages will need a corresponding ligature suppression word list.<br />
<br />
[[Category:Fonts]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Titles&diff=32630Titles2021-07-15T05:50:59Z<p>Thangalin: /* Chapter headers */</p>
<hr />
<div>==Default==<br />
<br />
Titles define the structure of your document. Decide yourself how deep you want to nest them, there are 12 levels of depth predefined:<br />
<br />
{| class=wikitable<br />
! Numbered !! Unnumbered<br />
|- <br />
| {{cmd|part}} || —<br />
|-<br />
| {{cmd|chapter}} || {{cmd|title}}<br />
|-<br />
| {{cmd|section}} || {{cmd|subject}}<br />
|-<br />
| {{cmd|subsection}} || {{cmd|subsubject}}<br />
|-<br />
| {{cmd|subsubsection}} || {{cmd|subsubsubject}}<br />
|-<br />
| ... || ...<br />
|}<br />
<br />
<br />
The unnumbered versions don’t appear in a table of contents! To change that, see the section on [[#Unnumbered_titles_in_table_of_contents|Unnumbered titles in the table of contents]].<br />
<br />
Also note that in the front matter of the document, all titles are unnumbered by default. The titles from the 'numbered' category still show up in the table of contents, though, and the titles from the 'unnumbered' category still don't.<br />
<br />
===Referencing Titles===<br />
<br />
Every heading command can take an optional parameter as reference:<br />
<br />
<texcode><br />
\title[hasselt-by-night]{Hasselt by night}<br />
</texcode><br />
<br />
The bracket pair is optional and used for internal [[References]]. If you want<br />
to refer to this header you type for example<br />
<br />
<texcode><br />
\at{page}[hasselt-by-night].<br />
</texcode><br />
<br />
See {{cmd|at}}.<br />
<br />
Note that reference labels are limited to ASCII characters in traditional TeX.<br />
This limitation has been removed in ConTeXt MkIV.<br />
<br />
===start/stop sectioning===<br />
<br />
Besides the traditional {{cmd|chapter}}, {{cmd|section}} etc. you can also use the more verbose, but also more flexible version of sectioning commands, these support tagged-PDF, XML and ePUB output better and also allow to insert code at the end of these sections.<br />
<br />
{| class=wikitable<br />
! Traditional !! Start/Stop<br />
|-<br />
| {{cmd|part}} || {{cmd|startpart}}<br />
|- <br />
| {{cmd|chapter}} || {{cmd|startchapter}}<br />
|-<br />
| {{cmd|section}} || {{cmd|startsection}}<br />
|-<br />
| {{cmd|subsection}} || {{cmd|startsubsection}}<br />
|-<br />
| {{cmd|subsubsection}} || {{cmd|startsubsubsection}}<br />
|-<br />
| {{cmd|title}} || {{cmd|starttitle}}<br />
|-<br />
| {{cmd|subject}} || {{cmd|startsubject}}<br />
|-<br />
| ... || ...<br />
|}<br />
<br />
Each of these start-commands has a corresponding stop-command to be used at the end of the section. For example:<br />
<br />
<context source=yes text=produces><br />
\setuppapersize[A5]<br />
<br />
\section[sec:old]{Old Section}<br />
<br />
This is an old-style \ConTeXt\ section.<br />
<br />
\startsection<br />
[<br />
title={New Section},<br />
reference=sec:new,<br />
]<br />
<br />
This is a new-style section.<br />
\stopsection<br />
</context><br />
<br />
The following keys are available for the start-commands (see also {{cmd|setupsection}}):<br />
<br />
{| class=wikitable<br />
! Key !! Description<br />
|-<br />
| reference= || The reference key for cross-referencing (with {{cmd|at}}, {{cmd|in}} etc.)<br />
|-<br />
| title= || The title of the section<br />
|-<br />
| list= || The title to show in the table of contents, if different<br />
|-<br />
| bookmark= || The title to show in the PDF bookmarks, if different<br />
|-<br />
| marking= || The title to use in the section marking, if different<br />
|-<br />
| label= || ?<br />
|}<br />
<br />
<br />
===Section Variable===<br />
<br />
You can set custom variables per section, and retrieve them with the {{cmd|structureuservariable}} command:<br />
<br />
<context source=yes text=produces><br />
\setuppapersize[A5]<br />
<br />
\startchapter[title={Foo Bar}][foo=bar] % extra brackets!<br />
<br />
foo is \quote{\structureuservariable{foo}}<br />
<br />
\stopchapter<br />
<br />
</context><br />
<br />
Beware, if you want to reference these in your ToC setup, you need {{cmd|structurelistuservariable}}.<br />
<br />
==Titling Style==<br />
<br />
see {{cmd|setuphead}} and some enhanced samples below.<br />
<br />
A FAQ is, how to get a line under the pageheader:<br />
<br />
<texcode><br />
\setupheader[after=\hrule]<br />
</texcode><br />
<br />
To make the section numbers appear as characters, do<br />
<br />
<texcode><br />
\setupsection[section-3][bodypartconversion=Character]<br />
</texcode><br />
<br />
The <code>section-3</code> corresponds to <code>section</code>. Similarly,<br />
<code>section-1</code> corresponds to <code>part</code>, <code>section-2</code><br />
corresponds to <code>chapter</code> and so on.<br />
<br />
==Titling Alignment==<br />
<br />
Titles should often be left aligned without hyphenation. Try this:<br />
<br />
<texcode><br />
\setuphead[chapter][align={flushleft, nothyphenated, verytolerant}]<br />
</texcode><br />
<br />
==Using colors in chapters and sections==<br />
<br />
For colorful chapters or sections refer to {{cmd|setuphead}}. Take a look at the following<br />
example:<br />
<br />
<texcode><br />
\setupcolors[state=start]<br />
<br />
\setuphead[chapter][header=empty] % Chapter pages won’t have headers<br />
<br />
\setuphead[section][color=darkcyan] % This is how you change your section’s color.<br />
<br />
\setupheadertexts[][chapter] % The header will be the chapter's name<br />
<br />
\starttext<br />
<br />
\completecontent<br />
<br />
\chapter{Black chapter 1}<br />
<br />
\section{Dark cyan section 1.1}<br />
<br />
\page<br />
Test.<br />
<br />
\setuphead[chapter][color=darkgreen]<br />
% This works, but avoid changing setups in the middle of your document,<br />
% better define different versions of chapter, see next section<br />
<br />
\chapter{Dark green chapter}<br />
<br />
\page<br />
Test.<br />
<br />
\setuphead[chapter][color=red]<br />
<br />
\chapter{Red chapter}<br />
<br />
\page<br />
Test.<br />
<br />
\stoptext <br />
</texcode><br />
<br />
==Your Own Titling Levels==<br />
<br />
Of course you can define your own titling commands and probably want to adapt the default settings.<br />
<br />
<texcode><br />
\definehead[myheader][section]<br />
<br />
\setuphead<br />
[myheader]<br />
[numberstyle=bold,<br />
textstyle=cap,<br />
before=\hairline\blank,<br />
after=\nowhitespace\hairline]<br />
<br />
\myheader[hasselt-ref]{Hasselt makes headlines}<br />
</texcode><br />
<br />
A new header {{cmd|myheader}} is defined and it inherits the properties<br />
of {{cmd|section}} (title, subject, whatever).<br />
You can define or setup several headers at once!<br />
<br />
==Formatting Titles with {{cmd|setuphead}}==<br />
<br />
The following parameters to {{cmd|setuphead}} change the style of<br />
the heading. <br />
<br />
{| class=wikitable<br />
|-<br />
! Text !! Number !! Both<br />
|-<br />
| textstyle<br />
| numberstyle<br />
| style<br />
|-<br />
| textcommand<br />
| numbercommand<br />
| command<br />
|-<br />
| deeptextcommand<br />
| deepnumbercommand<br />
| —<br />
|-<br />
|}<br />
<br />
Quite obviously, the number commands work on the chapter/section/etc. number,<br />
their text counterparts change the text itself. However, there are differences<br />
between <tt>style</tt>, <tt>command</tt> and <tt>deepcommand</tt>.<br />
<br />
The <tt>style</tt> variants accept a style (<tt>bold</tt>, <tt>cap</tt>, etc.)<br />
or a font switch ({{cmd|em}}, {{cmd|tfx}}, etc). <tt>textstyle</tt> prepends<br />
the text with the associated style. <tt>textcommand</tt> is a command name which<br />
is given the text (with all markup) as a parameter. <tt>deeptextcommand</tt> is<br />
similar to <tt>textcommand</tt> but it acts only on the text (not on the markup).<br />
<br />
So, if we have {{cmd|title|2={A story}}}, the different parameters have the following results:<br />
<br />
{|<br />
|- <br />
| textstyle=\em<br />
| =><br />
| \em A story<br />
|- <br />
| textstyle=\em, textcommand=\uppercase<br />
| =><br />
| \uppercase{\em A story}<br />
| =><br />
| \em A STORY<br />
|- <br />
| textstyle=\em, deeptextcommand=\uppercase<br />
| =><br />
| \em\uppercase{A story}<br />
| =><br />
| \em A STORY<br />
|-<br />
|}<br />
<br />
What is the difference between <tt>textcommand</tt> and <tt>deeptextcommand</tt>,<br />
then? With this example there is very little difference, as <tt>uppercase</tt><br />
knows how to handle markup. Sometimes this is not the case. For example, an almost<br />
similar command <tt>WORD</tt> is not compatible with <tt>textcommand</tt>, because<br />
it wreaks havoc with markup:<br />
<br />
{| <br />
|-<br />
| textstyle=\em, textcommand=\WORD<br />
| =><br />
| \WORD{\em A story}<br />
| =><br />
| \EM A STORY<br />
|-<br />
| textstyle=\em, deeptextcommand=\WORD<br />
| =><br />
| \em\WORD{A story}<br />
| =><br />
| \em A STORY<br />
|-<br />
|}<br />
<br />
In this case using <tt>deeptextcommand</tt> is the correct solution for capitalizing<br />
headers. (Using {{cmd|uppercase}} works in this specific case, but only if you stick<br />
to Latin 1 or Anglo-Saxon characters. Other languages will suffer from lowercase accented<br />
characters, like CAFé.)<br />
<br />
Use {{cmd|setuphead}}<tt>[part][conversion=Romannumerals]</tt>, for example, to employ an<br />
alternative numbering scheme.<br />
<br />
=== Truly empty pagebreak before chapters ===<br />
<br />
Using {{cmd|setuppagenumbering|2=[alternative=doublesided]}} makes the chapters start<br />
on the right page. However, the blank page is not truly empty, it contains headers and<br />
footers. To get truly empty pages, use the following<br />
<br />
<texcode><br />
\definepagebreak<br />
[mychapterpagebreak]<br />
[yes,header,right]<br />
%[yes,header,left]<br />
%[yes,header,footer,right]<br />
<br />
\setuphead<br />
[chapter]<br />
[page=mychapterpagebreak]<br />
%[page=Mychapterpagebreak,header=empty,footer=empty]<br />
<br />
%\setupsectionblock[frontpart][page=chapter]<br />
%\setupsectionblock[bodypart][page=chapter]<br />
%\setupsectionblock[backpart][page=chapter]<br />
%\setupsectionblock[appendix][page=chapter]<br />
<br />
\setuppagenumbering[alternative=doublesided,location={header,margin}]<br />
\setupheadertexts[{My special headertext}]<br />
\setupfootertexts[This is a text in the footer]<br />
%\setupbackgrounds[header][text][bottomframe=on]<br />
<br />
\starttext<br />
\chapter{testA} \dorecurse{10}{\input tufte }<br />
\chapter{testB} \dorecurse{10}{\input tufte }<br />
\chapter{testC} \dorecurse{10}{\input tufte }<br />
\stoptext<br />
</texcode><br />
<br />
'''Explanation'''<br />
<br />
* You define a new pagebreak rule. It has the name <code>mychapterpagebreak</code>. The options set read as: <code>pagebreak=yes</code>, placeheader, use a right page.<br />
* You set options for the header of type chapter and use for the option page the afore defined new pagebreak.<br />
* You might want to experiment with the commented lines and see what happens. For example, the {{cmd|setupsectionblock}} commands will give a truly blank page (if needed) after the specified {{code|1=stop*part}} command.<br />
<br />
==== When using front, body, back matters and appendices ====<br />
<br />
When using {{code|1=*frontmatter}}, {{code|1=*bodymatter}}, {{code|1=*backmatter}} and {{code|1=*appendices}}, you need to remove the page they create to get the page before a new chapter or part with no headers and footers.<br />
<br />
<texcode><br />
\setupsectionblock[frontpart][page=]<br />
\setupsectionblock[bodypart] [page=]<br />
\setupsectionblock[backpart] [page=]<br />
\setupsectionblock[appendix] [page=]<br />
\definepagebreak[firstpagebreak][yes,header,footer,right]<br />
\setuphead[chapter][page=firstpagebreak]<br />
\setuppagenumbering[alternative=doublesided]<br />
\starttext<br />
\startfrontmatter<br />
\chapter{front}<br />
\stopfrontmatter<br />
\startbodymatter<br />
\chapter{body}<br />
\stopbodymatter<br />
\startappendices<br />
\chapter{appendix}<br />
\stopappendices<br />
\startbackmatter<br />
\chapter{back}<br />
\stopbackmatter<br />
\stoptext<br />
</texcode><br />
<br />
== Independent Section Numbering ==<br />
<br />
If you want section numbering to be independent of chapter numbering, use<br />
<br />
<texcode><br />
\defineresetset[default][1,1,0][1] % reset part, chapter, but not section<br />
\setuphead[sectionresetset=default]<br />
</texcode><br />
<br />
The MkII way was:<br />
<br />
<texcode><br />
\setuphead [chapter][resetnumber=no]<br />
\setupsection[section][previousnumber=no]<br />
</texcode><br />
<br />
<br />
==Unnumbered titles in table of contents==<br />
<br />
Sometimes one wants an unnumbered chapter, say introduction, the following might do that trick:<br />
<br />
<context source=yes><br />
\setuppapersize[A5]<br />
<br />
\definehead [intro] [chapter]<br />
\setuphead [intro] [number=no]<br />
<br />
\definecombinedlist [content][list={intro,chapter,section}]<br />
\setuplist [intro] [headnumber=no]<br />
<br />
\starttext<br />
\completecontent<br />
\startfrontmatter<br />
\intro{No number}<br />
\stopfrontmatter<br />
<br />
\startbodymatter<br />
\chapter{Has number}<br />
\stopbodymatter<br />
\stoptext<br />
</context><br />
<br />
Note that just putting the introduction in the frontmatter already is enough, since frontmatter switches off chapter numbering.<br />
<br />
An alternative approach: <br />
<texcode><br />
\setuphead[title][<br />
incrementnumber=yes, % keep an internal title counter+list<br />
number=no] % don't display the counter<br />
<br />
% Manually specify the composition of the section and subsection<br />
% numbers, so subsection 1.1 in the second title won't appear as<br />
% Subsection 2.1.1<br />
\setuphead[section][sectionsegments=section]<br />
\setuphead[subsection][sectionsegments=section:subsection] <br />
<br />
% Redefine the toc list to include titles<br />
\definecombinedlist[content][list={title,section}]<br />
</texcode><br />
<br />
Usually you don’t want this. It also includes implicit titles (from ToC or Index) in the ToC.<br />
<br />
== Complete Section Numbering ==<br />
<br />
You might have documents in which your sections don’t follow the structure, such as in:<br />
<br />
<texcode><br />
\section{A}<br />
%\subsection{B}<br />
\subsubsection{C}<br />
</texcode><br />
<br />
In that case, you would get <code>1 A</code> <code>1 C</code>. To enable complete section numbering, you would need in this case:<br />
<br />
<texcode><br />
\setuphead[subsection][criterium=all]<br />
</texcode><br />
<br />
==Your Own Title Styles==<br />
<br />
Sometimes the possibilities of {{cmd|setuphead}} aren’t enough. You can define<br />
your own styling commands, as shown in the following examples.<br />
<br />
===Start the title in the margin===<br />
<br />
This very simple example shows how to start a title within the margin, rather than at the text’s edge<br />
<br />
<context source=yes><br />
\setuppapersize[A5]<br />
\setuphead[chapter][alternative=margin]<br />
<br />
\chapter{Sample chapter}<br />
<br />
Number is in margin, not at text edge.<br />
</context><br />
<br />
===Chapter number and titles in separate lines===<br />
<br />
To have the chapter title simply in a new line, a new command needs to be defined that takes care of this. It needs to be wrapped in {{cmd|framed}}.<br />
<br />
<context source=yes><br />
\setuppapersize[A5]<br />
\setuplabeltext [en] [chapter=Chapter~]<br />
\define[2]\MyChapter<br />
{\framed[frame=off,width=broad,align=flushleft]{#1\\#2}}<br />
\setuphead [chapter] [command=\MyChapter]<br />
\chapter{Foo Bar}<br />
</context><br />
<br />
===Expanded chapter titles===<br />
<br />
This example illustrates expanded chapter titles.<br />
<br />
<context source=yes><br />
\setuppapersize[A5]<br />
\define[2]\MyChapterCommand%<br />
{\framed[frame=off,bottomframe=on,topframe=on]<br />
{\vbox{\headtext{chapter} #1\blank#2}}}<br />
<br />
\setuphead[chapter][command=\MyChapterCommand, style={\ss\bfa}]<br />
\setupheadtext[chapter=Chapter]<br />
<br />
\chapter{My First Chapter}<br />
</context><br />
<br />
===Exercise numbers===<br />
<br />
For a textbook, suppose that you collect the exercises in a section at the end<br />
of each chapter, with each exercise a subsection having a short title, and the<br />
exercises should be numbered only by the subsection (not 1.6.7 for example,<br />
just 7). The usage:<br />
<br />
<texcode><br />
\section{Exercises}<br />
<br />
\exercise{Batteries}<br />
What is the cost of energy from a 9V battery? From a wall socket (the mains)?<br />
</texcode><br />
<br />
The setup code:<br />
<texcode><br />
\definehead[exercise][subsection]<br />
<br />
\setuphead<br />
[exercise]<br />
[style=italic, <br />
numbercommand={\determineheadnumber[subsection]\currentheadnumber\gobbleoneargument}]<br />
</texcode><br />
<br />
===A complex graphical element under the chapter title===<br />
<br />
<context source=yes><br />
\setuppapersize[A6]<br />
\setupcolors[state=start]<br />
\startuseMPgraphic{HeaderDeco}<br />
numeric w, h, repeats;<br />
path p[];<br />
w := OverlayWidth ; h := OverlayHeight ;<br />
repeats := abs(TextWidth/BodyFontSize);<br />
p[1] := unitsquare xscaled w yscaled h ;<br />
draw p[1] withcolor white;<br />
p[2] := fullcircle scaled BodyFontSize;<br />
p[3] := fullcircle scaled .25BodyFontSize;<br />
draw p[2] shifted (.5BodyFontSize,0);<br />
for i = 1 upto repeats:<br />
if odd i :<br />
filldraw p[3] shifted (i*BodyFontSize+.5BodyFontSize,0);<br />
else :<br />
draw p[2] shifted (i*BodyFontSize+.5BodyFontSize,0);<br />
fi;<br />
endfor;<br />
\stopuseMPgraphic<br />
<br />
\setuphead[chapter][command=\Myheader]<br />
\setupheadtext<br />
[chapter=Chapitre]<br />
\defineoverlay[HeaderDeco][\uniqueMPgraphic{HeaderDeco}]<br />
<br />
\define[2]\Myheader{%<br />
\framedtext<br />
[width= \overlaywidth,<br />
height=6\bodyfontsize,<br />
background={foreground,HeaderDeco},<br />
offset=0pt,<br />
strut=no,<br />
frame=off,<br />
align=middle]{%<br />
\headtext{chapter} #1<br />
\blank[small]<br />
#2}}<br />
<br />
\starttext<br />
\chapter{Here we go!}<br />
\stoptext<br />
</context><br />
<br />
===Title page with special background===<br />
<br />
If you want the title page of every chapter to have a special background (different from the background of normal pages), here’s a very effective trick that Hans has provided on the mailing list. In addition, this will give every chapter its own color scheme: <br />
<br />
<context source=yes><br />
\startMPinclusions<br />
numeric MyTitlePageDone[] ;<br />
\stopMPinclusions<br />
<br />
\startuseMPgraphic{background:normal}<br />
StartPage ;<br />
fill (topboundary Page -- cycle) enlarged(0,5mm) <br />
shifted (0,-5mm) withcolor blue ;<br />
StopPage ;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay<br />
[background:normal]<br />
[\useMPgraphic{background:normal}]<br />
<br />
\startuseMPgraphic{background:title}<br />
if unknown MyTitlePageDone.\namedstructureuservariable{chapter}{mycolor} :<br />
StartPage ;<br />
fill ((topboundary Page --cycle) enlarged(0,5mm)) shifted (0,-20mm)<br />
withcolor \MPcolor{color:title:\namedstructureuservariable{chapter}{mycolor}} ;<br />
StopPage ;<br />
MyTitlePageDone.\namedstructureuservariable{chapter}{mycolor} := 1 ;<br />
fi ;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay<br />
[background:title]<br />
[\useMPgraphic{background:title}]<br />
<br />
\setupbackgrounds<br />
[page]<br />
[background={background:normal,background:title}]<br />
<br />
\definecolor [color:title:one] [red]<br />
\definecolor [color:title:two] [blue]<br />
<br />
\starttext<br />
<br />
\startchapter[title=One][mycolor=one] \input tufte \page \input knuth \stopchapter<br />
\startchapter[title=Two][mycolor=two] \input tufte \page \input knuth \stopchapter<br />
<br />
\stoptext<br />
<br />
</context><br />
<br />
===Titles in margin===<br />
<br />
It is sometimes wanted to place the title of a section/subject etc in the margin next to the section text (instead of above it).<br />
This is achieved by the following setup:<br />
<br />
<context source=yes><br />
\setuppapersize[A5]<br />
\setuphead<br />
[subject]<br />
[alternative=text,distance=0pt,command=\MyHead,style=\sc]<br />
<br />
\define[2]\MyHead{\inmargin{#1 #2}}<br />
<br />
\starttext<br />
<br />
\subject{First Subject}<br />
\input weisman<br />
<br />
\subject{Second Subject}<br />
\input ward<br />
<br />
\stoptext<br />
</context><br />
<br />
See [http://www.ntg.nl/pipermail/ntg-context/2003/002053.html the mailing list thread (2003)] for more on this.<br />
<br />
===Headings numbered independent of chapters or other headings===<br />
<br />
If you want a heading that gets numbered without resetting at new sections or chapters (for example, for problems whose numbers increment throughout a book), here is a solution due to Hans [http://archive.contextgarden.net/message/20030415.153451.374310d8.en.html on the mailing list (2003)]:<br />
<br />
<texcode><br />
% use a lower level head<br />
<br />
\definehead[Problem][subsubsubsection]<br />
<br />
% cleaned up<br />
<br />
\setuphead[Problem]<br />
[style=\ss\bf,<br />
color=red,<br />
before=\blank]<br />
<br />
% use a label text<br />
<br />
\setuplabeltext[Problem={Problem }]<br />
<br />
% use your own numbers<br />
<br />
\setuphead[Problem]<br />
[ownnumber=yes]<br />
<br />
% increment and feed<br />
<br />
\newcounter\ProblemNumber<br />
<br />
\def\problem#1%<br />
{\doglobal\increment\ProblemNumber<br />
\Problem{\ProblemNumber}{#1}}<br />
<br />
% nicer here<br />
<br />
\setuplist[Problem]<br />
[alternative=c,<br />
criterium=all,<br />
width=2em,<br />
interaction=all]<br />
<br />
% the test<br />
<br />
\starttext<br />
<br />
List of Problems<br />
<br />
\blank[big] \placelist[Problem] \blank[big]<br />
<br />
\section{Tufte}<br />
<br />
\input tufte<br />
<br />
\problem{First problem}<br />
<br />
The first problem description.<br />
<br />
\section{Another Tufte}<br />
<br />
\input tufte<br />
<br />
\problem{Second problem}<br />
<br />
Second problem description.<br />
<br />
\stoptext<br />
</texcode><br />
<br />
===Chapter Headings===<br />
<br />
This is an example of chapter headings with an enlarged shadow behind them, based on [http://archive.contextgarden.net/message/20041020.100630.d531bb1d.en.html a solution by Hans (2004)].<br />
<br />
<context source=yes><br />
\setuppapersize[A5]<br />
<br />
\useencoding[ffr]<br />
\mainlanguage[fr]<br />
<br />
\setupcolors[state=start]<br />
<br />
\definefont[BigFontOne][Regular sa 3] %RegularSlanted sa 3(ori)%Sans sa 3:don't work (pb accents)<br />
\definefont[BigFontTwo][RegularBold sa 2] %%RegularSlanted<br />
<br />
\definecolor[BigColorOne][r=.86,g=.850,b=.54]<br />
\definecolor[BigColorTwo][r=.43,g=.425,b=.27]<br />
<br />
\setuphead<br />
[chapter]<br />
[textcommand=\MyChapterText,<br />
color=BigColorTwo,<br />
style=\BigFontTwo]<br />
<br />
\def\MyChapterText#1{\rlap{\BigFontOne\BigColorOne#1}\kern15pt#1}<br />
<br />
\starttext<br />
<br />
\chapter[chap:ques]{Question}<br />
<br />
\stoptext<br />
</context><br />
<br />
===Figures in Headings===<br />
<br />
This example shows how to completely replace the chapter text and number by an image:<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\setupexternalfigures[location=default] % needed only for the wiki to the find the figure<br />
<br />
\useexternalfigure[section-1][cow][width=5cm,height=1cm]<br />
\useexternalfigure[section-2][mill.png][width=5cm,height=1cm]<br />
<br />
\setuphead<br />
[section]<br />
[command=\MySectionCommand]<br />
\setuphead<br />
[subsection]<br />
[command=]<br />
<br />
\define[2]\MySectionCommand%<br />
{\externalfigure[section-\currentheadnumber]}<br />
<br />
\starttext<br />
<br />
\section{One}<br />
\subsection{First subsection of Section One}<br />
\section{Two}<br />
<br />
\stoptext<br />
</context><br />
<br />
There are a few snags though. MkII "forgets" to put the chapter in the<br />
TOC. So you have to set the <tt>deeptextcommand</tt> and<br />
<tt>deepnumbercommand</tt> separately instead (thus retaining the<br />
command that puts the chapter in the TOC), rather than setting the<br />
overall <tt>command</tt>, if you need a complete TOC.<br />
<br />
<texcode><br />
\setuphead<br />
[chapter]<br />
[deeptextcommand=\MyChapterTextCommand,<br />
deepnumbercommand=\gobbleoneargument] % hide chapter number<br />
<br />
\def\MyChapterTextCommand#1%<br />
{\externalfigure[chapter-\currentheadnumber][height=5cm]}<br />
</texcode><br />
<br />
[http://archive.contextgarden.net/message/20050519.215526.df7c5cd1.html] (2005)<br />
<br />
Users of MkIV can safely rely on <tt>command</tt> and don't have to bother with the <tt>deep...command</tt> variants. However, {{cmd|currentheadnumber}} does not seem to return anything but 0. Thus, the following code is required to define <tt>\MyChapterCommand</tt> when using MkIV:<br />
<br />
<texcode><br />
\def\MyChapterCommand#1#2%<br />
{\externalfigure[chapter-\namedheadnumber{chapter}][height=5cm]}<br />
</texcode><br />
<br />
[http://archive.contextgarden.net/message/20100817.102859.206d858e.en.html] (2010)<br />
<br />
===Chapter head with absolute positioning of following text===<br />
<br />
No matter how many lines the chapter head runs to, the text will always start, e.g. 4cm below the top of the heading:<br />
<br />
<context source=yes><br />
\setuppapersize[A6][A6]<br />
\setupbodyfont[8pt]<br />
\def\MyChapterCommand#1#2%<br />
{\vbox to 4cm\bgroup<br />
{#1\hskip.75em #2}<br />
\vss<br />
\egroup}<br />
\setuphead[chapter][header=nomarking, command=\MyChapterCommand]<br />
\starttext<br />
\chapter{test} \input tufte<br />
\stoptext<br />
</context><br />
<br />
===Section head with underlining to width of last line===<br />
<br />
A style called for section headings to be followed by a rule which extends only the width of the text. More tricky was the need to make sure that if the text ran onto another line, it was the length of the ''last'' line that was to be followed. <br />
<br />
Hans came up with this cleverness, showing two alternate ways of doing it:<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
<br />
% ---- First solution ----<br />
<br />
\def\FirstSolution#1#2%<br />
{\vbox\bgroup<br />
\setbox0\hbox{#1}<br />
\hsize.4\textwidth<br />
\beginshapebox#2\endshapebox<br />
\gdef\SetLastLineWidth{\xdef\LastLineWidth{\the\wd\scratchbox}}%<br />
\reshapebox<br />
{\setbox\scratchbox\hbox{\unhbox\shapebox}%<br />
\SetLastLineWidth<br />
\globallet\SetLastLineWidth\relax<br />
\box\scratchbox}%<br />
\scratchdimen\dimexpr\wd0+.25em+\LastLineWidth\relax<br />
% \setbox2\ruledvbox {\innerflushshapebox} <br />
% why is correction needed<br />
\setbox2\vbox {\vskip-\lineskip\innerflushshapebox}<br />
\setbox0\vbox to \ht2{\box0}<br />
\hbox{\box0\hskip.25em\box2}<br />
\offinterlineskip<br />
\vskip.25ex<br />
\blackrule[width=\scratchdimen,height=1pt]<br />
\egroup}<br />
<br />
% ---- Second solution ----<br />
<br />
\doglobal\newcounter\NextLinePos<br />
<br />
\def\SecondSolution#1#2%<br />
{\vbox\bgroup<br />
\hsize.4\textwidth<br />
\doglobal\increment\NextLinePos<br />
\setbox\scratchbox\hbox{#1}<br />
\hbox{\vtop{\copy\scratchbox}\hskip.25em\vtop{#2}}%<br />
\offinterlineskip<br />
\scratchdimen\dimexpr\wd\scratchbox+.25em+<br />
\MPx{e:npl:\NextLinePos}-\MPx{b:npl:\NextLinePos}\relax<br />
\vskip.25ex<br />
\blackrule[width=\scratchdimen,height=1pt]<br />
\egroup}<br />
<br />
\def\DoSecondSolution#1%<br />
{\bpos{npl:\NextLinePos}#1\epos{npl:\NextLinePos}}<br />
<br />
% ---- Trying it out solution ----<br />
<br />
% \showstruts<br />
<br />
\starttext<br />
\setuphead[section][command=\FirstSolution]<br />
\section{is this nice or not}<br />
\section{is this nice or not nice, that's the question}<br />
<br />
\setuphead[section][command=\SecondSolution,deeptextcommand=\DoSecondSolution]<br />
\section{is this nice or not}<br />
\section{is this nice or not nice, that's the question}<br />
\stoptext<br />
</context><br />
<br />
As if that wasn't enough, Taco pointed out that {{cmd|lastlinewidth}}<br />
is the easy route to finding the width of the last line. Use something like:<br />
<br />
<texcode><br />
\optimizedisplayspacingtrue\setlastlinewidth % core-mat macro<br />
\global\advance\lastlinewidth-\hangindent\par % adjust<br />
\blackrule[width=\lastlinewidth,height=1pt]<br />
</texcode><br />
<br />
=== Flushing section head data without typesetting them in the text ===<br />
<br />
The following is probably a very special case. Hoever suppose you need to place section information like the title e.g. in the topspace area. You want that the section is still displayed in the TOC, but you do not want that at the spot where {{cmd|startsection|2=[title=...,list=...]}} resides there is any trace of it. The command to be used to hide the section title is:<br />
<br />
<texcode><br />
\setuphead<br />
[section]<br />
[placehead=hidden] <br />
</texcode><br />
<br />
Be aware that with this setting indeed the section title is not shown and no white space is inserted. However in this way also the list entry for the TOC is gone. What you can do in such cases is to use the following command in connection with the above mentioned setting:<br />
<br />
<texcode><br />
\setuptexttexts[{\placerawheaddata[section]} <br />
</texcode><br />
<br />
What happens is that the information in the {{cmd|startsection|2=[title=...,list=...]}} command is passed to the texttexts, which are flushed at every page. In order to see when it is flushed you might place e.g. !!! in front of the {{cmd|placerawheaddata|2=[section]}}.<br />
<br />
The result is a complete TOC without any trace of the section heading in the text.<br />
<br />
'''Test:'''<br />
<br />
<texcode><br />
\setuphead<br />
[section]<br />
[placehead=hidden,<br />
page=yes]<br />
<br />
\setuphead<br />
[subsection]<br />
[placehead=yes,<br />
page=yes,<br />
continue=yes,<br />
style=\it]<br />
<br />
\setuptexttexts[{\placerawheaddata[section]}]<br />
<br />
\starttext<br />
<br />
\placelist[section,subsection] \page<br />
<br />
\startsection[title=First section]<br />
<br />
\startsubsection[title=First subsection]<br />
Lorem ipsum \dots<br />
\stopsubsection<br />
<br />
\startsubsection[title=second subsection]<br />
Lorem ipsum \dots<br />
\stopsubsection<br />
<br />
\stopsection<br />
<br />
\startsection[title=Second section]<br />
<br />
\startsubsection[title=First subsection]<br />
Lorem ipsum \dots<br />
\stopsubsection<br />
<br />
\stopsection<br />
<br />
\stoptext<br />
</texcode> <br />
<br />
===Section head without chapter number ===<br />
<br />
If you only want the section number in the section title you add<br />
<br />
<texcode><br />
\setuphead[section][sectionsegments=section]<br />
\starttext<br />
\chapter{Eric}<br />
\section{Foo 1}<br />
\subsection{Bar one}<br />
\section{Foo 2}<br />
\stoptext<br />
</texcode><br />
<br />
But as once you changed one you have to change the lower ones.<br />
So you have to add the definition of sectionsegments in subsection, subsubsection, ...<br />
<br />
<texcode><br />
\setuphead[section][sectionsegments=section]<br />
\setuphead[subsection][sectionsegments=section:subsection]<br />
\setuphead[subsubsection][sectionsegments=section:subsubsection]<br />
<br />
\starttext<br />
\chapter{Eric}<br />
\section{Foo 1}<br />
\subsection{Bar one}<br />
\subsubsection{Barbar one }<br />
\subsubsection{Barbar two}<br />
\subsection{Bar two}<br />
\subsubsection{Barbar one}<br />
\subsubsection{Barbar two}<br />
\section{Foo 2}<br />
\subsection{Bar one}<br />
\subsubsection{Barbar one}<br />
\subsubsection{Barbar two}<br />
\stoptext<br />
</texcode><br />
<br />
It's not written here but you can also change the conversion of the numbering with <br />
<br />
<texcode><br />
\definestructureconversionset[mySet][A,R,n,n,a,r][n] <br />
\setuphead[chapter,section,subsection,subsubsection,subsubsubsection][sectionconversionset=mySet]<br />
</texcode><br />
<br />
The parameters in definestructureconversionset are<br />
<br />
the set name<br />
<br />
the codes for conversion (one for each level)<br />
<br />
the default conversion for the missing level<br />
<br />
You can find the conversions codes at [http://wiki.contextgarden.net/Conversions]<br />
<br />
===Editing Bold Math in Section Titles===<br />
<br />
When a section title is formatted in boldface text, this doesn't automatically typeset embedded math in bold. This is probably a good thing, as many math fonts do not include all characters in boldface, and often authors use boldface to distinguish between different meanings (for instance, scalar and vector variables). However, in some cases, it ''is'' desirable to format the math in the section titles in boldface.<br />
<br />
Here a very simple example:<br />
<context source=yes><br />
\definetypeface[boldmath][mm][boldmath][latin-modern][default]<br />
\setuphead[section][style=\boldmath\rm\bfa]<br />
\starttext<br />
\section{Bold $a^2+b^2=c^2$ {\em bla}}<br />
text: not bold $a^2+b^2=c^2$ {\em bla}<br />
\stoptext<br />
</context><br />
<br />
[[Category:Basics]]<br />
[[Category:Fonts]]<br />
[[Category:Graphics]]<br />
[[Category:Math]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Command/placeinitial&diff=32624Command/placeinitial2021-07-10T18:45:04Z<p>Thangalin: </p>
<hr />
<div><cd:commandgroup name="placeinitial" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"><br />
<cd:shortdesc>Initials (also known as drop caps, dropped caps, or versals) can be made in ConTeXt using the {{cmd|placeinitial}} command detailed here.<br />
<br />
See {{cmd|setupinitial}} for customization.</cd:shortdesc><br />
<cd:variants><br />
<cd:command category="fonts" file="typo-drp.mkiv" interfacedate="2019-11-19T09:54" interfacefile="i-initial.xml" level="document" name="placeinitial" variantnumber="1"><br />
<cd:arguments><br />
<cd:keywords optional="yes" ordinal="1"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:name"></cd:constant><br />
</cd:keywords><br />
</cd:arguments><br />
</cd:command><br />
</cd:variants><br />
<cd:description><!-- the long description of the command goes here --><br />
</cd:description><br />
<cd:examples><cd:example title="basics"><context mode="mkiv" source="yes"><br />
\definepapersize[sheet][width=120mm,height=60mm]<br />
\setuppapersize[sheet]<br />
\setuppagenumbering[location=]<br />
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]<br />
<br />
\starttext<br />
<br />
\placeinitial<br />
\input knuth<br />
<br />
\stoptext<br />
</context></cd:example><cd:example title="Short Paragraphs">When the first paragraph does not take up the entire height of the drop-cap, use the {{cmd|forgetinitial}} command to indicate when the drop-cap ends.<br />
<br />
<context mode="mkiv" source="yes"><br />
\enableexperiments[autoforgetinitials]<br />
\setupinitial[n=2, style=\tfd, location=text]<br />
\setuphead[chapter][after={\placeinitial}]<br />
<br />
\starttext<br />
\chapter<br />
<br />
Short paragraph \par<br />
<br />
\forgetinitial \input tufte<br />
<br />
\stoptext<br />
</context><br />
</cd:example></cd:examples><br />
<cd:notes></cd:notes><br />
<cd:seealso><br />
<cd:source file="typo-drp.mkiv" originator="system"></cd:source><br />
<cd:wikipage originator="system" page="Category:Fonts"></cd:wikipage><br />
<cd:commandref name="definefirstline">to apply specific style to the whole first line, or first words</cd:commandref></cd:seealso><br />
</cd:commandgroup></div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Command/placeinitial&diff=32623Command/placeinitial2021-07-10T18:43:12Z<p>Thangalin: </p>
<hr />
<div><cd:commandgroup name="placeinitial" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"><br />
<cd:shortdesc>Initials (also known as drop caps, dropped caps, or versals) can be made in ConTeXt using the {{cmd|placeinitial}} command detailed here.<br />
<br />
See {{cmd|setupinitial}} for customization.</cd:shortdesc><br />
<cd:variants><br />
<cd:command category="fonts" file="typo-drp.mkiv" interfacedate="2019-11-19T09:54" interfacefile="i-initial.xml" level="document" name="placeinitial" variantnumber="1"><br />
<cd:arguments><br />
<cd:keywords optional="yes" ordinal="1"><br />
<cd:keywordsdoc></cd:keywordsdoc><br />
<cd:constant type="cd:name"></cd:constant><br />
</cd:keywords><br />
</cd:arguments><br />
</cd:command><br />
</cd:variants><br />
<cd:description><!-- the long description of the command goes here --><br />
</cd:description><br />
<cd:examples><cd:example title="basics"><context mode="mkiv" source="yes"><br />
\definepapersize[sheet][width=120mm,height=60mm]<br />
\setuppapersize[sheet]<br />
\setuppagenumbering[location=]<br />
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]<br />
<br />
\starttext<br />
<br />
\placeinitial<br />
\input knuth<br />
<br />
\stoptext<br />
</context></cd:example><cd:example title="Short Paragraphs"><context mode="mkiv" source="yes"><br />
\enableexperiments[autoforgetinitials]<br />
\setupinitial[n=2, style=\tfd, location=text]<br />
\setuphead[chapter][after={\placeinitial}]<br />
<br />
\starttext<br />
\chapter <br />
<br />
Short paragraph \par<br />
<br />
\forgetinitial \input tufte<br />
<br />
\stoptext<br />
</context><br />
</cd:example></cd:examples><br />
<cd:notes></cd:notes><br />
<cd:seealso><br />
<cd:source file="typo-drp.mkiv" originator="system"></cd:source><br />
<cd:wikipage originator="system" page="Category:Fonts"></cd:wikipage><br />
<cd:commandref name="definefirstline">to apply specific style to the whole first line, or first words</cd:commandref></cd:seealso><br />
</cd:commandgroup></div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Speech_bubble&diff=32561Speech bubble2021-05-22T03:02:02Z<p>Thangalin: </p>
<hr />
<div>= Overview =<br />
<br />
This page describes a few ways to create speech bubbles.<br />
<br />
== LMTX ==<br />
<br />
Using ConTeXt LMTX, the following code generates a dependency-free speech bubble:<br />
<br />
<context source=yes><br />
\startuseMPgraphic{TextBubble}{side}<br />
z1 = (0, 0) ;<br />
z2 = (OverlayWidth, 0) ;<br />
z3 = (OverlayWidth, OverlayHeight) ;<br />
z4 = (0, OverlayHeight) ;<br />
<br />
offset := 1 ;<br />
tail := 1 ;<br />
<br />
if \MPvar{side} = 1:<br />
offset := 5 ;<br />
tail := -1 ;<br />
fi<br />
<br />
(offset/6)[x1,x2] = x8 + 1cm * tail = x7 + .5cm = x9 - .5cm ;<br />
y7 = 0cm ;<br />
y8 = -1cm ;<br />
y9 = 0cm ;<br />
<br />
path p ;<br />
p = (z1--z7--z8--z9--z2--z3--z4--cycle) cornered .25cm ;<br />
draw p withpen pencircle scaled 0.5 ;<br />
<br />
setbounds currentpicture to OverlayBox ;<br />
\stopuseMPgraphic<br />
<br />
% Receive text (left-facing).<br />
\defineoverlay[TextBubbleRxOverlay][\useMPgraphic{TextBubble}{side=0}]<br />
\defineframedtext[TextBubbleRxFrame][<br />
frame=off,<br />
background=TextBubbleRxOverlay,<br />
width=fit,<br />
offset=.75em,<br />
location=left,<br />
after={\blank[1.25cm]},<br />
]<br />
<br />
% Send text (right-facing).<br />
\defineoverlay[TextBubbleTxOverlay][\useMPgraphic{TextBubble}{side=1}]<br />
\defineframedtext[TextBubbleTxFrame][<br />
frame=off,<br />
background=TextBubbleTxOverlay,<br />
width=fit,<br />
offset=.75em,<br />
location=right,<br />
after={\blank[1.25cm]},<br />
]<br />
<br />
\starttext <br />
\startTextBubbleRxFrame<br />
\input weisman<br />
\stopTextBubbleRxFrame<br />
<br />
\startTextBubbleTxFrame<br />
\input ward<br />
\stopTextBubbleTxFrame<br />
<br />
\input knuth<br />
\stoptext<br />
</context><br />
<br />
== Tikz Module ==<br />
<br />
Use the Tikz module to create « speech bubbles ». Here are two ways of doing this: the first one works under mkii and mkiv, while the second one needs the Annotation module written by Wofgang Schuster who wrapped the Tikz commands in ConTeXt macros in the code below.<br />
<br />
<texcode><br />
<br />
\usemodule[tikz]<br />
\usetikzlibrary[shapes.callouts]<br />
<br />
\setupbodyfont[bookman]<br />
<br />
\setupTEXpage[offset=1em]<br />
<br />
\starttext<br />
<br />
\startTEXpage<br />
\starttikzpicture[remember picture]<br />
\node[ellipse callout, draw] (node:ref) {Hi there!};<br />
\stoptikzpicture<br />
\stopTEXpage<br />
<br />
\startTEXpage<br />
\starttikzpicture[remember picture]<br />
\node[cloud callout, draw] (node:ref) {Hallo!};<br />
\stoptikzpicture<br />
\stopTEXpage<br />
<br />
\startTEXpage<br />
\starttikzpicture<br />
\node[cloud callout, cloud puffs=15, aspect=2.5, cloud puff arc=120,<br />
shading=ball,text=white] {\bf Imagine\dots};<br />
\stoptikzpicture<br />
\stopTEXpage<br />
<br />
\startTEXpage<br />
\starttikzpicture[remember picture, note/.style={rectangle callout, fill=#1}]<br />
\draw [help lines] grid(3,2);<br />
\node [note=red!50, callout relative pointer={(0,1)}] at (3,1) {Relative position};<br />
\node [note=blue!50, callout absolute pointer={(0,1)}] at (1,0) {Absolute position};<br />
\node [note=green!50, ellipse callout, opacity=.5, overlay, callout absolute pointer={(hallo.south)}] at (1,2) {Outside};<br />
\stoptikzpicture<br />
\stopTEXpage<br />
<br />
\stoptext<br />
</texcode><br />
<br />
In the above example, you can leave out the \startTEXpage and \stopTEXpage, and use the pictures and you wish in your text.<br />
<br />
The second example is as follows:<br />
<br />
<texcode><br />
<br />
\usemodule[tikz,annotation]<br />
\usetikzlibrary[shapes.callouts]<br />
<br />
\define[2]\SpeechbubbleCommand<br />
{\starttikzpicture[remember picture]<br />
\node[rectangle callout, draw] (node:ref) {\framedtext[width=fit,frame=off]{#2}};<br />
\stoptikzpicture}<br />
<br />
\defineannotation<br />
[speechbubble]<br />
[alternative=command,<br />
command=\SpeechbubbleCommand]<br />
<br />
\starttext<br />
<br />
\speechbubble{Hello!}<br />
<br />
\startspeechbubble<br />
\input ward<br />
\stopspeechbubble<br />
<br />
\stoptext<br />
</texcode><br />
<br />
As said before the above code needs mkiv functionalities (due to the usage of the Annotation module). Indeed you can change some of Tikz commands in the above defintions, for instance change the command<br />
<texcode><br />
\node[rectangle callout, draw]<br />
</texcode><br />
into<br />
<texcode><br />
\node[cloud callout, draw]<br />
</texcode><br />
to get other bubble shapes.<br />
<br />
[[Category:Graphics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Speech_bubble&diff=32559Speech bubble2021-05-20T07:03:28Z<p>Thangalin: </p>
<hr />
<div>= Overview =<br />
<br />
This page describes a few ways to create speech bubbles.<br />
<br />
== LMTX ==<br />
<br />
Using ConTeXt LMTX, the following code can be used without any module dependency:<br />
<br />
<texcode><br />
\startuseMPgraphic{TextBubble}{side}<br />
z1 = (0, 0) ;<br />
z2 = (OverlayWidth, 0) ;<br />
z3 = (OverlayWidth, OverlayHeight) ;<br />
z4 = (0, OverlayHeight) ;<br />
<br />
offset := 1 ;<br />
tail := 1 ;<br />
<br />
if \MPvar{side} = 1:<br />
offset := 5 ;<br />
tail := -1 ;<br />
fi<br />
<br />
(offset/6)[x1,x2] = x8 + 1cm * tail = x7 + .5cm = x9 - .5cm ;<br />
y7 = 0cm ;<br />
y8 = -1cm ;<br />
y9 = 0cm ;<br />
<br />
path p ;<br />
p = (z1--z7--z8--z9--z2--z3--z4--cycle) cornered .25cm ;<br />
draw p withpen pencircle scaled 0.5 ;<br />
<br />
setbounds currentpicture to OverlayBox ;<br />
\stopuseMPgraphic<br />
<br />
% Send (right)<br />
\defineoverlay[TextBubbleTxOverlay][\useMPgraphic{TextBubble}{side=1}]<br />
\defineframedtext[TextBubbleTxFrame][<br />
frame=off,<br />
background=TextBubbleTxOverlay,<br />
offset=.75em,<br />
location=right,<br />
after={\blank[1.25cm]},<br />
]<br />
<br />
% Receive (left)<br />
\defineoverlay[TextBubbleRxOverlay][\useMPgraphic{TextBubble}{side=0}]<br />
\defineframedtext[TextBubbleRxFrame][<br />
frame=off,<br />
background=TextBubbleRxOverlay,<br />
offset=.75em,<br />
location=left,<br />
after={\blank[1.25cm]},<br />
]<br />
<br />
\starttext <br />
\startTextBubbleRxFrame<br />
\input weisman<br />
\stopTextBubbleRxFrame<br />
<br />
\startTextBubbleTxFrame<br />
\input ward<br />
\stopTextBubbleTxFrame<br />
<br />
\input knuth<br />
\stoptext<br />
</texcode><br />
<br />
== Tikz Module ==<br />
<br />
Use the Tikz module to create « speech bubbles ». Here are two ways of doing this: the first one works under mkii and mkiv, while the second one needs the Annotation module written by Wofgang Schuster who wrapped the Tikz commands in ConTeXt macros in the code below.<br />
<br />
<texcode><br />
<br />
\usemodule[tikz]<br />
\usetikzlibrary[shapes.callouts]<br />
<br />
\setupbodyfont[bookman]<br />
<br />
\setupTEXpage[offset=1em]<br />
<br />
\starttext<br />
<br />
\startTEXpage<br />
\starttikzpicture[remember picture]<br />
\node[ellipse callout, draw] (node:ref) {Hi there!};<br />
\stoptikzpicture<br />
\stopTEXpage<br />
<br />
\startTEXpage<br />
\starttikzpicture[remember picture]<br />
\node[cloud callout, draw] (node:ref) {Hallo!};<br />
\stoptikzpicture<br />
\stopTEXpage<br />
<br />
\startTEXpage<br />
\starttikzpicture<br />
\node[cloud callout, cloud puffs=15, aspect=2.5, cloud puff arc=120,<br />
shading=ball,text=white] {\bf Imagine\dots};<br />
\stoptikzpicture<br />
\stopTEXpage<br />
<br />
\startTEXpage<br />
\starttikzpicture[remember picture, note/.style={rectangle callout, fill=#1}]<br />
\draw [help lines] grid(3,2);<br />
\node [note=red!50, callout relative pointer={(0,1)}] at (3,1) {Relative position};<br />
\node [note=blue!50, callout absolute pointer={(0,1)}] at (1,0) {Absolute position};<br />
\node [note=green!50, ellipse callout, opacity=.5, overlay, callout absolute pointer={(hallo.south)}] at (1,2) {Outside};<br />
\stoptikzpicture<br />
\stopTEXpage<br />
<br />
\stoptext<br />
</texcode><br />
<br />
In the above example, you can leave out the \startTEXpage and \stopTEXpage, and use the pictures and you wish in your text.<br />
<br />
The second example is as follows:<br />
<br />
<texcode><br />
<br />
\usemodule[tikz,annotation]<br />
\usetikzlibrary[shapes.callouts]<br />
<br />
\define[2]\SpeechbubbleCommand<br />
{\starttikzpicture[remember picture]<br />
\node[rectangle callout, draw] (node:ref) {\framedtext[width=fit,frame=off]{#2}};<br />
\stoptikzpicture}<br />
<br />
\defineannotation<br />
[speechbubble]<br />
[alternative=command,<br />
command=\SpeechbubbleCommand]<br />
<br />
\starttext<br />
<br />
\speechbubble{Hello!}<br />
<br />
\startspeechbubble<br />
\input ward<br />
\stopspeechbubble<br />
<br />
\stoptext<br />
</texcode><br />
<br />
As said before the above code needs mkiv functionalities (due to the usage of the Annotation module). Indeed you can change some of Tikz commands in the above defintions, for instance change the command<br />
<texcode><br />
\node[rectangle callout, draw]<br />
</texcode><br />
into<br />
<texcode><br />
\node[cloud callout, draw]<br />
</texcode><br />
to get other bubble shapes.<br />
<br />
[[Category:Graphics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Overlays&diff=32557Overlays2021-05-19T04:37:40Z<p>Thangalin: /* Using */</p>
<hr />
<div>__TOC__<br />
<br />
Overlays are predefined snippets that you can stack on each other. In contrast to [[Layers|layers]], which regard whole pages, overlays mostly are only single pictures, words or the like.<br />
<br />
= Defining =<br />
<br />
<texcode><br />
\defineoverlay[reference name][commands]<br />
</texcode><br />
<br />
Better put your commands in braces.<br />
<br />
= Using =<br />
<br />
You can use defined overlays anywhere there is a <tt>background</tt> option.<br />
<br />
<context source=yes><br />
\setupcolors[state=start]<br />
<br />
\defineoverlay[tea][{\green\ss\bf GREEN TEA}]<br />
<br />
\framed[<br />
background=tea, <br />
align={middle,hilo}<br />
]{<br />
\em today<br />
\blank[2*big]<br />
for sale<br />
}<br />
</context><br />
<br />
You can use this also with pictures. See also [[Logos|logos]].<br />
<br />
Another use for overlays is for adding a graphic to every page to indicate chapters (sometimes known as a [[Thumb index|thumb index]]).<br />
<br />
= Overlays vs. Layers =<br />
<br />
Overlays and Layers are different mechanisms, which are powerful when combined.<br />
<br />
== Overlays ==<br />
<br />
ConTeXt has an overlay environment that can be used in the text to stack the arguments on the same spot. In the example below, each new element is placed on top of the previous element.<br />
<br />
<context source=yes><br />
\setupbodyfont[40pt]<br />
<br />
\starttext<br />
<br />
\startoverlay<br />
{\strut\red m}<br />
{\strut\green a}<br />
{\strut\blue l}<br />
\stopoverlay<br />
<br />
\stoptext<br />
</context><br />
<br />
Without the \strut argument each argument is horizontally and vertically centered:<br />
<br />
<context source=yes><br />
\setupbodyfont[40pt]<br />
<br />
\starttext<br />
<br />
\startoverlay<br />
{\red m}<br />
{\green a}<br />
{\blue l}<br />
\stopoverlay<br />
<br />
\stoptext<br />
</context><br />
<br />
<br />
Overlays are created with the \defineoverlay command, which takes an overlay name and content. The overlays are then applied to a \framed command or the background to the page the textblock, header, and so forth.<br />
<br />
The next example shows two overlays (“behind” and “before”), which are activated in the frame with a background key.<br />
<br />
<context source=yes><br />
\starttext<br />
<br />
\defineoverlay[behind][{\blackrule[height=2cm,width=8cm,color=yellow]}]<br />
\defineoverlay[before][{\blackrule[height=8cm,width=2cm,color=orange]}]<br />
<br />
\framed<br />
[width=10cm,<br />
height=10cm,<br />
background={color,behind,foreground,before},<br />
backgroundcolor=red]<br />
{\blackrule[width=6cm,height=6cm,color=blue]}<br />
<br />
\stoptext<br />
</context><br />
<br />
The arguments of the background key used two names in addition to the “behind” and “before” overlays. The first name is “color”, which is needed when using the backgroundcolor key to put a color in the entire frame's area. The second is “foreground”, which can place overlays *before* the content of the frame because “foreground” is the frame text itself.<br />
<br />
The overlay environment and overlay mechanism for \framed are similar.<br />
<br />
The methods to set them because in the first case you set the content for each level which the argument in braces ({…}{…}) and in the second case you define them first with \defineoverlay and set the order in the background key.<br />
<br />
== Layers ==<br />
<br />
With layers the content from each command can be positioned at a certain horizontal and vertical position. The following example creates a new layer and set three texts. The texts are placed in the page using the \flushlayer command.<br />
<br />
<context source=yes><br />
\starttext<br />
<br />
\definelayer[test]<br />
<br />
\setlayer[test][x=3cm,y=6cm]{ONE}<br />
\setlayer[test][x=8cm,y=2cm]{TWO}<br />
\setlayer[test][x=2cm,y=9cm]{THREE}<br />
<br />
\flushlayer[test]<br />
<br />
\stoptext<br />
</context><br />
<br />
When you put new some text after \flushlayer would be surprised because it would end put on the following page but you shouldn’t wonder about this because layers have nothing to do with the page background or foreground.<br />
<br />
What makes the layer and overlay mechanism is interesting is when you combine them and put the \flushlayer command in a overlay which does now place the texts before or after the content of a frame. With my next example we’re finally in the process to combine them.<br />
<br />
<context source=yes><br />
\setupbodyfont[30pt]<br />
<br />
\starttext<br />
<br />
\definelayer[behindtext]<br />
\definelayer[beforetext]<br />
<br />
\setupbackgrounds[text][background={behindtext,foreground,beforetext}]<br />
<br />
\setlayer[behindtext][x=-2cm,y=.75ex]{\red Behind}<br />
\setlayer[beforetext][x=+2cm,y=.75ex]{\yellow Before}<br />
<br />
The Text!<br />
<br />
\setlayer[behindtext][x=5cm,y=4cm]{\red More background text!}<br />
\setlayer[beforetext][x=3cm,y=8cm]{\yellow More foreground text!}<br />
<br />
\stoptext<br />
</context><br />
<br />
When you look at the example you can see that haven't created a overlay for layer even though I said you need it to put the layer after the text. This isn’t necessary because when you create a new layer context does also create a overlay with the same name in which the layer is placed. The other question is how you can place overlays on the text/page when I told before overalls can only be placed on frame, this is possible because all page elements (textblock, header, footer and even the page and paper itself) are frames. Even though these elements are frames they don’t provide all the options from \framed because they are a special version with less functionality.<br />
<br />
= See Also =<br />
<br />
* [[:Category:Command/Overlays]]<br />
<br />
[[Category:Graphics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Makeup&diff=32548Makeup2021-05-07T01:20:11Z<p>Thangalin: /* Description */</p>
<hr />
<div>== Description ==<br />
<br />
A makeup has a special layout, allowing for custom and temporary header & footer sections. Pages that need not rely on the current page layout style typically include covers, colophons, or similar. There is one standard makeup page, but you can define more if needed.<br />
<br />
== Examples ==<br />
<br />
There are a few ways to invoke a custom makeup:<br />
<br />
<texcode><br />
\definemakeup[custom][align=middle]<br />
\starttext<br />
\startmakeup[custom]<br />
This is a title page.<br />
\stopmakeup<br />
<br />
\input zapf<br />
\stoptext<br />
</texcode><br />
<br />
And another:<br />
<br />
<texcode><br />
\definemakeup[custom][align=middle]<br />
\starttext<br />
\startcustommakeup<br />
This is a title page.<br />
\stopcustommakeup<br />
<br />
\input zapf<br />
\stoptext<br />
</texcode><br />
<br />
By default, makeups lack both header and footers. They are vertically centered and horizontally aligned to the left..<br />
<br />
== Vertical Aligment ==<br />
<br />
Makeups are centered vertically by default.<br />
<br />
The way to align them vertically to the top or to the bottom is the following:<br />
<br />
<texcode><br />
\setuppapersize[A6]<br />
\starttext<br />
\startstandardmakeup[top=,]<br />
This is vertically aligned to the top.<br />
\stopstandardmakeup<br />
<br />
\startstandardmakeup[bottom=,]<br />
This is vertically aligned to the bottom.<br />
\stopstandardmakeup<br />
<br />
\startstandardmakeup<br />
This is the default: vertically centered.<br />
\stopstandardmakeup<br />
\stoptext<br />
</texcode><br />
<br />
Horizontal aligment is specified with the <code>align</code> option.<br />
<br />
== See Also ==<br />
<br />
* {{cmd|setupmakeup}}<br />
* http://wiki.contextgarden.net/Command/setupmakeup<br />
* http://www.ntg.nl/pipermail/ntg-context/2010/049662.html<br />
* http://www.ntg.nl/pipermail/ntg-context/2010/051896.html<br />
<br />
[[Category:Basics]]<br />
[[Category:Layout]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Indentation&diff=32531Indentation2021-04-16T06:30:53Z<p>Thangalin: </p>
<hr />
<div>In plain TeX, controlling indentation is accomplished by configuring <tt>parindent</tt>, and each new paragraph is indented by that value, unless explicitly begun with <tt>noindent</tt>. Environments can provide a <tt>noindent</tt> at the end of their definitions, and if the user wants to overrule that, he can add an explicit <tt>indent</tt> at the beginning of the next paragraph. For the most part, LaTeX follows the same convention.<br />
<br />
Indentation in ConTeXt is a bit different: it mostly does not rely on the presence of blank lines, but uses {{cmd|setupindenting}} to manage general indentation, the <code>indentnext=yes/no/auto</code> key on environments to enable/disable indentation after them, and {{cmd|indentation}} and {{cmd|noindentation}} to manually force/disable an indentation. <br />
<br />
The commands {{cmd|indent}}, {{cmd|noindent}}, {{cmd|indenting}}, and {{cmd|noindenting}} are present for historical reasons, but should not be used. Especially, they should not be confused with {{cmd|indentation}} and {{cmd|noindentation}}<br />
<br />
== Setting up indentation for the whole document ==<br />
<br />
Indentation involves two things: when to indent, and how much to indent. In ConTeXt, these can be specified using {{cmd|setupindenting}}<tt>[...]</tt>. There are three types of keys for this command:<br />
<br />
* <code>''no'' yes</code>: turn indentation on/off'<br />
* <code>''none'' small medium big ''dimension''</code>: size of indents<br />
* <code>''first'' next</code>: turn indentation of first paragraph on/off. Can be overridden by environments with <code>indentnext=yes/no/auto</code>.<br />
* <code>odd even</code>: indent odd/even lines in \obeylines scopes<br />
* <code>normal</code>: the globally defined size of indent. Useful when used as the values of the `indenting` key of different environments.<br />
<br />
== Setting up indentation after an environment ==<br />
<br />
{{cmd|setupindenting}} does not take care of indenting after environments, such as ConTeXt's itemizes, enumerations, definitions, formulas and floats. It also does not take care of indenting after heads such as chapters, sections, and subsections. <br />
<br />
The setup command of these environments provides an '''<code>indentnext</code>''' key to configure the indentation behaviour after the environment. The <code>indentnext</code> key can take one of three values: <br />
* <code>yes</code> declares the first paragraph following the environment should always be indented.<br />
* <code>no</code> declares the first paragraph following the environment should never be indented.<br />
* <code>auto</code> declares <code>indentnext=auto</code> the next paragraph should be indented only if there is a blank space after the environment. Setting <code>indentnext=auto</code> is equivalent to the default plain TeX and LaTeX behaviour. <br />
<br />
Some examples:<br />
<texcode><br />
% Do not indent paragraphs after \stopitemize<br />
\setupitemgroup[itemize][indentnext=no]<br />
<br />
% indent paragraphs after section heads<br />
\setuphead[section][indentnext=yes]<br />
<br />
% indent the paragraphs after all sectioning heads <br />
\setupheads[indentnext=yes] <br />
<br />
% indent paragraphs after formulas if there is a blank space in between<br />
\setupformulas[indentnext=auto] <br />
</texcode><br />
<br />
== Setting up indentation inside environments ==<br />
<br />
There is one case that is not taken care of by {{cmd|setupindenting}} and the <code>indentnext</code> key: indentation of paragraphs inside multi-paragraph environments such as itemizes, descriptions, and enumerations. By default ConTeXt does not indent such paragraphs. The setup commands of these environments provides an <code>indenting=</code> key to configure the indentation behaviour of paragraphs inside these environments. This key takes the same arguments as the {{cmd|setupindenting}} command does. An example using {{cmd|setupitemgroup}}:<br />
<br />
<context source="yes" text="gives"><br />
\setuppapersize[A5]<br />
<br />
\setupindenting[medium,yes]<br />
\setupitemgroup[itemize][indenting={40pt,next}]<br />
\startitemize<br />
\item This is an example of a multi|-|paragraph <br />
item inside an itemize environment.<br />
<br />
This second paragraph is indented by 40pt<br />
(double the normal indentation).<br />
\stopitemize<br />
</context><br />
<br />
== "indentnext=auto" demo ==<br />
<br />
<context source = "yes" text="gives:"><br />
\setupindenting[medium,yes]<br />
\setupitemize[indentnext=auto]<br />
<br />
\startitemize<br />
\item One<br />
\stopitemize<br />
<br />
This paragraph should be indented - due to the blank line after \type{\stopitemize}.<br />
<br />
\startitemize<br />
\item Two<br />
\stopitemize<br />
This paragraph should not be indented.<br />
</context><br />
<br />
== Manual indentation ==<br />
<br />
No matter how careful we are with all the settings, there are some cases which cannot be taken care of by automatic indentation, and we have to tell ConTeXt how to indent. This is done with {{cmd|indentation}} and {{cmd|noindentation}}. The Plain TeX (and LaTeX) commands <tt>\indent</tt> and <tt>\noindent</tt> are defined in ConTeXt, but are not hooked into the indentation mechanism.<br />
<br />
Suppose the default setup for an article is<br />
<texcode><br />
\setupitemgroup [itemize] [indentnext=no]<br />
</texcode><br />
<br />
Now, if we want to indent after an itemize, starting the next paragraph with {{cmd|indent}} does not work; to get indentation we have to say {{cmd|indentation}}. For example,<br />
<br />
<context source="yes" text="gives"><br />
\setuppapersize[A5]<br />
<br />
\setupindenting [big,yes]<br />
\setupitemgroup [itemize] [indentnext=no]<br />
<br />
\startitemize[n]<br />
\item A dummy list with \type{indentnext=no}...<br />
\item ...to test the \tex{indent} command<br />
\stopitemize<br />
<br />
\indent This paragraph is not indented, because \tex{indent} does not work.<br />
<br />
\startitemize[n]<br />
\item Another dummy list with \type{indentnext=no}...<br />
\item ...to test the \tex{indentation} command<br />
\stopitemize<br />
<br />
\indentation This paragraph will be indented, because we used \tex{indentation}.<br />
</context><br />
<br />
<br />
[[Category:Basics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Indentation&diff=32530Indentation2021-04-16T06:30:06Z<p>Thangalin: </p>
<hr />
<div>In plain TeX, controlling indentation is accomplished by configuring <tt>parindent</tt>, and each new paragraph is indented by that value, unless explicitly begun with <tt>noindent</tt>. Environments can provide a <tt>noindent</tt> at the end of their definitions, and if the user wants to overrule that, he can add an explicit <tt>indent</tt> at the beginning of the next paragraph. For the most part, LaTeX follows the same convention.<br />
<br />
Indentation in ConTeXt are a bit different: it mostly does not rely on the presence of blank lines, but uses {{cmd|setupindenting}} to manage general indentation, the <code>indentnext=yes/no/auto</code> key on environments to enable/disable indentation after them, and {{cmd|indentation}} and {{cmd|noindentation}} to manually force/disable an indentation. <br />
<br />
The commands {{cmd|indent}}, {{cmd|noindent}}, {{cmd|indenting}}, and {{cmd|noindenting}} are present for historical reasons, but should not be used. Especially, they should not be confused with {{cmd|indentation}} and {{cmd|noindentation}}<br />
<br />
== Setting up indentation for the whole document ==<br />
<br />
Indentation involves two things: when to indent, and how much to indent. In ConTeXt, these can be specified using {{cmd|setupindenting}}<tt>[...]</tt>. There are three types of keys for this command:<br />
<br />
* <code>''no'' yes</code>: turn indentation on/off'<br />
* <code>''none'' small medium big ''dimension''</code>: size of indents<br />
* <code>''first'' next</code>: turn indentation of first paragraph on/off. Can be overridden by environments with <code>indentnext=yes/no/auto</code>.<br />
* <code>odd even</code>: indent odd/even lines in \obeylines scopes<br />
* <code>normal</code>: the globally defined size of indent. Useful when used as the values of the `indenting` key of different environments.<br />
<br />
== Setting up indentation after an environment ==<br />
<br />
{{cmd|setupindenting}} does not take care of indenting after environments, such as ConTeXt's itemizes, enumerations, definitions, formulas and floats. It also does not take care of indenting after heads such as chapters, sections, and subsections. <br />
<br />
The setup command of these environments provides an '''<code>indentnext</code>''' key to configure the indentation behaviour after the environment. The <code>indentnext</code> key can take one of three values: <br />
* <code>yes</code> declares the first paragraph following the environment should always be indented.<br />
* <code>no</code> declares the first paragraph following the environment should never be indented.<br />
* <code>auto</code> declares <code>indentnext=auto</code> the next paragraph should be indented only if there is a blank space after the environment. Setting <code>indentnext=auto</code> is equivalent to the default plain TeX and LaTeX behaviour. <br />
<br />
Some examples:<br />
<texcode><br />
% Do not indent paragraphs after \stopitemize<br />
\setupitemgroup[itemize][indentnext=no]<br />
<br />
% indent paragraphs after section heads<br />
\setuphead[section][indentnext=yes]<br />
<br />
% indent the paragraphs after all sectioning heads <br />
\setupheads[indentnext=yes] <br />
<br />
% indent paragraphs after formulas if there is a blank space in between<br />
\setupformulas[indentnext=auto] <br />
</texcode><br />
<br />
== Setting up indentation inside environments ==<br />
<br />
There is one case that is not taken care of by {{cmd|setupindenting}} and the <code>indentnext</code> key: indentation of paragraphs inside multi-paragraph environments such as itemizes, descriptions, and enumerations. By default ConTeXt does not indent such paragraphs. The setup commands of these environments provides an <code>indenting=</code> key to configure the indentation behaviour of paragraphs inside these environments. This key takes the same arguments as the {{cmd|setupindenting}} command does. An example using {{cmd|setupitemgroup}}:<br />
<br />
<context source="yes" text="gives"><br />
\setuppapersize[A5]<br />
<br />
\setupindenting[medium,yes]<br />
\setupitemgroup[itemize][indenting={40pt,next}]<br />
\startitemize<br />
\item This is an example of a multi|-|paragraph <br />
item inside an itemize environment.<br />
<br />
This second paragraph is indented by 40pt<br />
(double the normal indentation).<br />
\stopitemize<br />
</context><br />
<br />
== "indentnext=auto" demo ==<br />
<br />
<context source = "yes" text="gives:"><br />
\setupindenting[medium,yes]<br />
\setupitemize[indentnext=auto]<br />
<br />
\startitemize<br />
\item One<br />
\stopitemize<br />
<br />
This paragraph should be indented - due to the blank line after \type{\stopitemize}.<br />
<br />
\startitemize<br />
\item Two<br />
\stopitemize<br />
This paragraph should not be indented.<br />
</context><br />
<br />
== Manual indentation ==<br />
<br />
No matter how careful we are with all the settings, there are some cases which cannot be taken care of by automatic indentation, and we have to tell ConTeXt how to indent. This is done with {{cmd|indentation}} and {{cmd|noindentation}}. The Plain TeX (and LaTeX) commands <tt>\indent</tt> and <tt>\noindent</tt> are defined in ConTeXt, but are not hooked into the indentation mechanism.<br />
<br />
Suppose the default setup for an article is<br />
<texcode><br />
\setupitemgroup [itemize] [indentnext=no]<br />
</texcode><br />
<br />
Now, if we want to indent after an itemize, starting the next paragraph with {{cmd|indent}} does not work; to get indentation we have to say {{cmd|indentation}}. For example,<br />
<br />
<context source="yes" text="gives"><br />
\setuppapersize[A5]<br />
<br />
\setupindenting [big,yes]<br />
\setupitemgroup [itemize] [indentnext=no]<br />
<br />
\startitemize[n]<br />
\item A dummy list with \type{indentnext=no}...<br />
\item ...to test the \tex{indent} command<br />
\stopitemize<br />
<br />
\indent This paragraph is not indented, because \tex{indent} does not work.<br />
<br />
\startitemize[n]<br />
\item Another dummy list with \type{indentnext=no}...<br />
\item ...to test the \tex{indentation} command<br />
\stopitemize<br />
<br />
\indentation This paragraph will be indented, because we used \tex{indentation}.<br />
</context><br />
<br />
<br />
[[Category:Basics]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Custom_Configuration&diff=32527Custom Configuration2021-04-06T21:15:22Z<p>Thangalin: /* Environment Variables */</p>
<hr />
<div>< [[Installation hints]]<br />
<br />
== Overview ==<br />
<br />
This page describes how to configure and persist changes to default settings, including directory paths. For the purposes of this wiki page, it is assumed that ConTeXt is installed at:<br />
<br />
/opt/context<br />
<br />
== Default Variables ==<br />
<br />
The file <tt>/opt/context/tex/texmf/web2c/texmfcnf.lua</tt> contains a number of variables, including:<br />
<br />
TEXMFCACHE<br />
TEXMFOS<br />
TEXMFCONTEXT<br />
<br />
Do not change this file as upgrading ConTeXt overwrites these files. To customize <tt>texmf.cnf</tt>, change the variables as noted in the following section.<br />
<br />
== Custom Variables ==<br />
<br />
Modify a variable as follows:<br />
<br />
# Change to the location of <tt>setuptex</tt> (e.g., <tt>/opt/context/tex/</tt>).<br />
# Create a new file called <tt>texmfcnf.lua</tt> (or <tt>texmf.cnf</tt>).<br />
# Set only the required variables.<br />
<br />
For example, to change the cache directory, use:<br />
<br />
return {<br />
content = {<br />
variables = {<br />
TEXMFCACHE = "/var/cache/context/texmf-cache",<br />
},<br />
},<br />
}<br />
<br />
Save the file.<br />
<br />
The allowed locations for <tt>texmfcnf.lua</tt> are determined by the variable `TEXMFCNF` set in<br />
<tt>texk/kpathsea/texmf.cnf</tt> in the LuaTeX source code.<br />
<br />
Most options in <tt>texmf.cnf</tt> of modern TeX distributions also work with ConTeXt.<br />
<br />
== Environment Variables ==<br />
<br />
By default, ConTeXt creates a directory named <tt>luatex-cache</tt> in the user's home directory. One way to change the cache location includes:<br />
<br />
export TEXMFCACHE=/tmp<br />
mtxrun --generate<br />
context filename.tex<br />
<br />
Another way is to run the <tt>context</tt> executable indirectly via <tt>mtxrun</tt>, as follows:<br />
<br />
export TEXMFCACHE=/tmp<br />
mtxrun --autogenerate --script mtx-context filename.tex<br />
<br />
Running ConTeXt in either of these ways will create <tt>luatex-cache</tt> inside the <tt>/tmp</tt> directory, rather than the user's home directory.<br />
<br />
== Security Concerns ==<br />
<br />
ConTeXt requires enabling the `write18` function to run [[MetaPost]] and other tools. This implies that malicious TeX code can run any program with user rights. The function is ''disabled'' by default. This can be enabled by changing the setting inside <tt>texmf.cnf</tt>:<br />
<br />
shell_escape = t<br />
<br />
For MikTeX users, the counterpart to <tt>texmf.cnf</tt> was <tt>miktex.ini</tt>, now the config is [http://docs.miktex.org/2.9/manual/runtimeparams.html stored separately for each program]<br />
<br />
== File Priority ==<br />
<br />
The <tt>texmf.cnf</tt> files are read in the following order:<br />
<br />
# /opt/context/bin/x86_64-linux/texmf.cnf<br />
# /opt/context/bin/texmf.cnf<br />
# /opt/context/texmf.cnf<br />
# /opt/context/texmf/web2c/texmf.cnf<br />
<br />
Variables set in a particular file are ''not'' overwritten by files that are read later.<br />
<br />
The first configuration file listed is useful for system dependent configuration. On<br />
multi-platform installations you could create a file <tt>/opt/context/bin/win32/texmf.cnf</tt> on the server that contains:<br />
<br />
OSFONTDIR = $SystemRoot/Fonts<br />
<br />
and this only affects Windows clients, even if the third file contains the line:<br />
<br />
OSFONTDIR = /usr/share/fonts/<br />
<br />
[[Category:Installation]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Custom_Configuration&diff=32526Custom Configuration2021-04-06T21:14:17Z<p>Thangalin: /* Environment Variables */</p>
<hr />
<div>< [[Installation hints]]<br />
<br />
== Overview ==<br />
<br />
This page describes how to configure and persist changes to default settings, including directory paths. For the purposes of this wiki page, it is assumed that ConTeXt is installed at:<br />
<br />
/opt/context<br />
<br />
== Default Variables ==<br />
<br />
The file <tt>/opt/context/tex/texmf/web2c/texmfcnf.lua</tt> contains a number of variables, including:<br />
<br />
TEXMFCACHE<br />
TEXMFOS<br />
TEXMFCONTEXT<br />
<br />
Do not change this file as upgrading ConTeXt overwrites these files. To customize <tt>texmf.cnf</tt>, change the variables as noted in the following section.<br />
<br />
== Custom Variables ==<br />
<br />
Modify a variable as follows:<br />
<br />
# Change to the location of <tt>setuptex</tt> (e.g., <tt>/opt/context/tex/</tt>).<br />
# Create a new file called <tt>texmfcnf.lua</tt> (or <tt>texmf.cnf</tt>).<br />
# Set only the required variables.<br />
<br />
For example, to change the cache directory, use:<br />
<br />
return {<br />
content = {<br />
variables = {<br />
TEXMFCACHE = "/var/cache/context/texmf-cache",<br />
},<br />
},<br />
}<br />
<br />
Save the file.<br />
<br />
The allowed locations for <tt>texmfcnf.lua</tt> are determined by the variable `TEXMFCNF` set in<br />
<tt>texk/kpathsea/texmf.cnf</tt> in the LuaTeX source code.<br />
<br />
Most options in <tt>texmf.cnf</tt> of modern TeX distributions also work with ConTeXt.<br />
<br />
== Environment Variables ==<br />
<br />
By default, ConTeXt creates a directory named <tt>luatex-cache</tt> in the user's home directory. One way to change the cache location includes:<br />
<br />
export TEXMFCACHE=/tmp<br />
mtxrun --generate<br />
context filename.tex<br />
<br />
Another way is to run the <tt>context</tt> executable indirectly via <tt>mtxrun</tt>, as follows:<br />
<br />
export TEXMFCACHE=/tmp<br />
mtxrun --autogenerate --script mtx-context filename.tex<br />
<br />
Either if these options will create <tt>luatex-cache</tt> inside the <tt>/tmp</tt> directory, rather than the user's home directory.<br />
<br />
== Security Concerns ==<br />
<br />
ConTeXt requires enabling the `write18` function to run [[MetaPost]] and other tools. This implies that malicious TeX code can run any program with user rights. The function is ''disabled'' by default. This can be enabled by changing the setting inside <tt>texmf.cnf</tt>:<br />
<br />
shell_escape = t<br />
<br />
For MikTeX users, the counterpart to <tt>texmf.cnf</tt> was <tt>miktex.ini</tt>, now the config is [http://docs.miktex.org/2.9/manual/runtimeparams.html stored separately for each program]<br />
<br />
== File Priority ==<br />
<br />
The <tt>texmf.cnf</tt> files are read in the following order:<br />
<br />
# /opt/context/bin/x86_64-linux/texmf.cnf<br />
# /opt/context/bin/texmf.cnf<br />
# /opt/context/texmf.cnf<br />
# /opt/context/texmf/web2c/texmf.cnf<br />
<br />
Variables set in a particular file are ''not'' overwritten by files that are read later.<br />
<br />
The first configuration file listed is useful for system dependent configuration. On<br />
multi-platform installations you could create a file <tt>/opt/context/bin/win32/texmf.cnf</tt> on the server that contains:<br />
<br />
OSFONTDIR = $SystemRoot/Fonts<br />
<br />
and this only affects Windows clients, even if the third file contains the line:<br />
<br />
OSFONTDIR = /usr/share/fonts/<br />
<br />
[[Category:Installation]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Custom_Configuration&diff=32525Custom Configuration2021-04-06T21:13:43Z<p>Thangalin: /* Environment Variables */</p>
<hr />
<div>< [[Installation hints]]<br />
<br />
== Overview ==<br />
<br />
This page describes how to configure and persist changes to default settings, including directory paths. For the purposes of this wiki page, it is assumed that ConTeXt is installed at:<br />
<br />
/opt/context<br />
<br />
== Default Variables ==<br />
<br />
The file <tt>/opt/context/tex/texmf/web2c/texmfcnf.lua</tt> contains a number of variables, including:<br />
<br />
TEXMFCACHE<br />
TEXMFOS<br />
TEXMFCONTEXT<br />
<br />
Do not change this file as upgrading ConTeXt overwrites these files. To customize <tt>texmf.cnf</tt>, change the variables as noted in the following section.<br />
<br />
== Custom Variables ==<br />
<br />
Modify a variable as follows:<br />
<br />
# Change to the location of <tt>setuptex</tt> (e.g., <tt>/opt/context/tex/</tt>).<br />
# Create a new file called <tt>texmfcnf.lua</tt> (or <tt>texmf.cnf</tt>).<br />
# Set only the required variables.<br />
<br />
For example, to change the cache directory, use:<br />
<br />
return {<br />
content = {<br />
variables = {<br />
TEXMFCACHE = "/var/cache/context/texmf-cache",<br />
},<br />
},<br />
}<br />
<br />
Save the file.<br />
<br />
The allowed locations for <tt>texmfcnf.lua</tt> are determined by the variable `TEXMFCNF` set in<br />
<tt>texk/kpathsea/texmf.cnf</tt> in the LuaTeX source code.<br />
<br />
Most options in <tt>texmf.cnf</tt> of modern TeX distributions also work with ConTeXt.<br />
<br />
== Environment Variables ==<br />
<br />
By default, ConTeXt creates a directory named <tt>luatex-cache</tt> in the user's home directory. One way to change the cache location includes:<br />
<br />
export TEXMFCACHE=/tmp<br />
mtxrun --generate<br />
context filename.tex<br />
<br />
Another way is to run the <tt>context</tt> executable indirectly via <tt>mtxrun</tt>, as follows:<br />
<br />
export TEXMFCACHE=/tmp<br />
mtxrun --autogenerate --script mtx-context ... filename.tex<br />
<br />
Either if these options will create <tt>luatex-cache</tt> inside the <tt>/tmp</tt> directory, rather than the user's home directory.<br />
<br />
== Security Concerns ==<br />
<br />
ConTeXt requires enabling the `write18` function to run [[MetaPost]] and other tools. This implies that malicious TeX code can run any program with user rights. The function is ''disabled'' by default. This can be enabled by changing the setting inside <tt>texmf.cnf</tt>:<br />
<br />
shell_escape = t<br />
<br />
For MikTeX users, the counterpart to <tt>texmf.cnf</tt> was <tt>miktex.ini</tt>, now the config is [http://docs.miktex.org/2.9/manual/runtimeparams.html stored separately for each program]<br />
<br />
== File Priority ==<br />
<br />
The <tt>texmf.cnf</tt> files are read in the following order:<br />
<br />
# /opt/context/bin/x86_64-linux/texmf.cnf<br />
# /opt/context/bin/texmf.cnf<br />
# /opt/context/texmf.cnf<br />
# /opt/context/texmf/web2c/texmf.cnf<br />
<br />
Variables set in a particular file are ''not'' overwritten by files that are read later.<br />
<br />
The first configuration file listed is useful for system dependent configuration. On<br />
multi-platform installations you could create a file <tt>/opt/context/bin/win32/texmf.cnf</tt> on the server that contains:<br />
<br />
OSFONTDIR = $SystemRoot/Fonts<br />
<br />
and this only affects Windows clients, even if the third file contains the line:<br />
<br />
OSFONTDIR = /usr/share/fonts/<br />
<br />
[[Category:Installation]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Custom_Configuration&diff=32524Custom Configuration2021-04-06T21:13:05Z<p>Thangalin: </p>
<hr />
<div>< [[Installation hints]]<br />
<br />
== Overview ==<br />
<br />
This page describes how to configure and persist changes to default settings, including directory paths. For the purposes of this wiki page, it is assumed that ConTeXt is installed at:<br />
<br />
/opt/context<br />
<br />
== Default Variables ==<br />
<br />
The file <tt>/opt/context/tex/texmf/web2c/texmfcnf.lua</tt> contains a number of variables, including:<br />
<br />
TEXMFCACHE<br />
TEXMFOS<br />
TEXMFCONTEXT<br />
<br />
Do not change this file as upgrading ConTeXt overwrites these files. To customize <tt>texmf.cnf</tt>, change the variables as noted in the following section.<br />
<br />
== Custom Variables ==<br />
<br />
Modify a variable as follows:<br />
<br />
# Change to the location of <tt>setuptex</tt> (e.g., <tt>/opt/context/tex/</tt>).<br />
# Create a new file called <tt>texmfcnf.lua</tt> (or <tt>texmf.cnf</tt>).<br />
# Set only the required variables.<br />
<br />
For example, to change the cache directory, use:<br />
<br />
return {<br />
content = {<br />
variables = {<br />
TEXMFCACHE = "/var/cache/context/texmf-cache",<br />
},<br />
},<br />
}<br />
<br />
Save the file.<br />
<br />
The allowed locations for <tt>texmfcnf.lua</tt> are determined by the variable `TEXMFCNF` set in<br />
<tt>texk/kpathsea/texmf.cnf</tt> in the LuaTeX source code.<br />
<br />
Most options in <tt>texmf.cnf</tt> of modern TeX distributions also work with ConTeXt.<br />
<br />
== Environment Variables ==<br />
<br />
By default, ConTeXt creates a directory named <tt>luatex-cache</tt> in the user's home directory. One way to change the cache location includes:<br />
<br />
export TEXMFCACHE=/tmp<br />
mtxrun --generate<br />
context filename.tex<br />
<br />
Another way is to run ConTeXt indirectly, as follows:<br />
<br />
export TEXMFCACHE=/tmp<br />
mtxrun --autogenerate --script mtx-context ... filename.tex<br />
<br />
Either if these options will create <tt>luatex-cache</tt> inside the <tt>/tmp</tt> directory, rather than the user's home directory.<br />
<br />
== Security Concerns ==<br />
<br />
ConTeXt requires enabling the `write18` function to run [[MetaPost]] and other tools. This implies that malicious TeX code can run any program with user rights. The function is ''disabled'' by default. This can be enabled by changing the setting inside <tt>texmf.cnf</tt>:<br />
<br />
shell_escape = t<br />
<br />
For MikTeX users, the counterpart to <tt>texmf.cnf</tt> was <tt>miktex.ini</tt>, now the config is [http://docs.miktex.org/2.9/manual/runtimeparams.html stored separately for each program]<br />
<br />
== File Priority ==<br />
<br />
The <tt>texmf.cnf</tt> files are read in the following order:<br />
<br />
# /opt/context/bin/x86_64-linux/texmf.cnf<br />
# /opt/context/bin/texmf.cnf<br />
# /opt/context/texmf.cnf<br />
# /opt/context/texmf/web2c/texmf.cnf<br />
<br />
Variables set in a particular file are ''not'' overwritten by files that are read later.<br />
<br />
The first configuration file listed is useful for system dependent configuration. On<br />
multi-platform installations you could create a file <tt>/opt/context/bin/win32/texmf.cnf</tt> on the server that contains:<br />
<br />
OSFONTDIR = $SystemRoot/Fonts<br />
<br />
and this only affects Windows clients, even if the third file contains the line:<br />
<br />
OSFONTDIR = /usr/share/fonts/<br />
<br />
[[Category:Installation]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=XML&diff=32522XML2021-04-04T19:43:43Z<p>Thangalin: /* XML/ConTeXt in general */</p>
<hr />
<div>__TOC__<br />
<br />
Handling XML in ConTeXt has improved dramatically with the advent of MkIV. A new infrastructure, based on Lua, makes typesetting, manipulating, filtering, and reusing XML much much easier than before. Unfortunately, this means that most of the existing documentation is now obsolete. In general, the "old" MkII code uses upper-case <tt>XML</tt> in its commands, the new MkIV code uses lower-case <tt>xml</tt>. <br />
<br />
=Documents about XML in MkIV=<br />
<br />
==General Information==<br />
<br />
* [[manual:xml-mkiv.pdf|XML in MkIV]]<br />
* [[manual:math-mkiv.pdf|MathML in MkIV]]<br />
* [[TEI_xml| TEI xml]]: typesetting editions encoded in TEI xml<br />
* [[DocBook]]<br />
* [[Formatting Objects|Formatting XML Objects]]<br />
* [[Verbatim_XML | Verbatim/VIM in XML]]<br />
* [[xtables#XML | Processing XML tables as Extreme Tables]]<br />
* [http://dl.contextgarden.net/myway/tas/xhtml.pdf XHTML in MkIV]<br />
* [[Ctx| Processing of Ctx XML files]] <br />
<br />
==Processing XML with lua==<br />
* [[XML_Lua| XML in Lua]] (manipulating xml in Lua)<br />
<br />
==XHTML in MKIV==<br />
* [http://dl.contextgarden.net/myway/tas/xhtml.pdf Thomas' MyWay on processing XHTML with MKIV]<br />
<br />
<br />
=Documents about XML in MkII (obsolete)=<br />
<br />
==XML/ConTeXt in general==<br />
* [[manual:example.pdf|XML in ConTeXt]] by Pragma (2001)<br />
* [https://tug.org/TUGboat/tb24-3/pepping.pdf XML DocBook in ConTeXt] by Simon Pepping<br />
* [http://getfo.sourceforge.net/context_xml/index.html XML ConTeXt] by Paul Tremblay<br />
* [http://www.pragma-ade.com/show-mag-9.htm Dealing with XML] by Pragma (about XML, XSLT and typesetting without TeX code)<br />
* XML Basics: [[Mixing_XML_and_ConTeXt]] using the pre-defined ContML vocabulary<br />
<br />
==Additions and Details of XML/ConTeXt==<br />
* [[manual:xfigures-p.pdf|Figures (XML image databases)]] ([[manual:xfigures-s.pdf|screen]]) by Pragma (2001); see [[Image Database]]<br />
* [[Two pass tag processing example]] (float and figure tags)<br />
* [[manual:xsteps-p.pdf|Steps (XML step charts)]] ([[manual:xsteps-s.pdf|screen]]) by Pragma (2001)<br />
* [[manual:xxmldir.pdf|XML DIR (directory and file access)]] by Pragma<br />
* [[Interface.rnc]], the Relax NG schema of texshow-web<br />
* [[manual:xmanipulate.pdf|Preprocessing Source Files / Manipulating Graphic Resources]] by Pragma<br />
** a simple [[ctx|.ctx example]] of processing xml files<br />
* [[manual:xcorresp.pdf|Serial Letters]] (using a XML database) by Pragma (2003)<br />
<br />
==eXaMpLe framework== <br />
(batch processing)<br />
* [[manual:ex-ample.pdf|Example Interface]] (empty)<br />
* [[manual:ex-gui.pdf|Example GUI]]<br />
* [[manual:ex-imple.pdf|Eximple Toolkit]] (simple subset of Example)<br />
<br />
==MathML==<br />
* [[manual:pre-mml.pdf|MathML Intro presentation]] by Pragma<br />
* [[manual:mmlprime.pdf|MathML manual]] by Pragma (2001)<br />
* [[manual:mmlexamp.pdf|MathML in ConTeXt]] by Pragma (2001)<br />
* [[manual:xmathml-p.pdf|MathML support]] ([[manual:xmathml-s.pdf|screen]]) by Pragma (2001)<br />
* [[manual:xchemml-p.pdf|ChemML (MathML extension for chemistry)]] ([[manual:xchemml-s.pdf|screen]]) by Pragma<br />
* [[manual:xphysml-p.pdf|PhysML (MathML extension for physics)]] ([[manual:xphysml-s.pdf|screen]]) by Pragma<br />
<br />
==XSL/FO==<br />
* XSL/FO: [[Formatting Objects]]<br />
* [[ConTeXt FO and XML]] is a tutorial with a view to presenting ConTeXt from the XSL-FO mindset.<br />
<br />
[[Category:XML]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Running_ConTeXt&diff=32521Running ConTeXt2021-03-31T02:12:21Z<p>Thangalin: /* --path=list */</p>
<hr />
<div>The [[First Document]] page provides a cursory introduction to typesetting document using ConTeXt. The [[Context]] page describes the command-line options in brief. This page provides additional information for command-line options.<br />
<br />
== --run ==<br />
<br />
Process one or more files; this is the default action and may be omitted.<br />
<br />
== --autopdf ==<br />
<br />
Reopen the generated PDF file in the system's default PDF file viewer after recompiling a document.<br />
<br />
== --purgeall ==<br />
<br />
Delete all build artifacts generated during compiling of a document, such as ''.tuc'' and ''.log'' files.<br />
<br />
== --path=list ==<br />
<br />
Provide a comma-separated list of paths for ConTeXt to search when processing. For example:<br />
<br />
context --path="$HOME/writing/common/styles,$HOME/writing/amazing-novel/styles"<br />
<br />
== --result ==<br />
<br />
Changes the output document file name. ConTeXt creates the output document file in the current working directory; this option cannot create or move the output document in a different directory. Instead, change the working directory before running ConTeXt and use the ''--path'' option to configure where ConTeXt searches for files to process.<br />
<br />
<br />
<br />
[[Category:Basics]]<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Running_ConTeXt&diff=32520Running ConTeXt2021-03-31T02:11:13Z<p>Thangalin: </p>
<hr />
<div>The [[First Document]] page provides a cursory introduction to typesetting document using ConTeXt. The [[Context]] page describes the command-line options in brief. This page provides additional information for command-line options.<br />
<br />
== --run ==<br />
<br />
Process one or more files; this is the default action and may be omitted.<br />
<br />
== --autopdf ==<br />
<br />
Reopen the generated PDF file in the system's default PDF file viewer after recompiling a document.<br />
<br />
== --purgeall ==<br />
<br />
Delete all build artifacts generated during compiling of a document, such as ''.tuc'' and ''.log'' files.<br />
<br />
== --path=list ==<br />
<br />
Provide a list of paths for ConTeXt to search when processing.<br />
<br />
== --result ==<br />
<br />
Changes the output document file name. ConTeXt creates the output document file in the current working directory; this option cannot create or move the output document in a different directory. Instead, change the working directory before running ConTeXt and use the ''--path'' option to configure where ConTeXt searches for files to process.<br />
<br />
<br />
<br />
[[Category:Basics]]<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Context&diff=32519Context2021-03-31T01:43:14Z<p>Thangalin: </p>
<hr />
<div>The '''`context`''' script has the following main uses:<br />
<br />
* compiling ConTeXt MkIV documents; and<br />
* recompiling the ConTeXt core format after changing a source file.<br />
<br />
It is one of ConTeXt's four command-line scripts, together with `[[Mtxrun]]` for running general ('meta-TeX') helper scripts, `[[First-setup]]` for installation and updating, and `[[texexec]]` for compiling MkII documents.<br />
<br />
== Compiling ==<br />
<br />
To compile a document `myfile.tex`, simply pass it as an argument to `context`:<br />
<br />
context ''myfile.tex''<br />
<br />
== Lists ==<br />
<br />
Tables in the following sections may reference a "list" parameter to the command-line option. In such cases, the value may be a comma-separated list enclosed in straight single- or double-quotes. For example:<br />
<br />
context --environment="setups,styles,classes" ''myfile.tex''<br />
<br />
== Basic options ==<br />
<br />
The following table lists common command-line options:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --run <br />
| process (one or more) files (default action)<br />
|-<br />
| --make <br />
| create context formats<br />
|-<br />
| --ctx=name <br />
| use ctx file (process management specification)<br />
|-<br />
| --noctx <br />
| ignore ctx directives and flags<br />
|-<br />
| --interface <br />
| use specified user interface (default: en)<br />
|-<br />
| --autopdf <br />
| close pdf file in viewer and start pdf viewer afterwards<br />
|-<br />
| --purge <br />
| purge files either or not after a run (--pattern=...)<br />
|-<br />
| --purgeall <br />
| purge all files either or not after a run (--pattern=...)<br />
|-<br />
| --usemodule=list <br />
| load the given module or style, normally part of the distribution<br />
|-<br />
| --environment=list <br />
| load the given environment file first (document styles)<br />
|-<br />
| --mode=list <br />
| enable given the modes (conditional processing in styles)<br />
|-<br />
| --path=list <br />
| also consult the given paths when files are looked for<br />
|-<br />
| --arguments=list <br />
| set variables that can be consulted during a run (key/value pairs)<br />
|-<br />
| --randomseed=number <br />
| set the randomseed<br />
|-<br />
| --result=name <br />
| rename the resulting output to the given name<br />
|-<br />
| --trackers=list <br />
| set tracker variables (show list with --showtrackers)<br />
|-<br />
| --directives=list <br />
| set directive variables (show list with --showdirectives)<br />
|-<br />
| --silent=list <br />
| disable logcatgories (show list with --showlogcategories)<br />
|-<br />
| --strip <br />
| strip Lua code (only meant for production where no errors are expected)<br />
|-<br />
| --errors=list <br />
| show errors at the end of a run, quit when in list (also when --silent)<br />
|-<br />
| --htmlerrorpage <br />
| generate html error page instead (optional: =scite)<br />
|-<br />
| --noconsole <br />
| disable logging to the console (logfile only)<br />
|-<br />
| --nodummy <br />
| don't create a dummy file (can confuse pdf viewers that keep file in view)<br />
|-<br />
| --purgeresult <br />
| purge result file before run<br />
|-<br />
| --forcexml <br />
| force xml stub<br />
|-<br />
| --forcecld <br />
| force cld (context lua document) stub<br />
|-<br />
| --forcelua <br />
| force lua stub (like texlua)<br />
|-<br />
| --forcemp <br />
| force mp stub<br />
|-<br />
| --arrange <br />
| run extra imposition pass, given that the style sets up imposition<br />
|-<br />
| --noarrange <br />
| ignore imposition specifications in the style<br />
|-<br />
| --pages <br />
| report pagenumbers of names pages and list references (--page=... or --page=...)<br />
|-<br />
| --jit <br />
| use luajittex with jit turned off (only use the faster virtual machine)<br />
|-<br />
| --jiton <br />
| use luajittex with jit turned on (in most cases not faster, even slower)<br />
|-<br />
| --once <br />
| only run once (no multipass data file is produced)<br />
|-<br />
| --runs <br />
| process at most this many times<br />
|-<br />
| --forcedruns <br />
| process this many times (permits for optimization trial runs)<br />
|-<br />
| --batchmode <br />
| run without stopping and do not show messages on the console<br />
|-<br />
| --nonstopmode <br />
| run without stopping<br />
|-<br />
| --nosynctex <br />
| never initializes synctex (for production runs)<br />
|-<br />
| --synctex <br />
| run with synctex enabled (better use \setupsynctex[state=start]<br />
|-<br />
| --nodates <br />
| omit runtime dates in pdf file (optional value: a number (this 1970 offset time) or string "YYYY-MM-DD HH:MM")<br />
|-<br />
| --nocompression <br />
| forcefully turns off compression in the backend<br />
|-<br />
| --trailerid <br />
| alternative trailer id (or constant one)<br />
|-<br />
| --generate <br />
| generate file database etc. (as luatools does)<br />
|-<br />
| --paranoid <br />
| do not descend to .. and ../..<br />
|-<br />
| --version <br />
| report installed context version<br />
|-<br />
| --global <br />
| assume given file present elsewhere<br />
|-<br />
| --nofile <br />
| use dummy file as jobname<br />
|}<br />
<br />
== Expert options ==<br />
<br />
The following table lists additional command-line options:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --touch<br />
| update context version number (also provide --expert, optionally provide --basepath)<br />
|-<br />
| --nostatistics<br />
| omit runtime statistics at the end of the run<br />
|-<br />
| --profile<br />
| profile job (use: mtxrun --script profile --analyze)<br />
|-<br />
| --timing<br />
| generate timing and statistics overview<br />
|-<br />
| --keeptuc<br />
| keep previous tuc files (jobname-tuc-[run].tmp)<br />
|-<br />
| --keeplog<br />
| keep previous log files (jobname-log-[run].tmp)<br />
|-<br />
| --lmtx<br />
| force lmtx mode (when available)<br />
|-<br />
| --overloadmode=error,warning,0--6,255<br />
| enable csname overload checking<br />
|}<br />
<br />
== Special options ==<br />
<br />
The following table lists command-line options that are not commonly used:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --pdftex<br />
| process file with texexec using pdftex<br />
|-<br />
| --xetex<br />
| process file with texexec using xetex<br />
|-<br />
| --mkii<br />
| process file with texexec<br />
|-<br />
| --pipe<br />
| do not check for file and enter scroll mode (--dummyfile=whatever.tmp)<br />
|-<br />
| --sandbox<br />
| process file in a limited environment<br />
|-<br />
| --addbinarypath<br />
| prepend the (found) binarypath to runners<br />
|}<br />
<br />
== Remaking the format ==<br />
<br />
When you change one of ConTeXt's core files – as a temporary patch, or to try out something new, or for whatever reason – the change won't take effect immediately. Instead, you must first recompile ConTeXt, a process known as '(re)making the format'. In fact, ConTeXt has several formats: the English-language interface is a separate format from the English or the Persian one. <br />
<br />
To make all formats:<br />
<br />
context --make<br />
<br />
To make just the format for a single interface language:<br />
<br />
context --make cont-en # English<br />
context --make cont-uk # British English<br />
context --make cont-de # German<br />
context --make cont-fr # French<br />
context --make cont-nl # Dutch<br />
context --make cont-cs # Czech<br />
context --make cont-it # Italian<br />
context --make cont-ro # Romanian<br />
context --make cont-pe # Farsi (Persian)<br />
<br />
<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Context&diff=32518Context2021-03-31T01:38:47Z<p>Thangalin: /* Basic options */</p>
<hr />
<div>The '''`context`''' script has two main uses: (1) compiling ConTeXt MkIV documents, and (2) recompiling the ConTeXt core format after you change one of the source files. It is one of ConTeXt's four command-line scripts, together with `[[Mtxrun]]` for running general ('meta-TeX') helper scripts, `[[First-setup]]` for installation and updating, and `[[texexec]]` for compiling MkII documents.<br />
<br />
== Compiling ==<br />
<br />
To compile a document `myfile.tex`, simply pass it as an argument to `context`:<br />
<br />
context ''myfile.tex''<br />
<br />
== Remaking the format ==<br />
<br />
When you change one of ConTeXt's core files – as a temporary patch, or to try out something new, or for whatever reason – the change won't take effect immediately. Instead, you must first recompile ConTeXt, a process known as '(re)making the format'. In fact, ConTeXt has several formats: the English-language interface is a separate format from the English or the Persian one. <br />
<br />
To make all formats:<br />
<br />
context --make<br />
<br />
To make just the format for a single interface language:<br />
<br />
context --make cont-en # English<br />
context --make cont-uk # British English<br />
context --make cont-de # German<br />
context --make cont-fr # French<br />
context --make cont-nl # Dutch<br />
context --make cont-cs # Czech<br />
context --make cont-it # Italian<br />
context --make cont-ro # Romanian<br />
context --make cont-pe # Farsi (Persian)<br />
<br />
<br />
== Basic options ==<br />
<br />
The following table lists common command-line arguments:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --run <br />
| process (one or more) files (default action)<br />
|-<br />
| --make <br />
| create context formats<br />
|-<br />
| --ctx=name <br />
| use ctx file (process management specification)<br />
|-<br />
| --noctx <br />
| ignore ctx directives and flags<br />
|-<br />
| --interface <br />
| use specified user interface (default: en)<br />
|-<br />
| --autopdf <br />
| close pdf file in viewer and start pdf viewer afterwards<br />
|-<br />
| --purge <br />
| purge files either or not after a run (--pattern=...)<br />
|-<br />
| --purgeall <br />
| purge all files either or not after a run (--pattern=...)<br />
|-<br />
| --usemodule=list <br />
| load the given module or style, normally part of the distribution<br />
|-<br />
| --environment=list <br />
| load the given environment file first (document styles)<br />
|-<br />
| --mode=list <br />
| enable given the modes (conditional processing in styles)<br />
|-<br />
| --path=list <br />
| also consult the given paths when files are looked for<br />
|-<br />
| --arguments=list <br />
| set variables that can be consulted during a run (key/value pairs)<br />
|-<br />
| --randomseed=number <br />
| set the randomseed<br />
|-<br />
| --result=name <br />
| rename the resulting output to the given name<br />
|-<br />
| --trackers=list <br />
| set tracker variables (show list with --showtrackers)<br />
|-<br />
| --directives=list <br />
| set directive variables (show list with --showdirectives)<br />
|-<br />
| --silent=list <br />
| disable logcatgories (show list with --showlogcategories)<br />
|-<br />
| --strip <br />
| strip Lua code (only meant for production where no errors are expected)<br />
|-<br />
| --errors=list <br />
| show errors at the end of a run, quit when in list (also when --silent)<br />
|-<br />
| --htmlerrorpage <br />
| generate html error page instead (optional: =scite)<br />
|-<br />
| --noconsole <br />
| disable logging to the console (logfile only)<br />
|-<br />
| --nodummy <br />
| don't create a dummy file (can confuse pdf viewers that keep file in view)<br />
|-<br />
| --purgeresult <br />
| purge result file before run<br />
|-<br />
| --forcexml <br />
| force xml stub<br />
|-<br />
| --forcecld <br />
| force cld (context lua document) stub<br />
|-<br />
| --forcelua <br />
| force lua stub (like texlua)<br />
|-<br />
| --forcemp <br />
| force mp stub<br />
|-<br />
| --arrange <br />
| run extra imposition pass, given that the style sets up imposition<br />
|-<br />
| --noarrange <br />
| ignore imposition specifications in the style<br />
|-<br />
| --pages <br />
| report pagenumbers of names pages and list references (--page=... or --page=...)<br />
|-<br />
| --jit <br />
| use luajittex with jit turned off (only use the faster virtual machine)<br />
|-<br />
| --jiton <br />
| use luajittex with jit turned on (in most cases not faster, even slower)<br />
|-<br />
| --once <br />
| only run once (no multipass data file is produced)<br />
|-<br />
| --runs <br />
| process at most this many times<br />
|-<br />
| --forcedruns <br />
| process this many times (permits for optimization trial runs)<br />
|-<br />
| --batchmode <br />
| run without stopping and do not show messages on the console<br />
|-<br />
| --nonstopmode <br />
| run without stopping<br />
|-<br />
| --nosynctex <br />
| never initializes synctex (for production runs)<br />
|-<br />
| --synctex <br />
| run with synctex enabled (better use \setupsynctex[state=start]<br />
|-<br />
| --nodates <br />
| omit runtime dates in pdf file (optional value: a number (this 1970 offset time) or string "YYYY-MM-DD HH:MM")<br />
|-<br />
| --nocompression <br />
| forcefully turns off compression in the backend<br />
|-<br />
| --trailerid <br />
| alternative trailer id (or constant one)<br />
|-<br />
| --generate <br />
| generate file database etc. (as luatools does)<br />
|-<br />
| --paranoid <br />
| do not descend to .. and ../..<br />
|-<br />
| --version <br />
| report installed context version<br />
|-<br />
| --global <br />
| assume given file present elsewhere<br />
|-<br />
| --nofile <br />
| use dummy file as jobname<br />
|}<br />
<br />
== Expert options ==<br />
<br />
The following table lists addtional command-line arguments:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --touch<br />
| update context version number (also provide --expert, optionally provide --basepath)<br />
|-<br />
| --nostatistics<br />
| omit runtime statistics at the end of the run<br />
|-<br />
| --profile<br />
| profile job (use: mtxrun --script profile --analyze)<br />
|-<br />
| --timing<br />
| generate timing and statistics overview<br />
|-<br />
| --keeptuc<br />
| keep previous tuc files (jobname-tuc-[run].tmp)<br />
|-<br />
| --keeplog<br />
| keep previous log files (jobname-log-[run].tmp)<br />
|-<br />
| --lmtx<br />
| force lmtx mode (when available)<br />
|-<br />
| --overloadmode=error,warning,0--6,255<br />
| enable csname overload checking<br />
|}<br />
<br />
== Special options ==<br />
<br />
The following table lists command-line arguments that are not commonly used:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --pdftex<br />
| process file with texexec using pdftex<br />
|-<br />
| --xetex<br />
| process file with texexec using xetex<br />
|-<br />
| --mkii<br />
| process file with texexec<br />
|-<br />
| --pipe<br />
| do not check for file and enter scroll mode (--dummyfile=whatever.tmp)<br />
|-<br />
| --sandbox<br />
| process file in a limited environment<br />
|-<br />
| --addbinarypath<br />
| prepend the (found) binarypath to runners<br />
|}<br />
<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Context&diff=32517Context2021-03-31T01:38:29Z<p>Thangalin: /* Expert options */</p>
<hr />
<div>The '''`context`''' script has two main uses: (1) compiling ConTeXt MkIV documents, and (2) recompiling the ConTeXt core format after you change one of the source files. It is one of ConTeXt's four command-line scripts, together with `[[Mtxrun]]` for running general ('meta-TeX') helper scripts, `[[First-setup]]` for installation and updating, and `[[texexec]]` for compiling MkII documents.<br />
<br />
== Compiling ==<br />
<br />
To compile a document `myfile.tex`, simply pass it as an argument to `context`:<br />
<br />
context ''myfile.tex''<br />
<br />
== Remaking the format ==<br />
<br />
When you change one of ConTeXt's core files – as a temporary patch, or to try out something new, or for whatever reason – the change won't take effect immediately. Instead, you must first recompile ConTeXt, a process known as '(re)making the format'. In fact, ConTeXt has several formats: the English-language interface is a separate format from the English or the Persian one. <br />
<br />
To make all formats:<br />
<br />
context --make<br />
<br />
To make just the format for a single interface language:<br />
<br />
context --make cont-en # English<br />
context --make cont-uk # British English<br />
context --make cont-de # German<br />
context --make cont-fr # French<br />
context --make cont-nl # Dutch<br />
context --make cont-cs # Czech<br />
context --make cont-it # Italian<br />
context --make cont-ro # Romanian<br />
context --make cont-pe # Farsi (Persian)<br />
<br />
<br />
== Basic options ==<br />
<br />
The most common command-line arguments are listed in the following table:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --run <br />
| process (one or more) files (default action)<br />
|-<br />
| --make <br />
| create context formats<br />
|-<br />
| --ctx=name <br />
| use ctx file (process management specification)<br />
|-<br />
| --noctx <br />
| ignore ctx directives and flags<br />
|-<br />
| --interface <br />
| use specified user interface (default: en)<br />
|-<br />
| --autopdf <br />
| close pdf file in viewer and start pdf viewer afterwards<br />
|-<br />
| --purge <br />
| purge files either or not after a run (--pattern=...)<br />
|-<br />
| --purgeall <br />
| purge all files either or not after a run (--pattern=...)<br />
|-<br />
| --usemodule=list <br />
| load the given module or style, normally part of the distribution<br />
|-<br />
| --environment=list <br />
| load the given environment file first (document styles)<br />
|-<br />
| --mode=list <br />
| enable given the modes (conditional processing in styles)<br />
|-<br />
| --path=list <br />
| also consult the given paths when files are looked for<br />
|-<br />
| --arguments=list <br />
| set variables that can be consulted during a run (key/value pairs)<br />
|-<br />
| --randomseed=number <br />
| set the randomseed<br />
|-<br />
| --result=name <br />
| rename the resulting output to the given name<br />
|-<br />
| --trackers=list <br />
| set tracker variables (show list with --showtrackers)<br />
|-<br />
| --directives=list <br />
| set directive variables (show list with --showdirectives)<br />
|-<br />
| --silent=list <br />
| disable logcatgories (show list with --showlogcategories)<br />
|-<br />
| --strip <br />
| strip Lua code (only meant for production where no errors are expected)<br />
|-<br />
| --errors=list <br />
| show errors at the end of a run, quit when in list (also when --silent)<br />
|-<br />
| --htmlerrorpage <br />
| generate html error page instead (optional: =scite)<br />
|-<br />
| --noconsole <br />
| disable logging to the console (logfile only)<br />
|-<br />
| --nodummy <br />
| don't create a dummy file (can confuse pdf viewers that keep file in view)<br />
|-<br />
| --purgeresult <br />
| purge result file before run<br />
|-<br />
| --forcexml <br />
| force xml stub<br />
|-<br />
| --forcecld <br />
| force cld (context lua document) stub<br />
|-<br />
| --forcelua <br />
| force lua stub (like texlua)<br />
|-<br />
| --forcemp <br />
| force mp stub<br />
|-<br />
| --arrange <br />
| run extra imposition pass, given that the style sets up imposition<br />
|-<br />
| --noarrange <br />
| ignore imposition specifications in the style<br />
|-<br />
| --pages <br />
| report pagenumbers of names pages and list references (--page=... or --page=...)<br />
|-<br />
| --jit <br />
| use luajittex with jit turned off (only use the faster virtual machine)<br />
|-<br />
| --jiton <br />
| use luajittex with jit turned on (in most cases not faster, even slower)<br />
|-<br />
| --once <br />
| only run once (no multipass data file is produced)<br />
|-<br />
| --runs <br />
| process at most this many times<br />
|-<br />
| --forcedruns <br />
| process this many times (permits for optimization trial runs)<br />
|-<br />
| --batchmode <br />
| run without stopping and do not show messages on the console<br />
|-<br />
| --nonstopmode <br />
| run without stopping<br />
|-<br />
| --nosynctex <br />
| never initializes synctex (for production runs)<br />
|-<br />
| --synctex <br />
| run with synctex enabled (better use \setupsynctex[state=start]<br />
|-<br />
| --nodates <br />
| omit runtime dates in pdf file (optional value: a number (this 1970 offset time) or string "YYYY-MM-DD HH:MM")<br />
|-<br />
| --nocompression <br />
| forcefully turns off compression in the backend<br />
|-<br />
| --trailerid <br />
| alternative trailer id (or constant one)<br />
|-<br />
| --generate <br />
| generate file database etc. (as luatools does)<br />
|-<br />
| --paranoid <br />
| do not descend to .. and ../..<br />
|-<br />
| --version <br />
| report installed context version<br />
|-<br />
| --global <br />
| assume given file present elsewhere<br />
|-<br />
| --nofile <br />
| use dummy file as jobname<br />
|}<br />
<br />
== Expert options ==<br />
<br />
The following table lists addtional command-line arguments:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --touch<br />
| update context version number (also provide --expert, optionally provide --basepath)<br />
|-<br />
| --nostatistics<br />
| omit runtime statistics at the end of the run<br />
|-<br />
| --profile<br />
| profile job (use: mtxrun --script profile --analyze)<br />
|-<br />
| --timing<br />
| generate timing and statistics overview<br />
|-<br />
| --keeptuc<br />
| keep previous tuc files (jobname-tuc-[run].tmp)<br />
|-<br />
| --keeplog<br />
| keep previous log files (jobname-log-[run].tmp)<br />
|-<br />
| --lmtx<br />
| force lmtx mode (when available)<br />
|-<br />
| --overloadmode=error,warning,0--6,255<br />
| enable csname overload checking<br />
|}<br />
<br />
== Special options ==<br />
<br />
The following table lists command-line arguments that are not commonly used:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --pdftex<br />
| process file with texexec using pdftex<br />
|-<br />
| --xetex<br />
| process file with texexec using xetex<br />
|-<br />
| --mkii<br />
| process file with texexec<br />
|-<br />
| --pipe<br />
| do not check for file and enter scroll mode (--dummyfile=whatever.tmp)<br />
|-<br />
| --sandbox<br />
| process file in a limited environment<br />
|-<br />
| --addbinarypath<br />
| prepend the (found) binarypath to runners<br />
|}<br />
<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Context&diff=32516Context2021-03-31T01:38:14Z<p>Thangalin: /* Special options */</p>
<hr />
<div>The '''`context`''' script has two main uses: (1) compiling ConTeXt MkIV documents, and (2) recompiling the ConTeXt core format after you change one of the source files. It is one of ConTeXt's four command-line scripts, together with `[[Mtxrun]]` for running general ('meta-TeX') helper scripts, `[[First-setup]]` for installation and updating, and `[[texexec]]` for compiling MkII documents.<br />
<br />
== Compiling ==<br />
<br />
To compile a document `myfile.tex`, simply pass it as an argument to `context`:<br />
<br />
context ''myfile.tex''<br />
<br />
== Remaking the format ==<br />
<br />
When you change one of ConTeXt's core files – as a temporary patch, or to try out something new, or for whatever reason – the change won't take effect immediately. Instead, you must first recompile ConTeXt, a process known as '(re)making the format'. In fact, ConTeXt has several formats: the English-language interface is a separate format from the English or the Persian one. <br />
<br />
To make all formats:<br />
<br />
context --make<br />
<br />
To make just the format for a single interface language:<br />
<br />
context --make cont-en # English<br />
context --make cont-uk # British English<br />
context --make cont-de # German<br />
context --make cont-fr # French<br />
context --make cont-nl # Dutch<br />
context --make cont-cs # Czech<br />
context --make cont-it # Italian<br />
context --make cont-ro # Romanian<br />
context --make cont-pe # Farsi (Persian)<br />
<br />
<br />
== Basic options ==<br />
<br />
The most common command-line arguments are listed in the following table:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --run <br />
| process (one or more) files (default action)<br />
|-<br />
| --make <br />
| create context formats<br />
|-<br />
| --ctx=name <br />
| use ctx file (process management specification)<br />
|-<br />
| --noctx <br />
| ignore ctx directives and flags<br />
|-<br />
| --interface <br />
| use specified user interface (default: en)<br />
|-<br />
| --autopdf <br />
| close pdf file in viewer and start pdf viewer afterwards<br />
|-<br />
| --purge <br />
| purge files either or not after a run (--pattern=...)<br />
|-<br />
| --purgeall <br />
| purge all files either or not after a run (--pattern=...)<br />
|-<br />
| --usemodule=list <br />
| load the given module or style, normally part of the distribution<br />
|-<br />
| --environment=list <br />
| load the given environment file first (document styles)<br />
|-<br />
| --mode=list <br />
| enable given the modes (conditional processing in styles)<br />
|-<br />
| --path=list <br />
| also consult the given paths when files are looked for<br />
|-<br />
| --arguments=list <br />
| set variables that can be consulted during a run (key/value pairs)<br />
|-<br />
| --randomseed=number <br />
| set the randomseed<br />
|-<br />
| --result=name <br />
| rename the resulting output to the given name<br />
|-<br />
| --trackers=list <br />
| set tracker variables (show list with --showtrackers)<br />
|-<br />
| --directives=list <br />
| set directive variables (show list with --showdirectives)<br />
|-<br />
| --silent=list <br />
| disable logcatgories (show list with --showlogcategories)<br />
|-<br />
| --strip <br />
| strip Lua code (only meant for production where no errors are expected)<br />
|-<br />
| --errors=list <br />
| show errors at the end of a run, quit when in list (also when --silent)<br />
|-<br />
| --htmlerrorpage <br />
| generate html error page instead (optional: =scite)<br />
|-<br />
| --noconsole <br />
| disable logging to the console (logfile only)<br />
|-<br />
| --nodummy <br />
| don't create a dummy file (can confuse pdf viewers that keep file in view)<br />
|-<br />
| --purgeresult <br />
| purge result file before run<br />
|-<br />
| --forcexml <br />
| force xml stub<br />
|-<br />
| --forcecld <br />
| force cld (context lua document) stub<br />
|-<br />
| --forcelua <br />
| force lua stub (like texlua)<br />
|-<br />
| --forcemp <br />
| force mp stub<br />
|-<br />
| --arrange <br />
| run extra imposition pass, given that the style sets up imposition<br />
|-<br />
| --noarrange <br />
| ignore imposition specifications in the style<br />
|-<br />
| --pages <br />
| report pagenumbers of names pages and list references (--page=... or --page=...)<br />
|-<br />
| --jit <br />
| use luajittex with jit turned off (only use the faster virtual machine)<br />
|-<br />
| --jiton <br />
| use luajittex with jit turned on (in most cases not faster, even slower)<br />
|-<br />
| --once <br />
| only run once (no multipass data file is produced)<br />
|-<br />
| --runs <br />
| process at most this many times<br />
|-<br />
| --forcedruns <br />
| process this many times (permits for optimization trial runs)<br />
|-<br />
| --batchmode <br />
| run without stopping and do not show messages on the console<br />
|-<br />
| --nonstopmode <br />
| run without stopping<br />
|-<br />
| --nosynctex <br />
| never initializes synctex (for production runs)<br />
|-<br />
| --synctex <br />
| run with synctex enabled (better use \setupsynctex[state=start]<br />
|-<br />
| --nodates <br />
| omit runtime dates in pdf file (optional value: a number (this 1970 offset time) or string "YYYY-MM-DD HH:MM")<br />
|-<br />
| --nocompression <br />
| forcefully turns off compression in the backend<br />
|-<br />
| --trailerid <br />
| alternative trailer id (or constant one)<br />
|-<br />
| --generate <br />
| generate file database etc. (as luatools does)<br />
|-<br />
| --paranoid <br />
| do not descend to .. and ../..<br />
|-<br />
| --version <br />
| report installed context version<br />
|-<br />
| --global <br />
| assume given file present elsewhere<br />
|-<br />
| --nofile <br />
| use dummy file as jobname<br />
|}<br />
<br />
== Expert options ==<br />
<br />
Addtional command-line arguments are listed in the following table:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --touch<br />
| update context version number (also provide --expert, optionally provide --basepath)<br />
|-<br />
| --nostatistics<br />
| omit runtime statistics at the end of the run<br />
|-<br />
| --profile<br />
| profile job (use: mtxrun --script profile --analyze)<br />
|-<br />
| --timing<br />
| generate timing and statistics overview<br />
|-<br />
| --keeptuc<br />
| keep previous tuc files (jobname-tuc-[run].tmp)<br />
|-<br />
| --keeplog<br />
| keep previous log files (jobname-log-[run].tmp)<br />
|-<br />
| --lmtx<br />
| force lmtx mode (when available)<br />
|-<br />
| --overloadmode=error,warning,0--6,255<br />
| enable csname overload checking<br />
|}<br />
<br />
== Special options ==<br />
<br />
The following table lists command-line arguments that are not commonly used:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --pdftex<br />
| process file with texexec using pdftex<br />
|-<br />
| --xetex<br />
| process file with texexec using xetex<br />
|-<br />
| --mkii<br />
| process file with texexec<br />
|-<br />
| --pipe<br />
| do not check for file and enter scroll mode (--dummyfile=whatever.tmp)<br />
|-<br />
| --sandbox<br />
| process file in a limited environment<br />
|-<br />
| --addbinarypath<br />
| prepend the (found) binarypath to runners<br />
|}<br />
<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Context&diff=32515Context2021-03-31T01:37:19Z<p>Thangalin: /* Special options */</p>
<hr />
<div>The '''`context`''' script has two main uses: (1) compiling ConTeXt MkIV documents, and (2) recompiling the ConTeXt core format after you change one of the source files. It is one of ConTeXt's four command-line scripts, together with `[[Mtxrun]]` for running general ('meta-TeX') helper scripts, `[[First-setup]]` for installation and updating, and `[[texexec]]` for compiling MkII documents.<br />
<br />
== Compiling ==<br />
<br />
To compile a document `myfile.tex`, simply pass it as an argument to `context`:<br />
<br />
context ''myfile.tex''<br />
<br />
== Remaking the format ==<br />
<br />
When you change one of ConTeXt's core files – as a temporary patch, or to try out something new, or for whatever reason – the change won't take effect immediately. Instead, you must first recompile ConTeXt, a process known as '(re)making the format'. In fact, ConTeXt has several formats: the English-language interface is a separate format from the English or the Persian one. <br />
<br />
To make all formats:<br />
<br />
context --make<br />
<br />
To make just the format for a single interface language:<br />
<br />
context --make cont-en # English<br />
context --make cont-uk # British English<br />
context --make cont-de # German<br />
context --make cont-fr # French<br />
context --make cont-nl # Dutch<br />
context --make cont-cs # Czech<br />
context --make cont-it # Italian<br />
context --make cont-ro # Romanian<br />
context --make cont-pe # Farsi (Persian)<br />
<br />
<br />
== Basic options ==<br />
<br />
The most common command-line arguments are listed in the following table:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --run <br />
| process (one or more) files (default action)<br />
|-<br />
| --make <br />
| create context formats<br />
|-<br />
| --ctx=name <br />
| use ctx file (process management specification)<br />
|-<br />
| --noctx <br />
| ignore ctx directives and flags<br />
|-<br />
| --interface <br />
| use specified user interface (default: en)<br />
|-<br />
| --autopdf <br />
| close pdf file in viewer and start pdf viewer afterwards<br />
|-<br />
| --purge <br />
| purge files either or not after a run (--pattern=...)<br />
|-<br />
| --purgeall <br />
| purge all files either or not after a run (--pattern=...)<br />
|-<br />
| --usemodule=list <br />
| load the given module or style, normally part of the distribution<br />
|-<br />
| --environment=list <br />
| load the given environment file first (document styles)<br />
|-<br />
| --mode=list <br />
| enable given the modes (conditional processing in styles)<br />
|-<br />
| --path=list <br />
| also consult the given paths when files are looked for<br />
|-<br />
| --arguments=list <br />
| set variables that can be consulted during a run (key/value pairs)<br />
|-<br />
| --randomseed=number <br />
| set the randomseed<br />
|-<br />
| --result=name <br />
| rename the resulting output to the given name<br />
|-<br />
| --trackers=list <br />
| set tracker variables (show list with --showtrackers)<br />
|-<br />
| --directives=list <br />
| set directive variables (show list with --showdirectives)<br />
|-<br />
| --silent=list <br />
| disable logcatgories (show list with --showlogcategories)<br />
|-<br />
| --strip <br />
| strip Lua code (only meant for production where no errors are expected)<br />
|-<br />
| --errors=list <br />
| show errors at the end of a run, quit when in list (also when --silent)<br />
|-<br />
| --htmlerrorpage <br />
| generate html error page instead (optional: =scite)<br />
|-<br />
| --noconsole <br />
| disable logging to the console (logfile only)<br />
|-<br />
| --nodummy <br />
| don't create a dummy file (can confuse pdf viewers that keep file in view)<br />
|-<br />
| --purgeresult <br />
| purge result file before run<br />
|-<br />
| --forcexml <br />
| force xml stub<br />
|-<br />
| --forcecld <br />
| force cld (context lua document) stub<br />
|-<br />
| --forcelua <br />
| force lua stub (like texlua)<br />
|-<br />
| --forcemp <br />
| force mp stub<br />
|-<br />
| --arrange <br />
| run extra imposition pass, given that the style sets up imposition<br />
|-<br />
| --noarrange <br />
| ignore imposition specifications in the style<br />
|-<br />
| --pages <br />
| report pagenumbers of names pages and list references (--page=... or --page=...)<br />
|-<br />
| --jit <br />
| use luajittex with jit turned off (only use the faster virtual machine)<br />
|-<br />
| --jiton <br />
| use luajittex with jit turned on (in most cases not faster, even slower)<br />
|-<br />
| --once <br />
| only run once (no multipass data file is produced)<br />
|-<br />
| --runs <br />
| process at most this many times<br />
|-<br />
| --forcedruns <br />
| process this many times (permits for optimization trial runs)<br />
|-<br />
| --batchmode <br />
| run without stopping and do not show messages on the console<br />
|-<br />
| --nonstopmode <br />
| run without stopping<br />
|-<br />
| --nosynctex <br />
| never initializes synctex (for production runs)<br />
|-<br />
| --synctex <br />
| run with synctex enabled (better use \setupsynctex[state=start]<br />
|-<br />
| --nodates <br />
| omit runtime dates in pdf file (optional value: a number (this 1970 offset time) or string "YYYY-MM-DD HH:MM")<br />
|-<br />
| --nocompression <br />
| forcefully turns off compression in the backend<br />
|-<br />
| --trailerid <br />
| alternative trailer id (or constant one)<br />
|-<br />
| --generate <br />
| generate file database etc. (as luatools does)<br />
|-<br />
| --paranoid <br />
| do not descend to .. and ../..<br />
|-<br />
| --version <br />
| report installed context version<br />
|-<br />
| --global <br />
| assume given file present elsewhere<br />
|-<br />
| --nofile <br />
| use dummy file as jobname<br />
|}<br />
<br />
== Expert options ==<br />
<br />
Addtional command-line arguments are listed in the following table:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --touch<br />
| update context version number (also provide --expert, optionally provide --basepath)<br />
|-<br />
| --nostatistics<br />
| omit runtime statistics at the end of the run<br />
|-<br />
| --profile<br />
| profile job (use: mtxrun --script profile --analyze)<br />
|-<br />
| --timing<br />
| generate timing and statistics overview<br />
|-<br />
| --keeptuc<br />
| keep previous tuc files (jobname-tuc-[run].tmp)<br />
|-<br />
| --keeplog<br />
| keep previous log files (jobname-log-[run].tmp)<br />
|-<br />
| --lmtx<br />
| force lmtx mode (when available)<br />
|-<br />
| --overloadmode=error,warning,0--6,255<br />
| enable csname overload checking<br />
|}<br />
<br />
== Special options ==<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --pdftex<br />
| process file with texexec using pdftex<br />
|-<br />
| --xetex<br />
| process file with texexec using xetex<br />
|-<br />
| --mkii<br />
| process file with texexec<br />
|-<br />
| --pipe<br />
| do not check for file and enter scroll mode (--dummyfile=whatever.tmp)<br />
|-<br />
| --sandbox<br />
| process file in a limited environment<br />
|-<br />
| --addbinarypath<br />
| prepend the (found) binarypath to runners<br />
|}<br />
<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Context&diff=32514Context2021-03-31T01:35:57Z<p>Thangalin: /* Expert options */</p>
<hr />
<div>The '''`context`''' script has two main uses: (1) compiling ConTeXt MkIV documents, and (2) recompiling the ConTeXt core format after you change one of the source files. It is one of ConTeXt's four command-line scripts, together with `[[Mtxrun]]` for running general ('meta-TeX') helper scripts, `[[First-setup]]` for installation and updating, and `[[texexec]]` for compiling MkII documents.<br />
<br />
== Compiling ==<br />
<br />
To compile a document `myfile.tex`, simply pass it as an argument to `context`:<br />
<br />
context ''myfile.tex''<br />
<br />
== Remaking the format ==<br />
<br />
When you change one of ConTeXt's core files – as a temporary patch, or to try out something new, or for whatever reason – the change won't take effect immediately. Instead, you must first recompile ConTeXt, a process known as '(re)making the format'. In fact, ConTeXt has several formats: the English-language interface is a separate format from the English or the Persian one. <br />
<br />
To make all formats:<br />
<br />
context --make<br />
<br />
To make just the format for a single interface language:<br />
<br />
context --make cont-en # English<br />
context --make cont-uk # British English<br />
context --make cont-de # German<br />
context --make cont-fr # French<br />
context --make cont-nl # Dutch<br />
context --make cont-cs # Czech<br />
context --make cont-it # Italian<br />
context --make cont-ro # Romanian<br />
context --make cont-pe # Farsi (Persian)<br />
<br />
<br />
== Basic options ==<br />
<br />
The most common command-line arguments are listed in the following table:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --run <br />
| process (one or more) files (default action)<br />
|-<br />
| --make <br />
| create context formats<br />
|-<br />
| --ctx=name <br />
| use ctx file (process management specification)<br />
|-<br />
| --noctx <br />
| ignore ctx directives and flags<br />
|-<br />
| --interface <br />
| use specified user interface (default: en)<br />
|-<br />
| --autopdf <br />
| close pdf file in viewer and start pdf viewer afterwards<br />
|-<br />
| --purge <br />
| purge files either or not after a run (--pattern=...)<br />
|-<br />
| --purgeall <br />
| purge all files either or not after a run (--pattern=...)<br />
|-<br />
| --usemodule=list <br />
| load the given module or style, normally part of the distribution<br />
|-<br />
| --environment=list <br />
| load the given environment file first (document styles)<br />
|-<br />
| --mode=list <br />
| enable given the modes (conditional processing in styles)<br />
|-<br />
| --path=list <br />
| also consult the given paths when files are looked for<br />
|-<br />
| --arguments=list <br />
| set variables that can be consulted during a run (key/value pairs)<br />
|-<br />
| --randomseed=number <br />
| set the randomseed<br />
|-<br />
| --result=name <br />
| rename the resulting output to the given name<br />
|-<br />
| --trackers=list <br />
| set tracker variables (show list with --showtrackers)<br />
|-<br />
| --directives=list <br />
| set directive variables (show list with --showdirectives)<br />
|-<br />
| --silent=list <br />
| disable logcatgories (show list with --showlogcategories)<br />
|-<br />
| --strip <br />
| strip Lua code (only meant for production where no errors are expected)<br />
|-<br />
| --errors=list <br />
| show errors at the end of a run, quit when in list (also when --silent)<br />
|-<br />
| --htmlerrorpage <br />
| generate html error page instead (optional: =scite)<br />
|-<br />
| --noconsole <br />
| disable logging to the console (logfile only)<br />
|-<br />
| --nodummy <br />
| don't create a dummy file (can confuse pdf viewers that keep file in view)<br />
|-<br />
| --purgeresult <br />
| purge result file before run<br />
|-<br />
| --forcexml <br />
| force xml stub<br />
|-<br />
| --forcecld <br />
| force cld (context lua document) stub<br />
|-<br />
| --forcelua <br />
| force lua stub (like texlua)<br />
|-<br />
| --forcemp <br />
| force mp stub<br />
|-<br />
| --arrange <br />
| run extra imposition pass, given that the style sets up imposition<br />
|-<br />
| --noarrange <br />
| ignore imposition specifications in the style<br />
|-<br />
| --pages <br />
| report pagenumbers of names pages and list references (--page=... or --page=...)<br />
|-<br />
| --jit <br />
| use luajittex with jit turned off (only use the faster virtual machine)<br />
|-<br />
| --jiton <br />
| use luajittex with jit turned on (in most cases not faster, even slower)<br />
|-<br />
| --once <br />
| only run once (no multipass data file is produced)<br />
|-<br />
| --runs <br />
| process at most this many times<br />
|-<br />
| --forcedruns <br />
| process this many times (permits for optimization trial runs)<br />
|-<br />
| --batchmode <br />
| run without stopping and do not show messages on the console<br />
|-<br />
| --nonstopmode <br />
| run without stopping<br />
|-<br />
| --nosynctex <br />
| never initializes synctex (for production runs)<br />
|-<br />
| --synctex <br />
| run with synctex enabled (better use \setupsynctex[state=start]<br />
|-<br />
| --nodates <br />
| omit runtime dates in pdf file (optional value: a number (this 1970 offset time) or string "YYYY-MM-DD HH:MM")<br />
|-<br />
| --nocompression <br />
| forcefully turns off compression in the backend<br />
|-<br />
| --trailerid <br />
| alternative trailer id (or constant one)<br />
|-<br />
| --generate <br />
| generate file database etc. (as luatools does)<br />
|-<br />
| --paranoid <br />
| do not descend to .. and ../..<br />
|-<br />
| --version <br />
| report installed context version<br />
|-<br />
| --global <br />
| assume given file present elsewhere<br />
|-<br />
| --nofile <br />
| use dummy file as jobname<br />
|}<br />
<br />
== Expert options ==<br />
<br />
Addtional command-line arguments are listed in the following table:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --touch<br />
| update context version number (also provide --expert, optionally provide --basepath)<br />
|-<br />
| --nostatistics<br />
| omit runtime statistics at the end of the run<br />
|-<br />
| --profile<br />
| profile job (use: mtxrun --script profile --analyze)<br />
|-<br />
| --timing<br />
| generate timing and statistics overview<br />
|-<br />
| --keeptuc<br />
| keep previous tuc files (jobname-tuc-[run].tmp)<br />
|-<br />
| --keeplog<br />
| keep previous log files (jobname-log-[run].tmp)<br />
|-<br />
| --lmtx<br />
| force lmtx mode (when available)<br />
|-<br />
| --overloadmode=error,warning,0--6,255<br />
| enable csname overload checking<br />
|}<br />
<br />
== Special options ==<br />
<br />
--pdftex process file with texexec using pdftex<br />
--xetex process file with texexec using xetex<br />
--mkii process file with texexec<br />
--pipe do not check for file and enter scroll mode (--dummyfile=whatever.tmp)<br />
--sandbox process file in a limited environment<br />
--addbinarypath prepend the (found) binarypath to runners<br />
<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Context&diff=32513Context2021-03-31T01:31:34Z<p>Thangalin: /* Basic options */</p>
<hr />
<div>The '''`context`''' script has two main uses: (1) compiling ConTeXt MkIV documents, and (2) recompiling the ConTeXt core format after you change one of the source files. It is one of ConTeXt's four command-line scripts, together with `[[Mtxrun]]` for running general ('meta-TeX') helper scripts, `[[First-setup]]` for installation and updating, and `[[texexec]]` for compiling MkII documents.<br />
<br />
== Compiling ==<br />
<br />
To compile a document `myfile.tex`, simply pass it as an argument to `context`:<br />
<br />
context ''myfile.tex''<br />
<br />
== Remaking the format ==<br />
<br />
When you change one of ConTeXt's core files – as a temporary patch, or to try out something new, or for whatever reason – the change won't take effect immediately. Instead, you must first recompile ConTeXt, a process known as '(re)making the format'. In fact, ConTeXt has several formats: the English-language interface is a separate format from the English or the Persian one. <br />
<br />
To make all formats:<br />
<br />
context --make<br />
<br />
To make just the format for a single interface language:<br />
<br />
context --make cont-en # English<br />
context --make cont-uk # British English<br />
context --make cont-de # German<br />
context --make cont-fr # French<br />
context --make cont-nl # Dutch<br />
context --make cont-cs # Czech<br />
context --make cont-it # Italian<br />
context --make cont-ro # Romanian<br />
context --make cont-pe # Farsi (Persian)<br />
<br />
<br />
== Basic options ==<br />
<br />
The most common command-line arguments are listed in the following table:<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --run <br />
| process (one or more) files (default action)<br />
|-<br />
| --make <br />
| create context formats<br />
|-<br />
| --ctx=name <br />
| use ctx file (process management specification)<br />
|-<br />
| --noctx <br />
| ignore ctx directives and flags<br />
|-<br />
| --interface <br />
| use specified user interface (default: en)<br />
|-<br />
| --autopdf <br />
| close pdf file in viewer and start pdf viewer afterwards<br />
|-<br />
| --purge <br />
| purge files either or not after a run (--pattern=...)<br />
|-<br />
| --purgeall <br />
| purge all files either or not after a run (--pattern=...)<br />
|-<br />
| --usemodule=list <br />
| load the given module or style, normally part of the distribution<br />
|-<br />
| --environment=list <br />
| load the given environment file first (document styles)<br />
|-<br />
| --mode=list <br />
| enable given the modes (conditional processing in styles)<br />
|-<br />
| --path=list <br />
| also consult the given paths when files are looked for<br />
|-<br />
| --arguments=list <br />
| set variables that can be consulted during a run (key/value pairs)<br />
|-<br />
| --randomseed=number <br />
| set the randomseed<br />
|-<br />
| --result=name <br />
| rename the resulting output to the given name<br />
|-<br />
| --trackers=list <br />
| set tracker variables (show list with --showtrackers)<br />
|-<br />
| --directives=list <br />
| set directive variables (show list with --showdirectives)<br />
|-<br />
| --silent=list <br />
| disable logcatgories (show list with --showlogcategories)<br />
|-<br />
| --strip <br />
| strip Lua code (only meant for production where no errors are expected)<br />
|-<br />
| --errors=list <br />
| show errors at the end of a run, quit when in list (also when --silent)<br />
|-<br />
| --htmlerrorpage <br />
| generate html error page instead (optional: =scite)<br />
|-<br />
| --noconsole <br />
| disable logging to the console (logfile only)<br />
|-<br />
| --nodummy <br />
| don't create a dummy file (can confuse pdf viewers that keep file in view)<br />
|-<br />
| --purgeresult <br />
| purge result file before run<br />
|-<br />
| --forcexml <br />
| force xml stub<br />
|-<br />
| --forcecld <br />
| force cld (context lua document) stub<br />
|-<br />
| --forcelua <br />
| force lua stub (like texlua)<br />
|-<br />
| --forcemp <br />
| force mp stub<br />
|-<br />
| --arrange <br />
| run extra imposition pass, given that the style sets up imposition<br />
|-<br />
| --noarrange <br />
| ignore imposition specifications in the style<br />
|-<br />
| --pages <br />
| report pagenumbers of names pages and list references (--page=... or --page=...)<br />
|-<br />
| --jit <br />
| use luajittex with jit turned off (only use the faster virtual machine)<br />
|-<br />
| --jiton <br />
| use luajittex with jit turned on (in most cases not faster, even slower)<br />
|-<br />
| --once <br />
| only run once (no multipass data file is produced)<br />
|-<br />
| --runs <br />
| process at most this many times<br />
|-<br />
| --forcedruns <br />
| process this many times (permits for optimization trial runs)<br />
|-<br />
| --batchmode <br />
| run without stopping and do not show messages on the console<br />
|-<br />
| --nonstopmode <br />
| run without stopping<br />
|-<br />
| --nosynctex <br />
| never initializes synctex (for production runs)<br />
|-<br />
| --synctex <br />
| run with synctex enabled (better use \setupsynctex[state=start]<br />
|-<br />
| --nodates <br />
| omit runtime dates in pdf file (optional value: a number (this 1970 offset time) or string "YYYY-MM-DD HH:MM")<br />
|-<br />
| --nocompression <br />
| forcefully turns off compression in the backend<br />
|-<br />
| --trailerid <br />
| alternative trailer id (or constant one)<br />
|-<br />
| --generate <br />
| generate file database etc. (as luatools does)<br />
|-<br />
| --paranoid <br />
| do not descend to .. and ../..<br />
|-<br />
| --version <br />
| report installed context version<br />
|-<br />
| --global <br />
| assume given file present elsewhere<br />
|-<br />
| --nofile <br />
| use dummy file as jobname<br />
|}<br />
<br />
== Expert options ==<br />
<br />
--touch update context version number (also provide --expert, optionally provide --basepath)<br />
--nostatistics omit runtime statistics at the end of the run<br />
--profile profile job (use: mtxrun --script profile --analyze)<br />
--timing generate timing and statistics overview<br />
--keeptuc keep previous tuc files (jobname-tuc-[run].tmp)<br />
--keeplog keep previous log files (jobname-log-[run].tmp)<br />
--lmtx force lmtx mode (when available)<br />
--overloadmode=error|warning|0--6|255 enable csname overload checking<br />
<br />
== Special options ==<br />
<br />
--pdftex process file with texexec using pdftex<br />
--xetex process file with texexec using xetex<br />
--mkii process file with texexec<br />
--pipe do not check for file and enter scroll mode (--dummyfile=whatever.tmp)<br />
--sandbox process file in a limited environment<br />
--addbinarypath prepend the (found) binarypath to runners<br />
<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Context&diff=32512Context2021-03-31T01:30:42Z<p>Thangalin: /* Basic options */</p>
<hr />
<div>The '''`context`''' script has two main uses: (1) compiling ConTeXt MkIV documents, and (2) recompiling the ConTeXt core format after you change one of the source files. It is one of ConTeXt's four command-line scripts, together with `[[Mtxrun]]` for running general ('meta-TeX') helper scripts, `[[First-setup]]` for installation and updating, and `[[texexec]]` for compiling MkII documents.<br />
<br />
== Compiling ==<br />
<br />
To compile a document `myfile.tex`, simply pass it as an argument to `context`:<br />
<br />
context ''myfile.tex''<br />
<br />
== Remaking the format ==<br />
<br />
When you change one of ConTeXt's core files – as a temporary patch, or to try out something new, or for whatever reason – the change won't take effect immediately. Instead, you must first recompile ConTeXt, a process known as '(re)making the format'. In fact, ConTeXt has several formats: the English-language interface is a separate format from the English or the Persian one. <br />
<br />
To make all formats:<br />
<br />
context --make<br />
<br />
To make just the format for a single interface language:<br />
<br />
context --make cont-en # English<br />
context --make cont-uk # British English<br />
context --make cont-de # German<br />
context --make cont-fr # French<br />
context --make cont-nl # Dutch<br />
context --make cont-cs # Czech<br />
context --make cont-it # Italian<br />
context --make cont-ro # Romanian<br />
context --make cont-pe # Farsi (Persian)<br />
<br />
<br />
== Basic options ==<br />
<br />
{| class="wikitable"<br />
! Argument<br />
! Description<br />
|-<br />
| --run <br />
| process (one or more) files (default action)<br />
|-<br />
| --make <br />
| create context formats<br />
|-<br />
| --ctx=name <br />
| use ctx file (process management specification)<br />
|-<br />
| --noctx <br />
| ignore ctx directives and flags<br />
|-<br />
| --interface <br />
| use specified user interface (default: en)<br />
|-<br />
| --autopdf <br />
| close pdf file in viewer and start pdf viewer afterwards<br />
|-<br />
| --purge <br />
| purge files either or not after a run (--pattern=...)<br />
|-<br />
| --purgeall <br />
| purge all files either or not after a run (--pattern=...)<br />
|-<br />
| --usemodule=list <br />
| load the given module or style, normally part of the distribution<br />
|-<br />
| --environment=list <br />
| load the given environment file first (document styles)<br />
|-<br />
| --mode=list <br />
| enable given the modes (conditional processing in styles)<br />
|-<br />
| --path=list <br />
| also consult the given paths when files are looked for<br />
|-<br />
| --arguments=list <br />
| set variables that can be consulted during a run (key/value pairs)<br />
|-<br />
| --randomseed=number <br />
| set the randomseed<br />
|-<br />
| --result=name <br />
| rename the resulting output to the given name<br />
|-<br />
| --trackers=list <br />
| set tracker variables (show list with --showtrackers)<br />
|-<br />
| --directives=list <br />
| set directive variables (show list with --showdirectives)<br />
|-<br />
| --silent=list <br />
| disable logcatgories (show list with --showlogcategories)<br />
|-<br />
| --strip <br />
| strip Lua code (only meant for production where no errors are expected)<br />
|-<br />
| --errors=list <br />
| show errors at the end of a run, quit when in list (also when --silent)<br />
|-<br />
| --htmlerrorpage <br />
| generate html error page instead (optional: =scite)<br />
|-<br />
| --noconsole <br />
| disable logging to the console (logfile only)<br />
|-<br />
| --nodummy <br />
| don't create a dummy file (can confuse pdf viewers that keep file in view)<br />
|-<br />
| --purgeresult <br />
| purge result file before run<br />
|-<br />
| --forcexml <br />
| force xml stub<br />
|-<br />
| --forcecld <br />
| force cld (context lua document) stub<br />
|-<br />
| --forcelua <br />
| force lua stub (like texlua)<br />
|-<br />
| --forcemp <br />
| force mp stub<br />
|-<br />
| --arrange <br />
| run extra imposition pass, given that the style sets up imposition<br />
|-<br />
| --noarrange <br />
| ignore imposition specifications in the style<br />
|-<br />
| --pages <br />
| report pagenumbers of names pages and list references (--page=... or --page=...)<br />
|-<br />
| --jit <br />
| use luajittex with jit turned off (only use the faster virtual machine)<br />
|-<br />
| --jiton <br />
| use luajittex with jit turned on (in most cases not faster, even slower)<br />
|-<br />
| --once <br />
| only run once (no multipass data file is produced)<br />
|-<br />
| --runs <br />
| process at most this many times<br />
|-<br />
| --forcedruns <br />
| process this many times (permits for optimization trial runs)<br />
|-<br />
| --batchmode <br />
| run without stopping and do not show messages on the console<br />
|-<br />
| --nonstopmode <br />
| run without stopping<br />
|-<br />
| --nosynctex <br />
| never initializes synctex (for production runs)<br />
|-<br />
| --synctex <br />
| run with synctex enabled (better use \setupsynctex[state=start]<br />
|-<br />
| --nodates <br />
| omit runtime dates in pdf file (optional value: a number (this 1970 offset time) or string "YYYY-MM-DD HH:MM")<br />
|-<br />
| --nocompression <br />
| forcefully turns off compression in the backend<br />
|-<br />
| --trailerid <br />
| alternative trailer id (or constant one)<br />
|-<br />
| --generate <br />
| generate file database etc. (as luatools does)<br />
|-<br />
| --paranoid <br />
| do not descend to .. and ../..<br />
|-<br />
| --version <br />
| report installed context version<br />
|-<br />
| --global <br />
| assume given file present elsewhere<br />
|-<br />
| --nofile <br />
| use dummy file as jobname<br />
|}<br />
<br />
== Expert options ==<br />
<br />
--touch update context version number (also provide --expert, optionally provide --basepath)<br />
--nostatistics omit runtime statistics at the end of the run<br />
--profile profile job (use: mtxrun --script profile --analyze)<br />
--timing generate timing and statistics overview<br />
--keeptuc keep previous tuc files (jobname-tuc-[run].tmp)<br />
--keeplog keep previous log files (jobname-log-[run].tmp)<br />
--lmtx force lmtx mode (when available)<br />
--overloadmode=error|warning|0--6|255 enable csname overload checking<br />
<br />
== Special options ==<br />
<br />
--pdftex process file with texexec using pdftex<br />
--xetex process file with texexec using xetex<br />
--mkii process file with texexec<br />
--pipe do not check for file and enter scroll mode (--dummyfile=whatever.tmp)<br />
--sandbox process file in a limited environment<br />
--addbinarypath prepend the (found) binarypath to runners<br />
<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Context&diff=32511Context2021-03-31T01:20:57Z<p>Thangalin: /* All options */</p>
<hr />
<div>The '''`context`''' script has two main uses: (1) compiling ConTeXt MkIV documents, and (2) recompiling the ConTeXt core format after you change one of the source files. It is one of ConTeXt's four command-line scripts, together with `[[Mtxrun]]` for running general ('meta-TeX') helper scripts, `[[First-setup]]` for installation and updating, and `[[texexec]]` for compiling MkII documents.<br />
<br />
== Compiling ==<br />
<br />
To compile a document `myfile.tex`, simply pass it as an argument to `context`:<br />
<br />
context ''myfile.tex''<br />
<br />
== Remaking the format ==<br />
<br />
When you change one of ConTeXt's core files – as a temporary patch, or to try out something new, or for whatever reason – the change won't take effect immediately. Instead, you must first recompile ConTeXt, a process known as '(re)making the format'. In fact, ConTeXt has several formats: the English-language interface is a separate format from the English or the Persian one. <br />
<br />
To make all formats:<br />
<br />
context --make<br />
<br />
To make just the format for a single interface language:<br />
<br />
context --make cont-en # English<br />
context --make cont-uk # British English<br />
context --make cont-de # German<br />
context --make cont-fr # French<br />
context --make cont-nl # Dutch<br />
context --make cont-cs # Czech<br />
context --make cont-it # Italian<br />
context --make cont-ro # Romanian<br />
context --make cont-pe # Farsi (Persian)<br />
<br />
<br />
== Basic options ==<br />
<br />
--run process (one or more) files (default action)<br />
--make create context formats<br />
<br />
--ctx=name use ctx file (process management specification)<br />
--noctx ignore ctx directives and flags<br />
--interface use specified user interface (default: en)<br />
<br />
--autopdf close pdf file in viewer and start pdf viewer afterwards<br />
--purge purge files either or not after a run (--pattern=...)<br />
--purgeall purge all files either or not after a run (--pattern=...)<br />
<br />
--usemodule=list load the given module or style, normally part of the distribution<br />
--environment=list load the given environment file first (document styles)<br />
--mode=list enable given the modes (conditional processing in styles)<br />
--path=list also consult the given paths when files are looked for<br />
--arguments=list set variables that can be consulted during a run (key/value pairs)<br />
--randomseed=number set the randomseed<br />
--result=name rename the resulting output to the given name<br />
--trackers=list set tracker variables (show list with --showtrackers)<br />
--directives=list set directive variables (show list with --showdirectives)<br />
--silent=list disable logcatgories (show list with --showlogcategories)<br />
--strip strip Lua code (only meant for production where no errors are expected)<br />
--errors=list show errors at the end of a run, quit when in list (also when --silent)<br />
--htmlerrorpage generate html error page instead (optional: =scite)<br />
--noconsole disable logging to the console (logfile only)<br />
--nodummy don't create a dummy file (can confuse pdf viewers that keep file in view)<br />
--purgeresult purge result file before run<br />
<br />
--forcexml force xml stub<br />
--forcecld force cld (context lua document) stub<br />
--forcelua force lua stub (like texlua)<br />
--forcemp force mp stub<br />
<br />
--arrange run extra imposition pass, given that the style sets up imposition<br />
--noarrange ignore imposition specifications in the style<br />
<br />
--pages report pagenumbers of names pages and list references (--page=... or --page=...)<br />
<br />
--jit use luajittex with jit turned off (only use the faster virtual machine)<br />
--jiton use luajittex with jit turned on (in most cases not faster, even slower)<br />
<br />
--once only run once (no multipass data file is produced)<br />
--runs process at most this many times<br />
--forcedruns process this many times (permits for optimization trial runs)<br />
<br />
--batchmode run without stopping and do not show messages on the console<br />
--nonstopmode run without stopping<br />
<br />
--nosynctex never initializes synctex (for production runs)<br />
--synctex run with synctex enabled (better use \setupsynctex[state=start]<br />
<br />
--nodates omit runtime dates in pdf file (optional value: a number (this 1970 offset time) or string "YYYY-MM-DD HH:MM")<br />
--nocompression forcefully turns off compression in the backend<br />
--trailerid alternative trailer id (or constant one)<br />
<br />
--generate generate file database etc. (as luatools does)<br />
--paranoid do not descend to .. and ../..<br />
--version report installed context version<br />
<br />
--global assume given file present elsewhere<br />
--nofile use dummy file as jobname<br />
<br />
== Expert options ==<br />
<br />
--touch update context version number (also provide --expert, optionally provide --basepath)<br />
--nostatistics omit runtime statistics at the end of the run<br />
--profile profile job (use: mtxrun --script profile --analyze)<br />
--timing generate timing and statistics overview<br />
--keeptuc keep previous tuc files (jobname-tuc-[run].tmp)<br />
--keeplog keep previous log files (jobname-log-[run].tmp)<br />
--lmtx force lmtx mode (when available)<br />
--overloadmode=error|warning|0--6|255 enable csname overload checking<br />
<br />
== Special options ==<br />
<br />
--pdftex process file with texexec using pdftex<br />
--xetex process file with texexec using xetex<br />
--mkii process file with texexec<br />
--pipe do not check for file and enter scroll mode (--dummyfile=whatever.tmp)<br />
--sandbox process file in a limited environment<br />
--addbinarypath prepend the (found) binarypath to runners<br />
<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Context&diff=32510Context2021-03-31T01:16:50Z<p>Thangalin: </p>
<hr />
<div>The '''`context`''' script has two main uses: (1) compiling ConTeXt MkIV documents, and (2) recompiling the ConTeXt core format after you change one of the source files. It is one of ConTeXt's four command-line scripts, together with `[[Mtxrun]]` for running general ('meta-TeX') helper scripts, `[[First-setup]]` for installation and updating, and `[[texexec]]` for compiling MkII documents.<br />
<br />
== Compiling ==<br />
<br />
To compile a document `myfile.tex`, simply pass it as an argument to `context`:<br />
<br />
context ''myfile.tex''<br />
<br />
== Remaking the format ==<br />
<br />
When you change one of ConTeXt's core files – as a temporary patch, or to try out something new, or for whatever reason – the change won't take effect immediately. Instead, you must first recompile ConTeXt, a process known as '(re)making the format'. In fact, ConTeXt has several formats: the English-language interface is a separate format from the English or the Persian one. <br />
<br />
To make all formats:<br />
<br />
context --make<br />
<br />
To make just the format for a single interface language:<br />
<br />
context --make cont-en # English<br />
context --make cont-uk # British English<br />
context --make cont-de # German<br />
context --make cont-fr # French<br />
context --make cont-nl # Dutch<br />
context --make cont-cs # Czech<br />
context --make cont-it # Italian<br />
context --make cont-ro # Romanian<br />
context --make cont-pe # Farsi (Persian)<br />
<br />
<br />
== All options ==<br />
<br />
--run process (one or more) files (default action)<br />
--make create context formats<br />
<br />
--ctx=name use ctx file (process management specification)<br />
--interface use specified user interface (default: en)<br />
<br />
--autopdf close pdf file in viewer and start pdf viewer afterwards<br />
--purge(all) purge files either or not after a run (--pattern=...)<br />
<br />
--usemodule=list load the given module or style, normally part of the distribution<br />
--environment=list load the given environment file first (document styles)<br />
--mode=list enable given the modes (conditional processing in styles)<br />
--path=list also consult the given paths when files are looked for<br />
--arguments=list set variables that can be consulted during a run (key/value pairs)<br />
--randomseed=number set the randomseed<br />
--result=name rename the resulting output to the given name<br />
--trackers=list set tracker variables (show list with --showtrackers)<br />
--directives=list set directive variables (show list with --showdirectives)<br />
--silent=list disable logcatgories (show list with --showlogcategories)<br />
--nostatistics disable runtime statistics at the end of the run (--expert option)<br />
--noconsole disable logging to the console (logfile only)<br />
--purgeresult purge result file before run<br />
<br />
--forcexml force xml stub<br />
--forcecld force cld (context lua document) stub<br />
<br />
--arrange run extra imposition pass, given that the style sets up imposition<br />
--noarrange ignore imposition specifications in the style<br />
<br />
--once only run once (no multipass data file is produced)<br />
--batchmode run without stopping and don't show messages on the console<br />
--nonstopmode run without stopping<br />
<br />
--generate generate file database etc. (as luatools does)<br />
--paranoid don't descend to .. and ../..<br />
--version report installed context version<br />
<br />
--global assume given file present elsewhere<br />
--nofile use dummy file as jobname<br />
<br />
--help show this help<br />
--help --expert show help for expert options<br />
<br />
== Expert options ==<br />
<br />
--touch update context version number (also provide --expert, optionally provide --basepath)<br />
--nostatistics omit runtime statistics at the end of the run<br />
--profile profile job (use: mtxrun --script profile --analyze)<br />
--timing generate timing and statistics overview<br />
--keeptuc keep previous tuc files (jobname-tuc-[run].tmp)<br />
--keeplog keep previous log files (jobname-log-[run].tmp)<br />
--lmtx force lmtx mode (when available)<br />
--overloadmode=error|warning|0--6|255 enable csname overload checking<br />
<br />
== Special options ==<br />
<br />
--pdftex process file with texexec using pdftex<br />
--xetex process file with texexec using xetex<br />
--mkii process file with texexec<br />
--pipe do not check for file and enter scroll mode (--dummyfile=whatever.tmp)<br />
--sandbox process file in a limited environment<br />
--addbinarypath prepend the (found) binarypath to runners<br />
<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Running_ConTeXt&diff=32508Running ConTeXt2021-03-31T00:27:16Z<p>Thangalin: Thangalin moved page Run scripts to Running ConTeXt: Scripts are a good idea, but maybe outside purview of wiki (due to maintenance)</p>
<hr />
<div>While ConTeXt (i.e. mtxrun) already automates a lot, in bigger projects I find it tedious to call context with all its options all the time. One might use [https://www.gnu.org/software/make/ make] or [https://github.com/cereda/arara arara], but I mostly use shell scripts (on OSX and Linux). Here are some useful snippets:<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
OS=`uname`<br />
if [ "$TEXROOT" == "" ]; then<br />
# setup ConTeXt’s path; I used different locations on OSX and Linux<br />
# You might also check on the hostname or if the path exists<br />
if [ "$OS" == "Linux" ]; then<br />
source /var/opt/context/tex/setuptex /var/opt/context/tex<br />
elif [ "$OS" == "Darwin" ]; then<br />
source ~/Library/texmf/tex/setuptex ~/Library/texmf/tex<br />
fi<br />
fi<br />
<br />
# ulimit was 256 on older OSX versions, that's too low for bigger books<br />
if [ `ulimit` != "unlimited" ]; then<br />
ulimit -S -n 2048<br />
fi<br />
<br />
# I like to have my PDFs versioned at least by date<br />
ISODATE=`date +"%Y-%m-%d"`<br />
<br />
PRD=$1<br />
if [ "$1" == "" ]; then<br />
echo Which product?<br />
ls -Alh prd_*.tex<br />
exit 1<br />
fi<br />
RESULT=${PRD}_${ISODATE}<br />
<br />
MODE=$2<br />
if [ "$MODE" == "" ]; then<br />
echo Using lowres pictures for preview. Use 'print' parameter for highres mode.<br />
MOD=lowres<br />
else<br />
# print<br />
RESULT=${RESULT}_$MODE<br />
fi<br />
<br />
if [ "$OS" == "Darwin" ]; then<br />
OPEN='open -a Preview'<br />
SHARE=~/Box<br />
else<br />
OPEN="qpdfview --quiet"<br />
SHARE=~/Dropbox<br />
fi<br />
<br />
context --jit prd_${PRD} --result=_pdf/$RESULT --mode=$MOD<br />
if [ "$?" == "0" ]; then<br />
${OPEN} _pdf/$RESULT.pdf &<br />
cp _pdf/${RESULT}.pdf ${SHARE}/projects/<br />
fi<br />
<br />
</pre><br />
<br />
[[Category:Tools]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Run_scripts&diff=32509Run scripts2021-03-31T00:27:16Z<p>Thangalin: Thangalin moved page Run scripts to Running ConTeXt: Scripts are a good idea, but maybe outside purview of wiki (due to maintenance)</p>
<hr />
<div>#REDIRECT [[Running ConTeXt]]</div>Thangalinhttps://wiki.contextgarden.net/index.php?title=Installation&diff=32481Installation2021-03-07T04:17:04Z<p>Thangalin: /* Running MkIV */</p>
<hr />
<div>__NOTOC__<br />
Since April 2019, there is a new implementation of ConTeXt, named '''ConTeXt [[LMTX]]'''. It is tuned for LuaMetaTeX, the lean and mean successor of LuaTeX TeX engine (see [https://tug.org/TUGboat/tb40-1/tb124hagen-lmtx.pdf article]).<br />
<br />
= Download =<br />
<br />
<ul id="DownloadRework"><br />
<br />
<li><br />
=== Windows ===<br />
* X86 [http://lmtx.pragma-ade.nl/install-lmtx/context-mswin.zip 32bits]<br />
* X86 [http://lmtx.pragma-ade.nl/install-lmtx/context-win64.zip 64bits]<br />
* ARM [http://lmtx.pragma-ade.nl/install-lmtx/context-windows-arm64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== MacOS ===<br />
* X86 [http://lmtx.pragma-ade.nl/install-lmtx/context-osx-64.zip 64bits]<br />
* ARM [http://lmtx.pragma-ade.nl/install-lmtx/context-osx-arm64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== GNU/Linux ===<br />
* X86 [http://lmtx.pragma-ade.nl/install-lmtx/context-linux.zip 32b]|[http://lmtx.pragma-ade.nl/install-lmtx/context-linux-64.zip 64b]<br />
* ARM [http://lmtx.pragma-ade.nl/install-lmtx/context-linux-armhf.zip 32b]|[http://lmtx.pragma-ade.nl/install-lmtx/context-linux-aarch64.zip 64b]<br />
* Musl [http://lmtx.pragma-ade.nl/install-lmtx/context-linuxmusl.zip 64b]<br />
</li><br />
<br />
<br />
<li><br />
<br />
=== FreeBSD ===<br />
* [http://lmtx.pragma-ade.nl/install-lmtx/context-freebsd.zip 32bits]<br />
* [http://lmtx.pragma-ade.nl/install-lmtx/context-freebsd-amd64.zip 64bits]<br />
</li><br />
<br />
<li><br />
<br />
=== OpenBSD6.7 ===<br />
* [http://lmtx.pragma-ade.nl/install-lmtx/context-openbsd6.7.zip 32bits]<br />
* [http://lmtx.pragma-ade.nl/install-lmtx/context-openbsd6.7-amd64.zip 64bits]<br />
<br />
<li><br />
<br />
=== OpenBSD6.8 ===<br />
* [http://lmtx.pragma-ade.nl/install-lmtx/context-openbsd6.8.zip 32bits]<br />
* [http://lmtx.pragma-ade.nl/install-lmtx/context-openbsd6.8-amd64.zip 64bits]<br />
</li><br />
</ul><br />
</li><br />
<br />
</ul><br />
<br />
</li><br />
</ul><br />
<br />
<br />
You can [[Read Me| read the licence]] (Creative Commons GNU GPL for program code, and Creative Commons Attribution ShareAlike for documentation).<br />
<br />
= Installation =<br />
<br />
The general steps to install ConTeXt LMTX are as follows:<br />
<br />
# Create a directory for ConTeXt.<br />
# Download the platform-specific archive file into the ConTeXt directory.<br />
# Unpack the archive.<br />
# Execute the install program, which downloads the distribution.<br />
# Update the PATH environment variable.<br />
# Optionally, delete the archive file.<br />
<br />
See the next sections for instructions specific to various platforms.<br />
<br />
== Unix ==<br />
<br />
The steps in this section show how to download and install ConTeXt for a 64-bit Linux system. Change the archive file download link as needed for your target platform. Open a new terminal then run the following commands:<br />
<br />
# mkdir $HOME/bin/context<br />
# cd $HOME/bin/context<br />
# wget http://lmtx.pragma-ade.nl/install-lmtx/context-linux-64.zip<br />
# unzip context-linux-64.zip<br />
# sh install.sh<br />
<br />
Update the PATH environment variable by using the path instructions displayed when the install program finishes. The instructions will vary depending on the type of shell being used:<br />
<br />
* '''Bash''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.bashrc</code><br />
* '''Zsh''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.zshenv</code><br />
* '''Sh'''/'''Ksh''': <code>echo 'export PATH=...instructions...:$PATH' >> ~/.profile</code><br />
* '''Tcsh'''/'''csh''': <code>echo 'set path = ($path ...instructions...)' >> ~/.cshrc</code><br />
<br />
For example, if ConTeXt was downloaded into `$HOME/bin/context` on a system running bash, then the following line would update the PATH environment variable:<br />
<br />
<code>echo 'export PATH=$HOME/bin/context/tex/texmf-linux-64/bin:$PATH' >> ~/.bashrc</code><br />
<br />
== MacOS ==<br />
<br />
The instructions for MacOS are the same as for Unix, but note that:<br />
<br />
* MacOS versions from Catalina (10.15) and newer use '''Zsh''' by default.<br />
* MacOS versions before Catalina use '''Bash''' by default.<br />
<br />
== Windows ==<br />
<br />
Complete the following steps to set up ConTeXt on Windows:<br />
<br />
# Create a directory for ConTeXt, such as `C:\context`.<br />
# Download the architecture-specific version into the ConTeXt directory.<br />
# Extract the archive.<br />
# Run: <code>install.bat</code><br />
# Run: <code>setpath.bat</code><br />
<br />
Installation is complete.<br />
<br />
= First Run =<br />
<br />
This section describes how to run ConTeXt to transform your first TeX document into a PDF.<br />
<br />
# Download the tex input file [[Media:Hello-world.tex|Hello-World.tex]] from our [[Detailed_Example|Detailed example]].<br />
# Run <code>context Hello-world.tex</code> in your terminal (or command prompt).<br />
# Check the PDF output <code>Hello-world.pdf</code>.<br />
<br />
Additional tutorials include:<br />
<br />
* [[First Document| Your first document]]<br />
* [[Detailed Example|Detailed example]]<br />
<br />
See the [[Sample documents]] page for even more examples.<br />
<br />
= Upgrade =<br />
<br />
Re-run the install program to upgrade, which will update the distribution incrementally:<br />
<br />
* Windows: <code>install.bat</code><br />
* Unix: <code>sh install.sh</code><br />
<br />
= Running MkIV =<br />
<br />
The new distribution has all the files to run the previous version of ConTeXt. <br />
* Run <code>context --luatex Hello-world.tex</code> to use the `luatex` binary and [[MkIV]].<br />
<br />
= Further installation instructions =<br />
<br />
<br />
* [[Installing ConTeXt LMTX on MacOS]]<br />
* [[Modules#ConTeXt_LMTX|Installing Modules for ConTeXt LMTX]]<br />
* The official page '''[http://www.pragma-ade.com/install.htm Installing CONTEXT LMTX ]''' is hosted by Pragma-Ade.<br />
* Pragma-Ade also provides the '''[http://www.pragma-ade.com/download-1.htm CONTEXT MKIV distribution]''' (MKIV version is LMTX predecessor) for which there is also [[ConTeXt_Standalone|detailed Installation instructions]].<br />
<br />
<br />
----<br />
<br />
{{Installation navbox}}<br />
<br />
[[Category:Basics]]<br />
[[Category:Installation]]</div>Thangalin