https://wiki.contextgarden.net/api.php?action=feedcontributions&user=Peter&feedformat=atomWiki - User contributions [en]2024-03-19T05:58:03ZUser contributionsMediaWiki 1.34.1https://wiki.contextgarden.net/index.php?title=Command/startTEXpage&diff=32442Command/startTEXpage2021-02-12T17:31:56Z<p>Peter: Mention problem with too large contents.</p>
<hr />
<div>{{Reference<br />
|name=startTEXpage<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] (autogenerated) ==<br />
<syntax>startTEXpage</syntax><br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\startTEXpage<!--<br />
--></td><br />
</tr><br />
<tr><br />
<td colspan="2" class="cmd">\startTEXpage<!--<br />
--><span class="first">[...=...]</span><!--<br />
--></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">strut</td><br />
<td>'''no''' yes global local</td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">align</td><br />
<td>'''normal''' flushleft flushright middle normal high low lohi</td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">offset</td><br />
<td>none '''overlay''' ''dimension''</td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">width</td><br />
<td>'''fit''' ''dimension''</td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">height</td><br />
<td>'''fit''' ''dimension''</td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">frame</td><br />
<td>on '''off'''</td><br />
</tr><br />
</table><br />
<br />
== Description == <br />
Start a page that fits its contents exactly. Or has some extra space around the edges, if you specify {{code|offset}}.<br />
It only works, if the contents is small enough. If it's too big, then you should use something like "\startTEXpage[align=normal,width=100cm,autowidth=force]" as explained here: https://mailman.ntg.nl/pipermail/ntg-context/2021/101149.html<br />
<br />
== Example ==<br />
<context source=yes><br />
\showframe<br />
\startTEXpage<br />
asdf<br />
\stopTEXpage<br />
</context><br />
<br />
<context source=yes><br />
\showframe<br />
\startTEXpage[offset=10pt]<br />
asdf<br />
\stopTEXpage<br />
</context><br />
<br />
<context source=yes><br />
\setuppapersize[A10, landscape]<br />
\showframe[]<br />
\starttext<br />
asdf<br />
\stoptext<br />
</context><br />
<br />
== See also ==<br />
* {{cmd|startTEXpage}} — a page just large enough to fit its contents: containing TeX<br />
* {{cmd|startpagefigure}} — a page just large enough to fit its contents: containing a figure, possibly with some text underneath<br />
* {{cmd|startMPpage}} — a page just large enough to fit its contents: containing MetaPost<br />
* {{src|page-app.mkiv}}, {{src|page-app.mkii}}<br />
<br />
== Help from ConTeXt-Mailinglist/Forum ==<br />
All issues with:<br />
{{Forum|startTEXpage}}<br />
<br />
<br />
[[Category:Command/Layout|startTEXpage]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Test_suite&diff=23002Test suite2015-12-16T14:14:24Z<p>Peter: fix the links</p>
<hr />
<div>== What is it? ==<br />
<br />
There is a project working on creating a test suite for ConTeXt.<br />
The homepage is [[https://foundry.supelec.fr/projects/contexttest ConTeXt Test project]].<br />
<br />
The mailing list can be accessed through the [[https://foundry.supelec.fr/mail/?group_id=21 Lists]] section, and in the [[https://foundry.supelec.fr/scm/?group_id=21 SCM]]<br />
section you can find the actual test files. <br />
<br />
=== Who can/should submit new tests? ===<br />
<br />
* Anyone.<br />
* But since Hans and Taco are busy enough, users, even beginners, are the ones expected to submit new tests.<br />
<br />
=== Who REALLY should submit new tests? ===<br />
<br />
* If a bug that you encountered gets fixed (on the mainling list).<br />
* If a new feature is implemented on your request.<br />
<br />
=== How to view the existing tests? ===<br />
<br />
In the [[https://foundry.supelec.fr/scm/?group_id=21 SCM]] you can learn how to connect to the repository through subversion, or you can browse the current repository of tests online.<br />
<br />
== How can I join in? ==<br />
<br />
=== Join the mailing List ===<br />
<br />
In the [[https://foundry.supelec.fr/mail/?group_id=21 Lists]] section of the server, you will find the contexttest-commits mailing list. The list is not only for commits, it is also the discussion forum of the people working on tests. If you want to do any kind of work for the test project, please subscribe to this list first.<br />
<br />
=== Submit new tests ===<br />
<br />
* create an account on https://foundry.supelec.fr/projects/contexttest<br />
* click on <code>[Rrequest to join project]</code><br />
* {{todo|write notes about installing/using svn}}<br />
<br />
=== Any easier way to do that? ===<br />
<br />
* No yet, but it would be nice if a simpler way existed. Perhaps in the future ...<br />
<br />
=== How can I see/compare the results and judge if they're OK? ===<br />
<br />
At the moment, we are still in the collecting phase. There is no point in setting up the testing infractructure until there are at least some tests to be run. What we need right now are simply test files.</div>Peterhttps://wiki.contextgarden.net/index.php?title=Humour&diff=22977Humour2015-10-02T17:42:38Z<p>Peter: Arthur about poor documentation</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== A poem about documentation ==<br />
<br />
"Yet another context user" posted [http://archive.contextgarden.net/message/20100403.155801.7098c48a.en.html this poem] to the mailing list<br />
<br />
<pre><br />
If you were surprised, like me<br />
Fifty emails, in your inbox to see<br />
<br />
Let me help you with a summary<br />
Of what happended, using a poor excuse for poetry <br />
<br />
It was the day of fools<br />
When Arthur tried to be cool<br />
<br />
In ConTeXt mailing list he shouted, "Look<br />
I am going to write a ConTeXt book!"<br />
<br />
Everyone was happy and had a thrill<br />
Till Martin said, "it is the first of April"<br />
<br />
His joke ruined, Arthur was sad<br />
He said Martin, this is bad<br />
<br />
Other users were also upset, taken for a ride<br />
The lack of a book, is not a matter of pride<br />
<br />
There were cries and a big fuss<br />
I was just getting started, said Russ<br />
<br />
After that comments did pour<br />
Its not even funny, said Gour<br />
<br />
All of us would be out of luck<br />
If Hans were to be hit by a bus!<br />
<br />
Citing Douglas Adams said Taco<br />
That will make the bus, a shamed loco<br />
<br />
In time back it 'ill go<br />
And slam its breaks, like a pro<br />
<br />
Writing documentation is no fun<br />
It that the reason it is shun<br />
<br />
Even if you do write something<br />
Does anyone even read the damn thing?<br />
<br />
Taco lamented all he hears is that 'it sucks'<br />
Demotivated, he may just pass the buck<br />
<br />
"Oh please, don't let the project slack<br />
If you write something, we will give you feedback"<br />
<br />
This circle of arguments is always repeated<br />
Whenever the question of documentation gets tweeted<br />
<br />
A new conspiracy theory was added this time<br />
"They want to keep it a secret," it's a crime<br />
<br />
I am sick and tired of all the pretext<br />
Why do you think anyone should write a book on ConTeXt?<br />
<br />
Taco and Hans, their hands are full<br />
Everyone else is just using a tool<br />
<br />
(Actually when I was writing this chronology<br />
Irdis was thinking about a typographical ontology)<br />
<br />
If you think that the documentation is lacking<br />
Do something, rather than grumbling<br />
<br />
Here's a suggestion, if I may give to thee<br />
Follow it, and you'll be a ConTeXt prodigee<br />
<br />
Pick up a pen and go 'n write<br />
On any part of ConTeXt that you like<br />
<br />
A wiki article, a blog post, are good places to start<br />
People reading them will relish the knowledge it imparts<br />
<br />
Write an example, show how things work<br />
Don't just hide there and lurk<br />
<br />
If nothing else, write about what you find confusing<br />
Others writing documentation may find it motivating<br />
<br />
On this note, this summary I'll end<br />
You were not offended, I'll pretend<br />
<br />
Finally a request, if I may<br />
Let me be anonymous, please, I pray<br />
<br />
A promise in passing, I'll also make<br />
Someday a ConTeXt book or tutorial, I may bake<br />
<br />
I am waiting for time and a muse<br />
At least, that is my excuse<br />
<br />
<br />
<br />
-- A ConTeXt User<br />
<br />
<br />
</pre><br />
<br />
* Later in the thread Idris told how his name should be pronounced<br />
<pre><br />
&gt;&gt;&gt; (Actually when I was writing this chronology<br />
&gt;&gt;&gt; Irdis was thinking about a typographical ontology)<br />
&gt;&gt;<br />
&gt;&gt; Who is this Irdis?<br />
<br />
&gt; Oh, my heart now bleeds<br />
&gt; That I couldn't spell the name of Prof Hamid<br />
<br />
Our anonymous YACU ran, slipped and had to skid,<br />
Neither did (s)he know how to rhyme with Hamid<br />
<br />
Accent in Hamid is on the first syllable,<br />
Otherwise pronouncing it will be untenable<br />
</pre><br />
<br />
Not a poem, but well written:<br />
[http://www.ntg.nl/pipermail/ntg-context/2010/048197.html by Arthur]<br />
<br />
== What if Hans were hit by a bus ==<br />
* Taco's brilliant [http://archive.contextgarden.net/message/20100403.065454.97ad25ba.en.html answer] to this question<br />
<br />
<pre><br />
&gt; This raises another concern and that is: what is the future of ConTeXt<br />
&gt; is Hans "get hit by the bus"? (Of course, we even do not want to think<br />
&gt; about it...)<br />
<br />
The answer to this question is quite obvious if you have read Douglas<br />
Adams' books: the bus will think about the impact of its actions on the<br />
universe for a moment. Then, deeply immersed in gut-wrenching shame,<br />
it will travel back in time half a minute and push its own breaks for<br />
an emergency stop.<br />
</pre><br />
<br />
== latex and LaTeX ==<br />
<br />
Taco Hoekwater [http://archive.contextgarden.net/message/20100911.100030.b6e30e98.en.html explaining] the similarity between latex and LaTeX<br />
<br />
<blockquote><br />
Creating beautiful latex garments is at least as challenging as creating beautiful LaTeX documents (I<br />
tried, in earlier days). And just like in LaTeX, the problem areas are glue control and insert<br />
placement. Selling latex garments is also similar to selling LaTeX books: it is quite a niche market and your clients are considered fetishists by most other people.<br />
</blockquote><br />
<br />
== ConTeXt logic ==<br />
<br />
Steffen Wolfrum [http://www.mail-archive.com/ntg-context@ntg.nl/msg22409.html bewildered] at ConTeXt syntax:<br />
<br />
<blockquote><br />
Sometimes ConTeXt's syntax looks kind of "female" to me:<br />
It certainly has an inner logic, but this is far more ... rich and varied as my <br />
single-minded, male structured mind would expect -)<br />
</blockquote><br />
<br />
== Where is my update? ==<br />
<br />
Vnpenguin was [http://www.mail-archive.com/ntg-context@ntg.nl/msg47711.html confused] why he was not able to update ConTeXt, until Hans resolved the mystery.<br />
<br />
<pre><br />
> Since one week, I update my minimal ConTeXt almost everyday (Win32<br />
> version), but the version is alway the same:<br />
<br />
sure, as i didn't update context for a week<br />
</pre><br />
<br />
== Can you run it for me? ==<br />
<br />
Peter Rolf asking R. Bastian [http://www.mail-archive.com/ntg-context@ntg.nl/msg49587.html not to be afraid]:<br />
<br />
<blockquote><br />
<p><br />
&gt; Does this work in Mk II ?<br />
</p><br />
<br />
<p><br />
You can set your mind at rest and test it yourself.<br />
The 'nuke_my_computer_by_running_context' module is no longer part of<br />
the official distribution ;-)<br />
</p><br />
</blockquote><br />
<br />
== Finite Life ==<br />
<br />
The following exchange between the Philosophers Ludovicus Scarso<br />
and Ioannes Hagenius could be observed on the mailing list[http://archive.contextgarden.net/message/20101218.131804.c250b741.en.html].<br />
<pre><br />
> Live is too short to learn all those languages and stay<br />
> fluent in them, i.e. one simply forgets a lot when usage zeros.<br />
we should start to think how to to become immortal.<br />
</pre><br />
<br />
== Installation chant ==<br />
<br />
Patrick shared this conversation on 2011-12-21:<br />
<pre><br />
Hello Marek,<br />
<br />
> Hi Mr. Gundla<br />
> Just want to say Im very dissapointed that no installing package of ConText exist. <br />
> I mean like you install things in Win – two cliks and Done!<br />
> I was studying ConText whole afternoon and i liked it – But – im very very sick of this kind of installing. <br />
> It just makes people like me to hate the whole thing about trying something else then MS Word. <br />
> I was eager to learn this ConText ant than BIIIIIIG! Frustration cause i could not run it. <br />
> All those versions of packages - i wanted to shoot myself.<br />
<br />
> Yea, i know you dont get paid for this, BUT - come on Mr. Gundla. <br />
> Is it that hard to make one ABSOLUTE DUMMY PACKAGE (you geeks can call it <br />
> how you want i know you like to use word dummies for people who are lesser geeks than you :) ) <br />
> two cliks and lalala! <br />
> Hello Word! You save afternoon to many other people :D Just think about it, ok?<br />
<br />
Well, ConTeXt _is_ hard to install. First you have to sacrifice one of your family members. <br />
Afterwards, you need to hum the magic chant in order to open your spirit. <br />
After you have done that, please draw a circle around your computer and put candles on it, making the shape of a pentagram. <br />
Now, and this is important, go six times clockwise around that circle, six times counter clockwise <br />
and then six times clockwise again. <br />
After that, turn on your computer and start your webbrowser and go to<br />
<br />
http://wiki.contextgarden.net/Simple_Windows_Installation<br />
<br />
and download the installer.<br />
<br />
Sincerely your Mr. Gundla<br />
</pre><br />
<br />
== Wolfgang Interface ==<br />
<br />
> Gosh this list is nice! Reminds me of the "good old days" when we<br />
> used UUCP, bang-paths and C-News to communicate (or the early<br />
> ARPANET days): polite, expert, very willing to share knowledge &c.<br />
<br />
Wolfgang is ConTeXt's natural language interface.<br />
<br />
In fact, with careful use of the filter module and a couple of mail<br />
programs, it should be possible to create something like:<br />
<texcode><br />
\usemodule[filter]<br />
<br />
\defineexternalfilter<br />
[wolfgang]<br />
[filtercommand={ ... code to send email and fetch reply ... },<br />
cache=yes]<br />
<br />
\startwolfgang<br />
Hello list,<br />
<br />
I wonder if anyone could tell me how to implement the following in<br />
ConTeXt.<br />
<br />
... description goes here ...<br />
\stopwolfgang<br />
</texcode><br />
It's important to include the cache=yes, so Wolfgang only has to reply<br />
once.<br />
<br />
= Comparison between various TeX and GUI systems =<br />
<br />
William Adam on the difference between [[Comparison_between_ConTeXt_and_other_typesetting_programs|TeX and other GUI document design systems]]<br />
<br />
= Arthur about poor documentation =<br />
Arthur posted [http://www.ntg.nl/pipermail/ntg-context/2010/048197.html this message] to the mailing list:<br />
<pre><br />
For what it's worth, I agree with you, Michael. ConTeXt developers seem to be<br />
unable to express their ideas clearly. It's sad to see such deficient<br />
communication skills, and it's to be expected that if they go on all their<br />
knowledge is going to be lost.<br />
<br />
You're right, again, and I thank you for pointing this simple fact that, alas,<br />
only a few have noticed until now. Hopefully we will see better than<br />
unintelligible scribbles being passed out as documentation in the future.<br />
<br />
Arthur<br />
</pre><br />
Here some preceding messages to see the context:<br />
* [http://www.ntg.nl/pipermail/ntg-context/2010/047500.html Hans about documentation]<br />
* [http://www.ntg.nl/pipermail/ntg-context/2010/048188.html Michael complaining]<br />
* [http://www.ntg.nl/pipermail/ntg-context/2010/048191.html link to Hans' message]<br />
* [http://www.ntg.nl/pipermail/ntg-context/2010/048194.html Michael complaining again]<br />
<br />
= Pictures =<br />
<br />
== Future ConTeXt Users ==<br />
[[Future ConTeXt Users]]<br />
<br />
== Super Wolfgang ==<br />
<br />
A [http://meeting.contextgarden.net/2010/talks/2010-09-17-closing/wolfgang-color.jpg cartoon] by Duane Bibby at the Fourth ConTeXt meeting<br />
<br />
= Common errors =<br />
<br />
[[ Common errors ]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Template:Main_Page/News&diff=22974Template:Main Page/News2015-09-26T16:50:47Z<p>Peter: add btc address</p>
<hr />
<div>=== News ===<br />
The [http://group.contextgarden.net/ ConTeXt Group] accepts now [http://bitcoin.org/ Bitcoin] donations: easy, fast and almost no fees! Address: {{code|1HjvRV7ZR37kLDt4DHXijram2WjFGpDLiU}}<br/><br />
<br />
The '''[http://meeting.contextgarden.net/2015/ 9th ConTeXt Meeting]''' took place on September 14–18, 2015 at<br />
the [http://www.equitation-aubrac-lozere.fr/gite-hebergement/ Ferme Equestre de Monts d'Aubrac] in [https://www.google.com/maps/place/Moisset+Gerard/@44.6650433,3.0442019,15z/data=!4m2!3m1!1s0x0:0x605201af02196a56?hl=en Nasbinals] towards the center-south of France (about 1½ hours south of Clermont-Ferrand).<br />
<br/><br />
<br />
The '''[http://meeting.contextgarden.net/2014/ 8th ConTeXt Meeting]''' took place on September 8-13, 2014 in [http://goo.gl/maps/Ti9P0 't Sjetootje], a converted chateau in Belgium, close to Maastricht (NL), Li&egrave;ge (BE) and Aachen (DE).</div>Peterhttps://wiki.contextgarden.net/index.php?title=MWE&diff=22688MWE2014-11-05T16:28:50Z<p>Peter: \stoptext is not needed</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Minimum WORKING Examples ==<br />
<br />
Here we launch a contest for the creation of the most minimal working examples. There shall be different categories:<br />
<br />
* shortest code<br />
<br />
* fastest execution<br />
<br />
* shortest code + fastest execution<br />
<br />
* smallest PDF file produced<br />
<br />
Rules: the example MUST compile and create a pdf!<br />
<br />
== ConTeXt ==<br />
<br />
* \starttext a\stoptext<br />
<br />
* \starttext.\stoptext<br />
<br />
* \starttext,<br />
<br />
* \startTEXpage !\stopTEXpage<br />
<br />
== MetaPost ==<br />
<br />
* \startMPpage draworigin;\stopMPpage<br />
<br />
* \startMPpage draworigin\stopMPpage<br />
<br />
* \startMPpage draw(0,0)\stopMPpage</div>Peterhttps://wiki.contextgarden.net/index.php?title=MWE&diff=22687MWE2014-11-05T16:25:40Z<p>Peter: get back first example...</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Minimum WORKING Examples ==<br />
<br />
Here we launch a contest for the creation of the most minimal working examples. There shall be different categories:<br />
<br />
* shortest code<br />
<br />
* fastest execution<br />
<br />
* shortest code + fastest execution<br />
<br />
* smallest PDF file produced<br />
<br />
Rules: the example MUST compile and create a pdf!<br />
<br />
== ConTeXt ==<br />
<br />
* \starttext a\stoptext<br />
<br />
* \starttext.\stoptext<br />
<br />
* \startTEXpage !\stopTEXpage<br />
<br />
== MetaPost ==<br />
<br />
* \startMPpage draworigin;\stopMPpage<br />
<br />
* \startMPpage draworigin\stopMPpage<br />
<br />
* \startMPpage draw(0,0)\stopMPpage</div>Peterhttps://wiki.contextgarden.net/index.php?title=MWE&diff=22686MWE2014-11-05T16:21:56Z<p>Peter: make first example one character shorter</p>
<hr />
<div>< [[Main Page]] | [[Humour]] ><br />
<br />
== Minimum WORKING Examples ==<br />
<br />
Here we launch a contest for the creation of the most minimal working examples. There shall be different categories:<br />
<br />
* shortest code<br />
<br />
* fastest execution<br />
<br />
* shortest code + fastest execution<br />
<br />
* smallest PDF file produced<br />
<br />
Rules: the example MUST compile and create a pdf!<br />
<br />
== ConTeXt ==<br />
<br />
* \starttext.\stoptext<br />
<br />
* \startTEXpage !\stopTEXpage<br />
<br />
== MetaPost ==<br />
<br />
* \startMPpage draworigin;\stopMPpage<br />
<br />
* \startMPpage draworigin\stopMPpage<br />
<br />
* \startMPpage draw(0,0)\stopMPpage</div>Peterhttps://wiki.contextgarden.net/index.php?title=Catalogue_raisonn%C3%A9&diff=22533Catalogue raisonné2014-07-15T16:58:05Z<p>Peter: add 200dpi file</p>
<hr />
<div>< [[Sample documents]]<br />
<br />
This is an example for:<br />
* using the [http://modules.contextgarden.net/grph-downsample downsample module]<br />
* using a Lua file as database<br />
* using a CLD file as main input file for ConTeXt<br />
* using a Makefile and modes for generating different kinds of outputs<br />
* placing original text and translation side by side in two columns<br />
* placing images and captions automatically on the page<br />
<br />
Files:<br />
* [http://pmrb.free.fr/cr/screen1-20dpi.pdf example output] with 20 DPI resolution (20 MB)<br />
* [http://pmrb.free.fr/cr/screen1-200dpi.pdf example output] with 200 DPI resolution (63 MB)<br />
* [http://pmrb.free.fr/cr/Makefile Makefile] that calls ConTeXt with the right "--result=" argument<br />
* [http://pmrb.free.fr/cr/main.cld main.cld], the main CLD file, that gets processed by ConTeXt, all the Lua code<br />
* [http://pmrb.free.fr/cr/env.tex env.tex] style file and a bit more, all the TeX code<br />
* [http://pmrb.free.fr/cr/etchings.lua etchings.lua] the database, one entry per image<br />
<br />
[[Category:Sample documents]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Template:Main_Page/News&diff=22488Template:Main Page/News2014-05-20T21:00:37Z<p>Peter: almost no fees</p>
<hr />
<div>=== News ===<br />
The [http://group.contextgarden.net/ ConTeXt Group] accepts now [http://bitcoin.org/ Bitcoin] donations: easy, fast and almost no fees!<br/><br />
<br />
The '''[http://meeting.contextgarden.net/2014/ 8th ConTeXt Meeting]''' will take place on September 8-13, 2014 in [http://goo.gl/maps/Ti9P0 't Sjetootje], a converted chateau in Belgium, close to Maastricht (NL), Li&egrave;ge (BE) and Aachen (DE). <br/><br />
<br />
<br />
The '''[http://meeting.contextgarden.net/2013/ 7th ConTeXt Meeting]''' took place on September 23-28, 2013 in [http://maps.google.com/maps/ms?hl=en&ie=UTF8&msa=0&ll=49.840304,14.562566&spn=0.002885,0.006067&t=h&z=18&msid=116546273198017474210.00047fb707824494eaa05 Brejlov], a lovely place in the Czech Republic 30km south of Prague.</div>Peterhttps://wiki.contextgarden.net/index.php?title=ConTeXt_Standalone&diff=22216ConTeXt Standalone2014-01-03T00:03:31Z<p>Peter: linux-64: Peter -> Alan</p>
<hr />
<div>The '''ConTeXt suite''' is a complete, up-to-date ConTeXt distribution which can be upgraded efficiently. It can be used to install either the stable or the beta version of ConTeXt. It can also be used in parallel with existing TeX installations such as MikTeX, TeXLive, or older minimal installation. It is aimed towards ConTeXt users, so it does not include LaTeX specific packages and binaries. <br />
<br />
ConTeXt develops at a fast pace, and sometimes beta releases have serious bugs. ConTeXt suite allows you to test the latest ConTeXt release without having to worry if an upgrade will mess an critical project. You can have two (or multiple) parallel ConTeXt suites, and freeze one for your critical projects, and use the other one for experimenting.<br />
<br />
ConTeXt is also included in TeXlive. The ConTeXt suite is updated continuously, whereas ConTeXt in TeXlive is updated less often. In particular, <code>luatex</code> and <code>metapost</code> are under active development and their binaries are updated frequently. ConTeXt follows these developments, indeed often drives development. As the binaries included in the TeXlive distribution are only updated yearly, ConTeXt on TeXlive will necessarily be less current than the ConTeXt suite. (ConTeXt on TeXlive can be kept somewhat more current using the http://tlcontrib.metatex.org repository.) The ConTeXt suite is self-contained and can happily coexist alongside another installed TeX distribution.<br />
<br />
{{TOClimit|limit=1}}<br />
<br />
= General Information =<br />
<br />
== Supported platforms ==<br />
<br />
{| style="border:1px solid #DDDDDD;"<br />
|- align="left" <br />
! Platform<br />
! Short name<br />
! Binaries by<br />
! Notes<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Windows<br />
| mswin<br />
| Akira Kakuto ([http://w32tex.org W32TeX])<br />
|<br />
|- align="left"<br />
! Linux<br />
| linux<br />
| Hans Hagen, Mojca Miklavec, Alan Braslau<br />
| compiled with glibc 2.3.6<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Linux, 64-bit<br />
| linux-64<br />
| Alan Braslau<br />
|<br />
|- align="left"<br />
! Linux, PowerPC<br />
| linux-ppc<br />
| Piotr Kopszak<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Linux, Arm (low end.)<br />
| linux-armel<br />
| Boris Veytsman<br />
| in progress<br />
|- align="left"<br />
! Mac OS X, Intel (32-bit)<br />
| osx-intel<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Mac OS X, Intel (64-bit)<br />
| osx-64<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left"<br />
! Mac OS X, PowerPC<br />
| osx-ppc<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Mac OS X, Universal Binaries<br />
| osx-universal<br />
| Richard Koch, Mojca Miklavec<br />
|<br />
|- align="left"<br />
! FreeBSD<br />
| freebsd<br />
| Alan Braslau<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! FreeBSD, 64-bit<br />
| freebsd-amd64<br />
| Alan Braslau<br />
| <br />
|- align="left"<br />
! kFreeBSD<br />
| kfreebsd-i386<br />
| Alan Braslau<br />
| FreeBSD + glibc (Debian)<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! kFreeBSD, 64-bit<br />
| kfreebsd-amd64<br />
| Alan Braslau<br />
| FreeBSD + glibc (Debian)<br />
|- align="left"<br />
! Solaris, Intel<br />
| solaris-intel<br />
| Marco Patzer<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Solaris, Sparc<br />
| solaris-sparc<br />
| Mojca Miklavec<br />
| Solaris 10 on [http://www.opencsw.org/about/ OpenCSW]<br />
|}<br />
<br />
We need volunteers for providing binaries for other platforms. If you want to support a platform, please write to [[ConTeXt Mailing Lists]]<br />
<br />
== Dependencies ==<br />
* [http://www.ruby-lang.org Ruby] 1.8 or newer (used for MKII)<br />
* Rsync (The windows binary of rsync is distributed within the suite)<br />
<br />
<br />
The following programs are not required for running ConTeXt, but their installation adds additional functionality.<br />
<br />
* ghostscript : for converting PostScript images to PDF<br />
* graphicsmagick : for converting GIF and TIFF images<br />
* inkscape : for converting SVG and compressed SVG<br />
* pstoedit : for converting PostScript to MetaPost outlines<br />
* zint : for providing barcodes<br />
* curl : for including remote content<br />
<br />
== Disc space required ==<br />
ConTeXt macro files are small (less than 10MB), but the suite comes with various free fonts which considerably increase the size of the distribution to around 200MB).<br />
<br />
== Standalone ==<br />
<br />
* [[ConTeXt Standalone/FAQ|Standalone/FAQ]] <br />
* [[ConTeXt Standalone/Structure|Standalone/Structure]] <br />
* [[ConTeXt Standalone/Implementation|Standalone/Implementation]]<br />
* [[ConTeXt Standalone/TODO|Standalone/TODO]] <br />
* [[ConTeXt Standalone/Contents|Standalone/Contents]] <br />
* [[ConTeXt Standalone/TeX Live|Standalone/TeX Live]]<br />
* Browse the [http://minimals.contextgarden.net installation tree]<br />
<br />
<br />
<br />
= Unix-like platforms (Linux/MacOS X/FreeBSD/Solaris) =<br />
<br />
For Mac installation see also [http://wiki.contextgarden.net/Mac_Installation Mac installation page].<br />
<br />
== Single user installation ==<br />
<br />
Select a folder where you want to install ConTeXt. We recommend that you can use your <code>$HOME/context</code> directory. Create this folder. Then download <br />
[http://minimals.contextgarden.net/setup/first-setup.sh first-setup.sh] and place it in <code>$HOME/context</code> directory. Open a terminal, then:<br />
<br />
cd context<br />
<br />
Then make <code>first-setup.sh</code> executable and run it to download the whole distribution and make formats:<br />
<br />
chmod +x first-setup.sh<br />
sh ./first-setup.sh<br />
<br />
This takes a long time, so go have a coffee.<br />
<br />
By default, the suite installs ConTeXt beta. If you want the stable version of ConTeXt, you can use<br />
<br />
sh ./first-setup.sh --context=current<br />
<br />
By default, the suite does ''not'' install modules and other third party content. If you want the modules (and have the bandwidth), you can use<br />
<br />
sh ./first-setup.sh --modules=all<br />
<br />
Installing mkiv only reduces the size of the installation (including all the modules) from about 270 to 200MB . Use<br />
<br />
sh ./first-setup.sh --modules=all --engine=luatex<br />
<br />
== System-wide installation ==<br />
<br />
A system wide installation is only recommeded for users who are comfortable with the command line. Only the location of installing ConTeXt is different for a system wide installation.<br />
<br />
* on Linux you can use <code>/opt/context</code><br />
* on MacOS X you can use <code>/Applications/ConTeXt</code><br />
<br />
Note that, at present, while ''using'' MkIV, you need to have write permissions<ref>Actually, you only need write permission for <code>$TEXMFCACHE</code>.</ref> in the installation directory.<ref>This effectively means that only one user will be able to generate the formats</ref> So, if you are installing the suite in <code>/opt/context</code> or <code>/Applications/ConTeXt</code>, run<br />
<br />
chown `whoami` -R /opt/context <br />
<br />
or <br />
<br />
chown `whoami` -R /Applications/ConTeXt<br />
<br />
(<code>`whoami`</code> outputs your user name, you can type that directly, of course.)<br />
<br />
In order to install the suite, open a terminal, go to the installation directory and download [http://minimals.contextgarden.net/setup/first-setup.sh first-setup.sh]:<br />
<br />
$ rsync -av rsync://contextgarden.net/minimals/setup/first-setup.sh .<br />
<br />
Then run that script to download the whole distribution and make formats:<br />
<br />
sh ./first-setup.sh<br />
<br />
This takes a long time, so go have a coffee.<br />
<br />
By default, the suite installs ConTeXt beta. If you want the stable version of ConTeXt, you can use<br />
<br />
sh ./first-setup.sh --context=current<br />
<br />
By default, the suite does ''not'' install modules and other third party content. If you want the modules (and have the bandwidth), you can use<br />
<br />
sh ./first-setup.sh --modules=all<br />
<br />
===Cache===<br />
<br />
Normaly you do not want to allow access in e.g. /opt. but you like to allow it in /var/cache/*. So create the needed cache directory as a superuser via<br />
<br />
mkdir /var/cache/context<br />
mkdir /var/cache/context/texmf-cache<br />
chmod 777 /var/cache/context/texmf-cache<br />
<br />
Change in the file ./tex/texmf/web2c/texmfcnf.lua the value of TEXMFCACHE to the directory you want (in this example /var/cache/context/texmf-cache).<br />
<br />
===Font Directory===<br />
<br />
Add the OSOFONTDIR into ./tex/setuptex. Go to under the line:<br />
<br />
# TODO: we could set OSFONTDIR on Mac for example<br />
<br />
(if you don't have the line above, go to the end of the file) and add there:<br />
<br />
export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts"<br />
<br />
For more information: [[Fonts in LuaTeX]]<br />
<br />
==Arch Linux==<br />
There’s a [http://aur.archlinux.org/packages.php?ID=30398 PKGBUILD] in<br />
the AUR, provided by Aditya [https://github.com/adityam/context-pkgbuild].<br />
Install it using your favorite AUR frontend, e.g.<br />
<br />
<pre><br />
yaourt -S context-minimals-git<br />
</pre><br />
<br />
This will get you a fresh, up-to-date Context tree in<br />
<tt>/opt/context-minimals</tt>.<br />
<br />
== The funtoo way ==<br />
<br />
If you are using [http://funtoo.org funtoo] there are ebuilds that will make an installation as easy as installing any other package from portage. Take a look at the [[ConTeXt Standalone Funtoo]] Howto. This might also work for [http://www.gentoo.org gentoo], but is untested right now.<br />
<br />
== Proxy settings ==<br />
<br />
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal or your startup script (<code>.bashrc</code> or the corresponding file for your shell). Replace username, password, proxyhost and proxyport with the correct information<br />
<br />
export RSYNC_PROXY=username:password@proxyhost:proxyport<br />
<br />
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).<br />
<br />
export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'<br />
<br />
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.<br />
<br />
== Usage ==<br />
<br />
ConTeXt suite works in a non-interfering manner because it does not put anything in your <code>$PATH</code> and does not set any system variables. This in turn means that in order to use it, you need to do some initialization. An intialization script called <code>setuptex</code> is provided in <code>installation-dir/tex/</code>. <br />
<br />
If you run context from a terminal, source <code>setuptex</code> like so:<br />
<br />
source /installation-dir/tex/setuptex<br />
<br />
== Exclusive usage ==<br />
<br />
The above method means that you always have to type <code>source /installation-dir/tex/setuptex</code> in a terminal before you can use typeset. If you always use ConTeXt suite and never use LaTeX or plain TeX provided by another TeX distribution, you can add the above intialization line to the startup script of your shell. For bash, this means <code>$HOME/.bashrc</code>; for zsh, this means <code>$HOME/.zshrc</code>; for (t)csh, this means <code>$HOME/.cshrc</code> or <code>$HOME/.tcshrc</code>. Then, <code>setuptex</code> will always be sourced in your terminal. <br />
<br />
== Integrating with an editor ==<br />
<br />
If you run ConTeXt from an editor, you need to source {{code|setuptex}} in a terminal and then open your editor from the same terminal. <br />
<br />
Depending on how your editor initializes, you may still need to source {{code|setuptex}} in order to run ConTeXt directly from your editor. In theory, it is sufficient to add {{code|/installation-dir/tex/texmf-<platform>/bin}} to your {{code|$PATH}} in order to use the suite. You can try to add this to the paths that your editor searches.<br />
<br />
For information about configuring [http://smultron.sourceforge.net/ Smultron] and [http://www.uoregon.edu/~koch/texshop/obtaining.html TeXShop] (which are popular TeX editors on Mac) see [[ConTeXt Standalone/Mac Installation]]. For a list of text editors with ConTeXt integration, see the article on [[Text Editors|text editors]].<br />
<br />
== Updating ==<br />
<br />
For updating the ConTeXt suite, <br />
first update <code>first-setup.sh</code>, then run it. You could<br />
also create an alias or a little script “ctx-update”<br />
with the following example contents:<br />
<pre><br />
cd /opt/context<br />
rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh .<br />
./first-setup.sh --modules=all<br />
</pre><br />
<br />
== Uninstalling ==<br />
<br />
ConTeXt suite does not touch anything outside its installation folder. So to uninstall it, you can simply remove the installation folder.<br />
<br />
== Remaking formats ==<br />
<br />
Normally, the update script should create the formats for you. If for some reason you need to recreate the formats, you can do the following:<br />
<br />
* For making MKII format.<br />
<br />
mktexlsr<br />
texexec --make --all <br />
<br />
* For making XeTeX format<br />
<br />
mktexlsr<br />
texexec --make --xtx --all <br />
<br />
* For making MKIV format<br />
<br />
mtxrun --selfupdate<br />
mtxrun --generate<br />
luatools --generate<br />
context --make<br />
<br />
= Windows =<br />
<br />
If you want to use ConTeXt suite alongside MikTeX/TeXLive (needed if you also run LaTeX), follow the command-line installation method. <br />
<br />
== Installation ==<br />
<br />
=== Command line method ===<br />
Download [http://minimals.contextgarden.net/setup/context-setup-mswin.zip context-setup-mswin.zip] or [http://minimals.contextgarden.net/setup/context-setup-win64.zip context-setup-win64.zip], and unzip to a directory where you want to install ConTeXt. It is recommended that you choose a directory that does not have a space in its full path. Then open <code>cmd.exe</code>, go to the installation directory and run<br />
<br />
first-setup.bat<br />
<br />
This takes a long time, so go have a coffee. <br />
<br />
By default, the suite installs ConTeXt beta. If you want the stable version of ConTeXt, you can use <br />
<br />
first-setup.bat --context=current<br />
<br />
By default, the suite does ''not'' install modules and other third party content. If you want the modules (and have the bandwidth), you can use<br />
<br />
first-setup.bat --modules=all<br />
<br />
<br />
If the above installation instructions don't seem to answer your questions, see page [[Windows_Installation:_ConTeXt_Suite_with_SciTe| Windows Installation: ConTeXt Suite with SciTe]] for more detailed information.<br />
<br />
<br />
== Proxy settings ==<br />
<br />
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal as (replace username, password, proxyhost and proxyport with the correct information)<br />
<br />
set RSYNC_PROXY=username:password@proxyhost:proxyport<br />
<br />
or set the variable permanently as a Windows environment variable.<br />
<br />
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).<br />
<br />
export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'<br />
<br />
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.<br />
<br />
== Usage ==<br />
<br />
Before running ConTeXt, you need to run <code>setuptex.bat</code> which is provided in <code>installation-dir\tex\</code>. This can be done by typing<br />
<br />
installation-dir\tex\setuptex.bat<br />
<br />
on cmd.exe before you run ConTeXt. To avoid always having to type this, you can create a shortcut to cmd.exe and edit the command line to read (assuming you installed the suite in <code>C:\Programs</code>; otherwise replace <code>C:\Programs\</code> with your installation directory)<br />
<br />
C:\WINDOWS\System32\cmd.exe /k C:\Programs\context\tex\setuptex.bat<br />
<br />
This starts up a new command shell with the environment pre-loaded. Within the new shell you can just type <code>context</code> to run ConTeXt. E.g.<br />
<br />
C:\> context --version<br />
<br />
to check that you are running the version you think you're running.<br />
<br />
=== Use ConTeXt with Cygwin ===<br />
After installing the ConTeXt suite, you can run it under Cygwin. With Cygwin, you may use gmake and other Unix tools for your automated workflow.<br />
<br />
# Run <code>setuptex.bat</code> in DOS command prompt<br />
# In the same DOS prompt, enter Cygwin by running <code>cygwin.bat</code> (in your Cygwin installation directory)<br />
# Under Cygwin prompt, run <code> context.cmd test.tex </code>. Note that the <code>.cmd</code> extension is needed under Cygwin.<br />
<br />
== Updating ==<br />
<br />
If you used the command line method, just run <code>first-setup.bat</code> again to update the suite. If you have third party modules installed, you should use<br />
first-setup.bat --keep<br />
to upgrade. See [[ConTeXt_Standalone#Installing_third_party_modules| Installing third party modules]] for details.<br />
<br />
<br />
== Uninstallation ==<br />
<br />
If you used the command-line installer, you can just delete the installation directory to uninstall the suite.<br />
<br />
<br />
== Troubleshooting ==<br />
<br />
* rsync sometimes has problems with paths with uppercase letters (like <code>c:\Temp</code> or <code>C:\Documents and Settings</code>). Installing into all-lowercase paths without spaces sometimes helps.<br />
* Directory-name length may also have an effect, due to Windows's 8.3 filename conventions. An indicator is if running "texexec --lua" on a file produces missing-file warnings containing Windows-created 8-character directory names, such as "C:\CONTEX~1\tex", where your ConTeXt directory is really "C:\context_minimals\tex". Be conservative and choose a short name like "C:\ctm\tex". Also, this may even work when an 8-character-or-less directory name like "C:\ctexmin\tex" doesn't.<br />
* If you're behind firewall and rsync times out, you need to open port 873 for outgoing TCP connections.<br />
* If you update luaTeX occasionally you may get something like <br />
<br />
<code>engine mismatch (luv: This is LuaTeX, Version beta-<version>-<date1> (TeX Live 2013/dev)(rev <number1>) <> bin: This is LuaTeX, Version beta-<version>-<date1> (TeX Live 2012/W32TeX)(rev <number2>)), forcing remake</code><br />
<br />
In which case your format will be remade every time you compile a file. In /texmf-mswin make sure that luatex.exe and texlua.exe have the same date; then also delete luatex.dll. This usually solves the problem.<br />
<br />
= Installing third party modules =<br />
<br />
The ConTeXt suite only comes with Taco's [[Bibliography|t-bib]] module. If you want to install [http://modules.contextgarden.net/ a new module], say Wolfgang's [[Letter|t-letter]] module, you can use<br />
first-setup.sh --modules="t-letter"<br />
<br />
If you want to install more than one extra module, you can separate them by commas. So, to install the t-letter and t-mathsets module, do<br />
sh ./first-setup.sh --modules="t-letter,t-mathsets"<br />
<br />
If you want to install all extra modules at once, do<br />
sh ./first-setup.sh --modules=all<br />
<br />
= Reverting to an older installation =<br />
<br />
If, for some reason, you want to revert to an older installation, you can do that by<br />
<br />
sh ./first-setup.sh --context=date<br />
<br />
where <code>date</code> is the date of one of the stable releases of ConTeXt. The complete list of old releases that are available is [http://minimals.contextgarden.net/current/context/ here].<br />
<br />
<br />
= Moving the installation tree around = <br />
<br />
According to this post, http://archive.contextgarden.net/message/20101129.144331.d721372f.en.html it's safe to move the installation tree across directory or machines (say you don't have broadband access). You just have to clean and regenerate the cache (./tex/texmf-cache/luatex-cache) with <br />
mtxrun --generate<br />
<br />
= Notes =<br />
<references/><br />
<br />
{{Installation navbox}}<br />
{{Getting started navbox}}<br />
[[Category:Installation]]<br />
[[Category:Standalone]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Template:Main_Page/News&diff=22211Template:Main Page/News2013-12-13T09:32:45Z<p>Peter: Bitcoin donations for CG</p>
<hr />
<div>=== News ===<br />
The [http://group.contextgarden.net/ ConTeXt Group] accepts now [http://bitcoin.org/ Bitcoin] donations: easy, fast and no fees!<br/><br />
<br />
The '''[http://meeting.contextgarden.net/2014/ 8th ConTeXt Meeting]''' will take place on September 8-13, 2014 in [http://goo.gl/maps/Ti9P0 't Sjetootje], a converted chateau in Belgium, close to Maastricht (NL), Li&egrave;ge (BE) and Aachen (DE). <br/><br />
<br />
<br />
The '''[http://meeting.contextgarden.net/2013/ 7th ConTeXt Meeting]''' took place on September 23-28, 2013 in [http://maps.google.com/maps/ms?hl=en&ie=UTF8&msa=0&ll=49.840304,14.562566&spn=0.002885,0.006067&t=h&z=18&msid=116546273198017474210.00047fb707824494eaa05 Brejlov], a lovely place in the Czech Republic 30km south of Prague.</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/setuptype&diff=22120Command/setuptype2013-10-07T11:26:07Z<p>Peter: add "lines" parameter</p>
<hr />
<div>{{Reference<br />
|name=setuptype<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\setuptype<span class="first" >[...,...=...,...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Command/keyword:space|space]]</td><br />
<td>[[Command/value:on|on]] [[Command/value:off|off]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Command/keyword:lines|lines]]</td><br />
<td>[[Command/value:normal|normal]] [[Command/value:hyphenated|hyphenated]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Command/keyword:option|option]]</td><br />
<td>[[Command/value:slanted|slanted]] [[Command/value:normal|normal]] [[Command/value:none|none]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Command/keyword:style|style]]</td><br />
<td>[[Command/value:normal|normal]] [[Command/value:bold|bold]] [[Command/value:slanted|slanted]] [[Command/value:boldslanted|boldslanted]] [[Command/value:type|type]] [[Command/value:cap|cap]] [[Command/value:small|small]] ... [[Command/value:command|command]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Command/keyword:color|color]]</td><br />
<td>[[Command/value:name|name]] </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like {{cmd|goto}} --><br />
<br />
== Help from ConTeXt-Mailinglist/Forum ==<br />
All issues with:<br />
{{Forum|{{SUBPAGENAME}}}}<br />
<br />
[[Category:Command/Verbatim Text|setuptype]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=TABLE&diff=21948TABLE2013-07-19T22:32:21Z<p>Peter: get current row/column number</p>
<hr />
<div>< [[Tables Overview]] | [[XML]] ><br />
<br />
=Introduction=<br />
<br />
This table mode is called &ldquo;natural tables&rdquo; or &ldquo;automatic tables.&rdquo; I'd call it &ldquo;HTML tables,&rdquo; because it's very similar to them. They're especially suited for [[XML]] conversions.<br />
<br />
Beware: every element must use <tt>\b</tt> ... <tt>\e</tt>!<br />
<br />
You find a lot of samples in [[manual:enattab.pdf|enattab.pdf]]<br />
<br />
Willi Egger wrote a [[My Way]] how he set a typesetter's lead type case: [http://dl.contextgarden.net/myway/NaturalTables.pdf Use of natural tables]<br />
<br />
To place a table use:<br />
<br />
<texcode><br />
\placetable{Caption}<br />
{\bTABLE<br />
\bTR \bTD One \eTD \bTD two \eTD \eTR<br />
\bTR \bTD One \eTD \bTD two \eTD \eTR<br />
\eTABLE}<br />
</texcode><br />
<br />
Here is a more elaborate example:<br />
<br />
<context source=yes><br />
This is our red-coloured table.<br />
\setupTABLE[row][odd][background=color,backgroundcolor=red, width=.2\textwidth]<br />
\bTABLE[split=yes] % allow splitting over page boundaries<br />
\bTR \bTD[nr=3] 1 \eTD \bTD[nc=2] 2/3 \eTD \bTD[nr=3] 4 \eTD \eTR<br />
\bTR \bTD 2 \eTD \bTD 3 \eTD \eTR<br />
\bTR \bTD 2 \eTD \bTD 3 \eTD \eTR<br />
\bTR \bTD[nc=3] 1/2/3 \eTD \bTD 4 \eTD \eTR<br />
\bTR \bTD 1 \eTD \bTD 2 \eTD \bTD 3 \eTD \bTD 4 \eTD \eTR<br />
\eTABLE<br />
</context><br />
<br />
<br />
= Multipage TABLEs =<br />
<br />
Try to divide your table into...<br />
* <cmd>bTABLEhead</cmd> (table header)<br />
* <cmd>bTABLEnext</cmd> (alternate table header on following pages)<br />
* <cmd>bTABLEbody</cmd> (table body)<br />
* <cmd>bTABLEfoot</cmd> (table footer)<br />
and <cmd>setupTABLE</cmd><tt>[split=yes]</tt> or <tt>[split=repeat]</tt><br />
<br />
see also [[source:tabl-ntb.mkiv|tabl-ntb.mkiv]]<br />
<br />
If you must <b>split</b> a natural table over several pages, you can<br />
simply do this by adding <tt>\setupTABLE[split=yes]</tt> to your TABLE<br />
definition. Another way is to define it right at the TABLE start<br />
by adding the parameter <tt>[split=yes]</tt> (see example).<br />
However,<br />
{{cmd|startlinecorrection}}<br />
can lead to unpredictable vertical spaces between rows [http://archive.contextgarden.net/message/20100912.112605.8a1aaf13.en.html].<br />
<br />
In this case the <b>table head</b><br />
(all between <cmd>bTABLEhead</cmd> and <cmd>eTABLEhead</cmd>)<br />
is printed only once at the beginning of the table. But if you use <tt>[split=repeat]</tt>,<br />
it is printed on top of every new page, that contains parts of<br />
your multipage table. Please take account of the fact, that the<br />
head cells are enclosed by <cmd>bTH</cmd> and <cmd>eTH</cmd> (and not \[be]TC).<br />
<br />
If you want to use an alternative table header for all following pages,<br />
you can do this by defining an additional header. Just add the second header<br />
between <cmd>bTABLEnext</cmd>...<cmd>eTABLEnext</cmd>,<br />
right after your normal head definition.<br />
Now every additional page of the multipage table starts with the<br />
<b>next table head</b>.<br />
<br />
The <b>table foot</b> is declared between <cmd>bTABLEfoot</cmd> and<br />
<cmd>eTABLEfoot</cmd>. It defines the concluding row of your natural table.<br />
<br />
'''Beware:''' Split tables often begin not on the page (or in the column, if you use them) where they ''could'' start, but on/in the next one.<br />
This is a known limitation due to the complicated calculation of remaining space on the page.<br />
That won't become better before this calculations are newly written in Lua. (Said Hans on 2010-09-24.)<br />
<br />
The following standalone example deals with all the mentioned aspects of natural tables.<br />
Just <i>copy&paste</i> it as a starting point for further experiments...<br />
<br />
<texcode><br />
\starttext<br />
<br />
\setupcolors[state=start]<br />
<br />
% setup for all cells<br />
\setupTABLE[r][each][style=\tfx\it, align=center]<br />
<br />
% setup table head<br />
\setupTABLE[r][first]<br />
[background=color,<br />
backgroundcolor=yellow]<br />
% setup table footer<br />
\setupTABLE[r][last]<br />
[style=bold,<br />
background=color,<br />
backgroundcolor=green]<br />
<br />
\bTABLE[split=repeat,option=stretch]% head on every page, stretch columns<br />
%<br />
% IMPORTANT: use \bTH ... \eTH to enclose the head|next cells<br />
\bTABLEhead<br />
\bTR<br />
\bTH head1 \eTH<br />
\bTH head2 \eTH<br />
\bTH head3 \eTH<br />
\eTR<br />
\eTABLEhead<br />
% <br />
\bTABLEnext % setup for next table head<br />
\bTR [background=color,backgroundcolor=cyan]<br />
\bTH next1 \eTH<br />
\bTH next2 \eTH<br />
\bTH next3 \eTH<br />
\eTR<br />
\eTABLEnext<br />
%<br />
% the table body (main part)<br />
%<br />
\bTABLEbody<br />
%<br />
\dorecurse{100}{% 100 rows<br />
\bTR<br />
\bTC body body body body body \eTC<br />
\bTC body body body body body \eTC<br />
\bTC body body body body body \eTC<br />
\eTR<br />
}%<br />
%<br />
\eTABLEbody<br />
%<br />
% the table foot<br />
%<br />
\bTABLEfoot<br />
\bTR<br />
\bTC foot1 \eTC<br />
\bTC foot2 \eTC<br />
\bTC foot3 \eTC<br />
\eTR<br />
\eTABLEfoot<br />
%<br />
\eTABLE<br />
<br />
\stoptext<br />
</texcode><br />
<br />
= Tables in multiple columns =<br />
<br />
... just work (at least in luaTeX and not here...). See the following example.<br />
<br />
<texcode><br />
\starttext<br />
\startcolumns[n=3]<br />
\bTABLE<br />
\dorecurse{21}<br />
{\bTR \bTD a\eTD \bTD b \eTD \eTR}<br />
\eTABLE<br />
\stopcolumns<br />
\stoptext<br />
</texcode><br />
<br />
= Creating tables from CSV data (Comma Separated Values) =<br />
<br />
See also [[m-database|the database module]]!<br />
<br />
and [http://dl.contextgarden.net/myway/csv.pdf Creating Tables using CSV (Comma-separated values)] by Mojca Miklavec<br />
<br />
<br />
<!-- Maybe some other place or a separate page is more appropriate for this section --><br />
<br />
An interesting example of creating a table using comma separated values was posted to the [http://archive.contextgarden.net/message/20050923.193302.f2110c93.en.html mailing list] by [[User:ChristopherCreutzig|Christopher Creutzig]]<br />
<br />
The following macros take care of processing CSV data:<br />
<texcode><br />
% Iterate over all the lines of text captured with \obeylines active<br />
% command to call is first argument, is not called for empty lines<br />
\bgroup<br />
\obeylines<br />
\gdef\ProcessLines#1#2{\doProcessLines{#1}#2^^M\doProcessLines}%<br />
\gdef\doProcessLines#1#2^^M#3\doProcessLines{%<br />
\doifnotempty{#2}{#1{#2}}%<br />
\doifnotempty{#3}{\doProcessLines{#1}#3\doProcessLines}%<br />
}%<br />
\egroup<br />
<br />
\def\startCSV{\bgroup\obeylines\dostartCSV}<br />
</texcode><br />
<br />
The next lines are an example of transforming the data into a natural table, but can be easily adapted to any type of the table or perhaps (mis)used in even more strange ways:<br />
<br />
<texcode><br />
\def\TBLentry#1{\bTD#1\eTD}<br />
\def\TBLline#1{\bTR\processcommalist[#1]\TBLentry}<br />
<br />
\def\dostartCSV#1\stopCSV{%<br />
\bTABLE<br />
\ProcessLines\TBLline{#1}%<br />
\eTABLE<br />
\egroup<br />
}<br />
</texcode><br />
<br />
The following lines will then finally result in a desired table:<br />
<br />
<texcode><br />
% some additional settings for the table may be made as well<br />
\setupTABLE[c][2][style=\tt]<br />
\setupTABLE[c][3][align=middle]<br />
\setupTABLE[r][1][style=bold] % how to override the \tt in the second column?<br />
<br />
\startCSV<br />
Name,Email,Accepted<br />
\CONTEXT,worth@trying.to,Yes<br />
Hans,main@developer.of,Yes<br />
Bug,get@rid.of,No<br />
\stopCSV<br />
</texcode><br />
<br />
<context><br />
\setuppapersize[A5]<br />
<br />
% Iterate over all the lines of text captured with \obeylines active<br />
% command to call is first argument, is not called for empty lines<br />
\bgroup<br />
\obeylines<br />
\gdef\ProcessLines#1#2{\doProcessLines{#1}#2^^M\doProcessLines}%<br />
\gdef\doProcessLines#1#2^^M#3\doProcessLines{%<br />
\doifnotempty{#2}{#1{#2}}%<br />
\doifnotempty{#3}{\doProcessLines{#1}#3\doProcessLines}%<br />
}%<br />
\egroup<br />
<br />
\def\startCSV{\bgroup\obeylines\dostartCSV}<br />
<br />
\def\TBLentry#1{\bTD#1\eTD}<br />
\def\TBLline#1{\bTR\processcommalist[#1]\TBLentry}<br />
<br />
\def\dostartCSV#1\stopCSV{%<br />
\bTABLE<br />
\ProcessLines\TBLline{#1}%<br />
\eTABLE<br />
\egroup<br />
}<br />
<br />
\setupTABLE[c][2][style=\tt]<br />
\setupTABLE[c][3][align=middle]<br />
\setupTABLE[r][1][style={\rm\bf}]<br />
\startCSV<br />
Name,Email,Accepted<br />
\CONTEXT,worth@trying.to,Yes<br />
Hans,main@developer.of,Yes<br />
Bug,get@rid.of,No<br />
\stopCSV<br />
</context><br />
<br />
Some remarks: the (tentative) code ignores the fact that<br />
* csv data may optionally be enclosed in "" quotes that have to be removed (to be done in \TBLentry) <br />
* quoted strings may contain commas themselves (which means writing a custom version of \processcommalist instead).<br />
<br />
See also {{cmd|processseparatedlist}}.<br />
<br />
= Designing complex TABLEs =<br />
<br />
Everything is easy when a simple grid is enough. Unfortunately, this<br />
is not the case most of the time, tables tend to have information<br />
which should flow accross cell boundaries either vertically<br />
or horizontally. One of the reasons to use TABLE instead of the<br />
table environment is that TABLE provides an easy (relatively speaking, <br />
at least) way to make merged cells to both directions.<br />
<br />
There are probably as many ways to design TABLEs as there are<br />
users, but a simple one to begin with is to start with a<br />
grid:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setupTABLE[r][each][height=0.5cm]<br />
\setupTABLE[c][each][width=1cm]<br />
\bTABLE<br />
\bTR \bTD r1c1 \eTD \bTD r1c2 \eTD \bTD r1c3 \eTD \bTD r1c4 \eTD \bTD r1c5 \eTD \bTD r1c6 \eTD \eTR<br />
\bTR \bTD r2c1 \eTD \bTD r2c2 \eTD \bTD r2c3 \eTD \bTD r2c4 \eTD \bTD r2c5 \eTD \bTD r2c6 \eTD \eTR<br />
\bTR \bTD r3c1 \eTD \bTD r3c2 \eTD \bTD r3c3 \eTD \bTD r3c4 \eTD \bTD r3c5 \eTD \bTD r3c6 \eTD \eTR<br />
\bTR \bTD r4c1 \eTD \bTD r4c2 \eTD \bTD r4c3 \eTD \bTD r4c4 \eTD \bTD r4c5 \eTD \bTD r4c6 \eTD \eTR<br />
\bTR \bTD r5c1 \eTD \bTD r5c2 \eTD \bTD r5c3 \eTD \bTD r5c4 \eTD \bTD r5c5 \eTD \bTD r5c6 \eTD \eTR<br />
\bTR \bTD r6c1 \eTD \bTD r6c2 \eTD \bTD r6c3 \eTD \bTD r6c4 \eTD \bTD r6c5 \eTD \bTD r6c6 \eTD \eTR<br />
\eTABLE<br />
</context><br />
<br />
The desired table layout is then drawn onto this grid, and the top left corner cell<br />
of each cell in the final layout identified:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setupTABLE[r][each][height=0.5cm]<br />
\setupTABLE[c][each][width=1cm]<br />
\setupTABLE[r][1][height=0cm,frame=off]<br />
\bTABLE<br />
\bTR \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \eTR<br />
\bTR \bTD[nc=2,nr=2] r1c1 \eTD \bTD r1c3 \eTD \bTD[nr=2] r1c4 \eTD \bTD[nc=2,nr=2] r1c5 \eTD \eTR<br />
\bTR \bTD[nr=2] r2c3 \eTD \eTR<br />
\bTR \bTD[nc=2] r3c1 \eTD \bTD[nc=2] r3c4 \eTD \bTD r3c6 \eTD \eTR<br />
\bTR \bTD r4c1 \eTD \bTD[nc=2] r4c2 \eTD \bTD[nr=2] r4c4 \eTD \bTD[nc=2] r4c5 \eTD \eTR<br />
\bTR \bTD[nr=2,nc=2] r5c1 \eTD \bTD[nr=2] r5c3 \eTD \bTD[nr=2,nc=2] r5c5 \eTD \eTR<br />
\bTR \bTD r6c4 \eTD \eTR<br />
\eTABLE<br />
</context><br />
<br />
The cells are listed from left to right and up to down. Each larger cell is then given<br />
it size by using <tt>nc=...</tt> and <tt>nr=...</tt> parameters with <tt>\bTD</tt>. The<br />
code producing the table above is:<br />
<br />
<texcode><br />
\setupTABLE[r][each][height=1cm]<br />
\setupTABLE[c][each][width=1cm]<br />
\setupTABLE[r][1][height=0cm,frame=off]<br />
\bTABLE<br />
\bTR \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \bTD \eTD \eTR<br />
\bTR \bTD[nc=2,nr=2] r1c1 \eTD \bTD r1c3 \eTD \bTD[nr=2] r1c4 \eTD \bTD[nr=2,nc=2] r1c5 \eTD \eTR<br />
\bTR \bTD[nr=2] r2c3 \eTD \eTR<br />
\bTR \bTD[nc=2] r3c1 \eTD \bTD[nc=2] r3c4 \eTD \bTD r3c6 \eTD \eTR<br />
\bTR \bTD r4c1 \eTD \bTD[nc=2] r4c2 \eTD \bTD[nr=2] r4c4 \eTD \bTD[nc=2] r4c5 \eTD \eTR<br />
\bTR \bTD[nr=2,nc=2] r5c1 \eTD \bTD[nr=2] r5c3 \eTD \bTD[nr=2,nc=2] r5c5 \eTD \eTR<br />
\bTR \bTD r6c4 \eTD \eTR<br />
\eTABLE<br />
</texcode><br />
<br />
N.B. There is an ugly hack in the code. An empty first row with zero height and no borders<br />
is added. If the row is omitted, then something odd happens to the number of<br />
columns. The table should have all cells, so this may be a bug. (Or then I have<br />
blundered something with this example, possibly.)<br />
<br />
Everything rectangular can be done with TABLE, as long as it can be fit in the grid. The grid<br />
does not have to be equidistant, and if its dimensions are omitted, the program<br />
will fit the data in. L-shaped or other complex cell shapes are not possible.<br />
Using them would be a bit odd, in any case, as alignment and text flow problems<br />
would be quite interesting.<br />
<br />
<br />
== Cell Addressing and Frames ==<br />
<br />
The setup commands for TABLE do not seem to be very verbosedly commented.<br />
There are, however, a few shorthands, which are useful to understand.<br />
First of all, there are several ways to address cells. This is a brief<br />
summary of some of them:<br />
<br />
<texcode><br />
\setupTABLE[r][(list of rows)][...]<br />
\setupTABLE[c][(list of columns)][...]<br />
\setupTABLE[(list of columns)][(list of rows)][...]<br />
</texcode><br />
<br />
A list contains one or more numbers separated by commas.<br />
Word "last" is equivalent to the number of the last row or<br />
column. The complete list can be replaced by the word "each"<br />
to address all cells on the row/column.<br />
<br />
Let us consider the following table:<br />
<br />
<texcode><br />
\setupTABLE[c][each][align={middle,lohi},frame=off]<br />
\setupTABLE[r][2,3,4,5,6][height=1.0cm]<br />
\setupTABLE[r][2,4][topframe=on]<br />
\setupTABLE[c][1,2,3][rightframe=on]<br />
...<br />
</texcode><br />
<br />
In plain language the rows are interpreted as follows:<br />
<br />
* Align each cell in each column (i.e. all cells) horizontally in the middle<br />
and vertically in the middle (lohi), and remove all frames (borders)<br />
* The height of rows 2 -- 6 is 1.0 cm<br />
* Draw a line on top of rows 2 and 4<br />
* Draw a line to the right side of columns 1 -- 3<br />
<br />
In this case the table is slightly complicated, there are some split cells,<br />
as shown below:<br />
<br />
<table><tr valign="top"><td><br />
<texcode><br />
\bTABLE<br />
\bTR<br />
\bTD \bf r1c1 \eTD<br />
\bTD \bf r1c2 \eTD<br />
\bTD \bf r1c3 \eTD<br />
\bTD \bf r1c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r2c1 \eTD<br />
\bTD r2c2 \eTD<br />
\bTD[nr=2] r2c3 \eTD<br />
\bTD r2c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r3c1 \eTD<br />
\bTD r3c2 \eTD<br />
\bTD r3c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r4c1 \eTD<br />
\bTD r4c2 \eTD<br />
\bTD[nr=3] r4c3 \eTD<br />
\bTD[nr=3] r4c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r5c1 \eTD<br />
\bTD r5c2 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r6c1 \eTD<br />
\bTD r6c2 \eTD<br />
\eTR<br />
\eTABLE<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\setupTABLE[c][each][align={middle,lohi},frame=off]<br />
\setupTABLE[r][2,3,4,5,6][height=0.5cm]<br />
\setupTABLE[r][2,4][topframe=on]<br />
\setupTABLE[c][1,2,3][rightframe=on]<br />
\bTABLE<br />
\bTR<br />
\bTD \bf r1c1 \eTD<br />
\bTD \bf r1c2 \eTD<br />
\bTD \bf r1c3 \eTD<br />
\bTD \bf r1c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r2c1 \eTD<br />
\bTD r2c2 \eTD<br />
\bTD[nr=2] r2c3 \eTD<br />
\bTD r2c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r3c1 \eTD<br />
\bTD r3c2 \eTD<br />
\bTD r3c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r4c1 \eTD<br />
\bTD r4c2 \eTD<br />
\bTD[nr=3] r4c3 \eTD<br />
\bTD[nr=3] r4c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r5c1 \eTD<br />
\bTD r5c2 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r6c1 \eTD<br />
\bTD r6c2 \eTD<br />
\eTR<br />
\eTABLE<br />
</context><br />
</td></tr></table><br />
<br />
The cell numbering is well worth noting. It is very logical (upper<br />
leftmost part of a combined cell), but sometimes the results are<br />
surprising in the beginning.<br />
<br />
The important point about cell numbering is that there is really<br />
a difference between "bottom border of row 3" and "top border of<br />
row 4". To illustrate this, let us change the frame setups:<br />
<br />
<texcode><br />
\setupTABLE[r][2,4][topframe=on]<br />
</texcode><br />
<br />
is changed to<br />
<br />
<texcode><br />
\setupTABLE[r][1,3][bottomframe=on]<br />
</texcode><br />
<br />
At first sight this is exactly the same thing. But...<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setupTABLE[c][each][align={middle,lohi},frame=off]<br />
\setupTABLE[r][2,3,4,5,6][height=0.5cm]<br />
\setupTABLE[r][1,3][bottomframe=on]<br />
\setupTABLE[c][1,2,3][rightframe=on]<br />
\bTABLE<br />
\bTR<br />
\bTD \bf r1c1 \eTD<br />
\bTD \bf r1c2 \eTD<br />
\bTD \bf r1c3 \eTD<br />
\bTD \bf r1c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r2c1 \eTD<br />
\bTD r2c2 \eTD<br />
\bTD[nr=2] r2c3 \eTD<br />
\bTD r2c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r3c1 \eTD<br />
\bTD r3c2 \eTD<br />
\bTD r3c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r4c1 \eTD<br />
\bTD r4c2 \eTD<br />
\bTD[nr=3] r4c3 \eTD<br />
\bTD[nr=3] r4c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r5c1 \eTD<br />
\bTD r5c2 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r6c1 \eTD<br />
\bTD r6c2 \eTD<br />
\eTR<br />
\eTABLE<br />
</context><br />
<br />
Where did the horizontal line in column 3 disappear? Nowhere. There is no<br />
row 3 in column 3, so there cannot be a frame under it. This problem<br />
can be overcome by using topframe and leftframe instead of bottom and<br />
right, as the cells below and to the right of a border have to exist.<br />
<br />
However, this solution leaves the problem of bottom and rightmost borders.<br />
How to draw a line in the bottom of the table? Using <br />
<tt>\setupTABLE[r][6][bottomframe=on]</tt> will leave the gap in columns 3 and 4, <br />
and <tt>\setupTABLE[r][7][topframe=on]</tt> is not possible, as there is no <br />
row 7. The clever idea of using "last" instead of the row number (6) will fail, <br />
as "last" seems to behave exactly the same way as number 6.<br />
<br />
One useful method is to switch on the borders cell by<br />
cell by adding <tt>\setupTABLE[3,4][4][bottomframe=on]</tt>, i.e.<br />
draw a border under cells r4c3 and r4c4.<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\setupTABLE[c][each][align={middle,lohi},frame=off]<br />
\setupTABLE[r][2,3,4,5,6][height=0.5cm]<br />
\setupTABLE[r][2,4][topframe=on]<br />
\setupTABLE[c][1,2,3][rightframe=on]<br />
\setupTABLE[r][6][bottomframe=on]<br />
\setupTABLE[3,4][4][bottomframe=on]<br />
\bTABLE<br />
\bTR<br />
\bTD \bf r1c1 \eTD<br />
\bTD \bf r1c2 \eTD<br />
\bTD \bf r1c3 \eTD<br />
\bTD \bf r1c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r2c1 \eTD<br />
\bTD r2c2 \eTD<br />
\bTD[nr=2] r2c3 \eTD<br />
\bTD r2c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r3c1 \eTD<br />
\bTD r3c2 \eTD<br />
\bTD r3c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r4c1 \eTD<br />
\bTD r4c2 \eTD<br />
\bTD[nr=3] r4c3 \eTD<br />
\bTD[nr=3] r4c4 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r5c1 \eTD<br />
\bTD r5c2 \eTD<br />
\eTR<br />
\bTR<br />
\bTD r6c1 \eTD<br />
\bTD r6c2 \eTD<br />
\eTR<br />
\eTABLE<br />
</context><br />
<br />
== Column Offset/Gap ==<br />
<br />
From the mailing list at 2005-11-09 by Vit Zyka, modified by Hans Hagen:<br />
<br />
<texcode><br />
\starttext<br />
<br />
% distance mechanism, per column (H)<br />
<br />
\start<br />
\setupTABLE[c][1][distance=2em]<br />
\setupTABLE[c][2][distance=3em]<br />
<br />
\bTABLE<br />
\bTR \bTD test \eTD \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD[nx=2] test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD[nx=2] test \eTD \eTR<br />
\eTABLE<br />
<br />
\bTABLE[option=stretch]<br />
\bTR \bTD test \eTD \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD[nx=2] test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD[nx=2] test \eTD \eTR<br />
\eTABLE<br />
\stop<br />
<br />
% distance mechanism, per table (V)<br />
<br />
\framed[offset=none]{%<br />
\setupTABLE[column][2][align=left]<br />
\setupTABLE[column][3][align=right]<br />
\bTABLE[columndistance=2cm,leftmargindistance=.3cm,rightmargindistance=.5cm]<br />
\bTR<br />
\bTH[nc=3] Table head\eTH<br />
\eTR<br />
\bTR\bTD[nc=2] AB\eTD\bTD C\eTD\eTR<br />
\bTR\bTD[nc=2,align=left] AB\eTD\bTD C\eTD\eTR<br />
\bTR\bTD[nc=2,align=middle] AB\eTD\bTD C\eTD\eTR<br />
\bTR\bTD A\eTD\bTD B\eTD\bTD C\eTD\eTR<br />
\bTR\bTD Aa\eTD\bTD Bb\eTD\bTD Cccc\eTD\eTR<br />
\bTR\bTD[nc=3,align=middle] ABC\eTD\eTR<br />
\eTABLE<br />
}<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== Make a cell bold ==<br />
<br />
Drawing bold lines around a cell is done using the<br />
<tt>[rulethickness=''dim'']</tt> key on a cell. The thicker rules will<br />
offset the text inside the cell both downwards and sideways, so care<br />
should be taken that the cell's increased rulethickness is offset by an<br />
equal decrease in offset.<br />
<br />
<context source="yes" text="produces"><br />
\setupTABLE[row][each][rulethickness=.25pt,offset=\dimexpr1mm+1.75pt] <br />
\bTABLE<br />
\bTR \bTD 1 \eTD \bTD 1 \eTD \bTD 2/3 \eTD \eTR<br />
\bTR \bTD 2 \eTD \bTD 2 \eTD \bTD 3 \eTD \eTR<br />
\bTR \bTD 2 \eTD \bTD[rulethickness=2pt,offset=1mm] 2 \eTD \bTD 3 \eTD \eTR<br />
\bTR \bTD 1 \eTD \bTD 1 \eTD \bTD 4 \eTD \eTR<br />
\bTR \bTD 1 \eTD \bTD 1 \eTD \bTD 2 \eTD \eTR<br />
\eTABLE<br />
</context><br />
<br />
== Rules ==<br />
<br />
=== Example: an invoice with thick rules ===<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
{\bfa Invoice}<br />
\switchtobodyfont[6pt]<br />
\blank<br />
\bTABLE<br />
\setupTABLE[frame=off,offset=1mm]<br />
\setupTABLE[row][*][height=7.25mm]<br />
\setupTABLE[column][1,2] [width=20mm,offset=\dimexpr1mm+2pt,align=flushleft]<br />
\setupTABLE[column][3,4,5][width=20mm,offset=\dimexpr1mm+2pt,align=flushright]<br />
\bTR[bottomframe=on, rulethickness=2pt,offset=1mm]<br />
\bTD\bf Date \eTD<br />
\bTD\bf Description \eTD<br />
\bTD\bf Quantity \eTD<br />
\bTD\bf Price \eTD<br />
\bTD\bf Total \eTD<br />
\eTR<br />
\bTR[bottomframe=on,rulethickness=.25pt]<br />
\bTD 05-01-2010 \eTD<br />
\bTD Element 1 \eTD<br />
\bTD 10.0 \eTD<br />
\bTD 6.00 \eTD<br />
\bTD 60.00 \eTD<br />
\eTR<br />
\bTR[bottomframe=on,rulethickness=.25pt]<br />
\bTD 05-01-2010 \eTD<br />
\bTD Element 2 \eTD<br />
\bTD 2.0 \eTD<br />
\bTD 3.00 \eTD<br />
\bTD 6.00 \eTD<br />
\eTR<br />
\bTR[topframe=on,rulethickness=2pt,offset=1mm]<br />
\bTD[nx=3] \eTD<br />
\bTD[align=flushleft] Subtotal \eTD<br />
\bTD 66.00 \eTD<br />
\eTR<br />
\bTR[offset=\dimexpr1mm+2pt]<br />
\bTD[nx=3] \eTD<br />
\bTD[align=flushleft] VAT 19\% \eTD<br />
\bTD 12.54 \eTD<br />
\eTR<br />
\bTR<br />
\bTD[nx=3] \eTD<br />
\bTD[align=flushleft] \bf Total \eTD<br />
\bTD 78.54 \eTD<br />
\eTR<br />
\eTABLE<br />
</context><br />
<br />
=== Rules with different thickness ===<br />
<br />
There is only one value for all four borders. However, MetaPost can be used as a workaround until the separate "rulethickness" values are implemented.<br />
<br />
The following example (mkiv only!) by Wolfgang Schuster shows a table using MetaPost for the rules:<br />
<br />
<context source=yes mode=mkiv text="gives:"><br />
\startuseMPgraphic{tableborders}<br />
<br />
draw leftboundary OverlayBox withpen pensquare scaled \frameddimension {leftrulethickness} ;<br />
draw rightboundary OverlayBox withpen pensquare scaled \frameddimension {rightrulethickness} ;<br />
draw topboundary OverlayBox withpen pensquare scaled \frameddimension {toprulethickness} ;<br />
draw bottomboundary OverlayBox withpen pensquare scaled \frameddimension{bottomrulethickness} ;<br />
<br />
clip currentpicture to OverlayBox<br />
leftenlarged (\frameddimension {leftrulethickness}/2)<br />
rightenlarged (\frameddimension {rightrulethickness}/2)<br />
topenlarged (\frameddimension {toprulethickness}/2)<br />
bottomenlarged (\frameddimension{bottomrulethickness}/2) ;<br />
<br />
setbounds currentpicture to OverlayBox ;<br />
<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[tableborders][\useMPgraphic{tableborders}]<br />
<br />
\startsetups tableborders<br />
<br />
\setupTABLE<br />
[ background={color,tableborders},<br />
frame=off,<br />
backgroundoffset=0pt,<br />
leftrulethickness=\framedparameter{rulethickness},<br />
rightrulethickness=\framedparameter{rulethickness},<br />
toprulethickness=\framedparameter{rulethickness},<br />
bottomrulethickness=\framedparameter{rulethickness}]<br />
<br />
\setupTABLE[row] [odd] [backgroundcolor=lightgray]<br />
\setupTABLE[row] [first][backgroundcolor=gray,bottomrulethickness=2pt]<br />
\setupTABLE[row] [last] [toprulethickness=2pt,bottomrulethickness=2pt]<br />
\setupTABLE[first][last] [leftrulethickness=2pt]<br />
\setupTABLE[last] [last] [rightrulethickness=2pt]<br />
<br />
\stopsetups<br />
<br />
\starttext<br />
<br />
\bTABLE<br />
\dorecurse{7}{\bTR\dorecurse{3}{\bTD#1-##1\eTD}\eTR}<br />
\eTABLE<br />
<br />
\blank<br />
<br />
\bTABLE[setups=tableborders]<br />
\dorecurse{7}{\bTR\dorecurse{3}{\bTD#1-##1\eTD}\eTR}<br />
\eTABLE<br />
<br />
\stoptext<br />
</context><br />
<br />
See the corresponding thread on the list: [http://www.ntg.nl/pipermail/ntg-context/2011/058549.html rules with different thickness]<br />
<br />
=== Thick bottom rules ===<br />
<br />
This is a simplified version of the example above (corresponding mailing thread - [http://www.ntg.nl/pipermail/ntg-context/2012/069541.html TABLE: header with a thick bottom line]).<br />
<br />
<context source=yes mode=mkiv text="Gives:"><br />
\startuseMPgraphic{MP:thickBtm}<br />
draw bottomboundary OverlayBox withpen pensquare scaled \frameddimension{bottomrulethickness};<br />
clip currentpicture to OverlayBox;<br />
setbounds currentpicture to OverlayBox;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[OL:thickBtm][\useMPgraphic{MP:thickBtm}]<br />
<br />
\starttext<br />
\bTABLE<br />
\setupTABLE[align=middle]<br />
\setupTABLE[header][background={OL:thickBtm},bottomrulethickness=4pt]<br />
\setupTABLE[row][4][background={OL:thickBtm},bottomrulethickness=2pt]<br />
%<br />
\bTABLEhead\bTR\dorecurse{3}{\bTH#1\eTH}\eTR\eTABLEhead<br />
\bTABLEbody\dorecurse{6}{\bTR\dorecurse{3}{\bTD#1-##1\eTD}\eTR}\eTABLEbody<br />
\eTABLE<br />
\stoptext<br />
</context><br />
<br />
=== Diagonal rules ===<br />
<br />
Sometimes a diagonal rule is required in the top left corner cell of a table to create two fields, one for the left column and one for the top row.<br />
<br />
<br />
<context mode="mkiv" source="yes" text="Gives:"><br />
\startuseMPgraphic{DiagonalRule}<br />
rulethickness := \frameddimension{rulethickness};<br />
<br />
drawoptions(<br />
withpen pencircle scaled rulethickness<br />
withcolor \MPcolor{\framedparameter{framecolor}});<br />
<br />
pair leftcorner, rightcorner;<br />
leftcorner := (rulethickness, \overlayheight-rulethickness);<br />
rightcorner := (\overlaywidth-rulethickness, rulethickness);<br />
<br />
draw leftcorner -- rightcorner;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay<br />
[DiagonalRule]<br />
[\useMPgraphic{DiagonalRule}]<br />
<br />
\define[2]\DiagonalLabel{%<br />
\setuptabulate [after={\blank[\frameddimension{offset}]}]<br />
\starttabulate [|p|r|]<br />
\NC \NC #2 \NC\NR<br />
\NC #1 \NC \NC\NR<br />
\stoptabulate<br />
}<br />
<br />
\starttext<br />
\setupTABLE [row] [1] [width=2cm]<br />
\bTABLE<br />
\bTR<br />
\bTD [background=DiagonalRule]<br />
\DiagonalLabel{Foo}{Bar}<br />
\eTD<br />
\bTD Second \eTD<br />
\bTD Third \eTD<br />
\eTR<br />
\bTR<br />
\bTD Alpha \eTD<br />
\bTD Beta \eTD<br />
\bTD Gamma \eTD<br />
\eTR<br />
\eTABLE<br />
\stoptext<br />
</context><br />
<br />
This solution has (at least) one caveat: Because the first<br />
tabulate column is set in paragraph mode, it will eat up as much<br />
space as <em>possible</em>, in contrast to occupying as much space as<br />
</em>necessary</em>. That is why the width of the column has to be set<br />
explicitly.<br />
<br />
== Using character alignment ==<br />
<br />
ConTeXt can align columns of numbers on a character (often a decimal point to align accounting data) automatically, removing the need to add fixed spaces into your document. For any such column you need to specify the character on which to align. You use the <tt>aligncharacter=yes</tt> parameter to set up character alignment, <tt>alignmentcharacter={.}</tt> to say what the character should be (in this case a full stop) and <tt>align=middle</tt> to set the overall alignment of the column.<br />
<br />
<table><tr valign="top"><td><br />
<texcode><br />
\bTABLE<br />
\setupTABLE[column][1][align=right]<br />
\setupTABLE[column][2][alignmentcharacter={.},<br />
aligncharacter=yes,align=middle]<br />
\bTR \bTH Category \eTH \bTH Data entry \eTH \eTR<br />
\bTR \bTD First \eTD \bTD 71.3 \eTD \eTR<br />
\bTR \bTD Second \eTD \bTD 43.7 \eTD \eTR<br />
\bTR \bTD Total \eTD \bTD 115 \eTD \eTR<br />
\eTABLE<br />
</texcode><br />
</td><td><br />
<context><br />
\setuppapersize[A5]<br />
\bTABLE<br />
\setupTABLE[column][1][align=right]<br />
\setupTABLE[column][2][alignmentcharacter={.},aligncharacter=yes,align=middle]<br />
\bTR \bTH Category \eTH \bTH Data entry \eTH \eTR<br />
\bTR \bTD First \eTD \bTD 71.3 \eTD \eTR<br />
\bTR \bTD Second \eTD \bTD 43.7 \eTD \eTR<br />
\bTR \bTD Total \eTD \bTD 115 \eTD \eTR<br />
\eTABLE<br />
</context><br />
</td></tr></table><br />
<br />
You'll note that the final line, because it has no <code>.</code> in the number, gets aligned under the right-hand side of the numbers. In most circumstances you would want such a number aligned with the left-hand set of digits. To so do, issue the following command in your preamble:<br />
<br />
<texcode><br />
\chardef\characteralignmentmode=2<br />
</texcode><br />
<br />
and now the table above will turn out like this:<br />
<br />
<context><br />
\setuppapersize[A5]<br />
\chardef\characteralignmentmode=2<br />
\bTABLE<br />
\setupTABLE[column][1][align=right]<br />
\setupTABLE[column][2][alignmentcharacter={.},aligncharacter=yes,align=middle]<br />
\bTR \bTH Category \eTH \bTH Data entry \eTH \eTR<br />
\bTR \bTD First \eTD \bTD 71.3 \eTD \eTR<br />
\bTR \bTD Second \eTD \bTD 43.7 \eTD \eTR<br />
\bTR \bTD Total \eTD \bTD 115 \eTD \eTR<br />
\eTABLE<br />
</context><br />
<br />
If there's no <code>alignmentcharacter</code> in the cell, the content will be aligned in the following way depending on the value of <code>\characteralignmentmode</code>:<br />
<table style="border:1px solid #DDDDDD;"><br />
<tr style="background-color:#DDDDDD; font-weight: bold;"><td>mode</td><td width="200"></td><td>.</td><td width="200"></td></tr><br />
<tr><td style="background-color:#DDDDDD" align="center">0</td><td colspan="3" align="center">centered</td></tr><br />
<tr style="background-color:#EEEEEE;"><td style="background-color:#DDDDDD" align="center">1</td><td align="left">left in before</td><td style="background-color:#DDDDDD">.</td><td></td></tr><br />
<tr><td style="background-color:#DDDDDD" align="center">2</td><td align="right">right in before</td><td style="background-color:#DDDDDD">.</td><td></td></tr><br />
<tr style="background-color:#EEEEEE;"><td style="background-color:#DDDDDD" align="center">3</td><td></td><td style="background-color:#DDDDDD">.</td><td align="left">left in after</td></tr><br />
<tr><td style="background-color:#DDDDDD" align="center">4</td><td></td><td style="background-color:#DDDDDD">.</td><td align="right">right in after</td></tr><br />
</table><br />
<br />
== Specifying the cell column ==<br />
<br />
When writing a table you can omit empty cells and define only cells for specified columns. To have this feature fully available you need to have a beta or a quite fresh ConTeXt version.<br />
<br />
Two methods are available:<br />
<br />
* With the TD "n" option, the undefined cells are merged into a single spanned cell.<br />
* With the TD "m" option, the undefined cells appear as empty normal cells.<br />
<br />
Here is an example using the "n" option:<br />
<br />
<context source=yes><br />
\setuppapersize[A5]<br />
\bTABLE[width=3em]<br />
\bTR\bTD d1 \eTD\bTD[n=2] d2 \eTD\bTD[n=5] d5 \eTD\bTD[n=7] d7 \eTD\eTR<br />
\bTR\bTD f1 \eTD\bTD[n=4] f4 \eTD\bTD[n=5] f5 \eTD\bTD[n=7] f7 \eTD\eTR<br />
\eTABLE<br />
</context><br />
<br />
Here is an example using the "m" option:<br />
<br />
<context source=yes><br />
\setuppapersize[A5]<br />
\bTABLE[width=3em]<br />
\bTR\bTD d1 \eTD\bTD[m=2] d2 \eTD\bTD[m=5] d5 \eTD\bTD[m=7] d7 \eTD\eTR<br />
\bTR\bTD f1 \eTD\bTD[m=4] f4 \eTD\bTD[m=5] f5 \eTD\bTD[m=7] f7 \eTD\eTR<br />
\eTABLE<br />
</context><br />
<br />
== Round corners ==<br />
<br />
For a different approach for round corners and colored background follow the text after this example.<br />
<br />
It is possible to round the corners of the table if you turn off the main frame of the table and frame the table in {{cmd|framed}}. Compare two different approaches in the first and second example.<br />
<br />
You can't color the background of the table with round corners unless the frame rulethickness is not big enough to cover the rectangular corners of the background (second example). Well, you can if you frame the table twice. Once in the thick white frame and then in the thin frame with negative offset and slightly smaller corner radius (third example). Be aware of other complications -- notice that the thick white frame is still visible in the text above it.<br />
<br />
<context source="yes"><br />
\starttext<br />
\setupcolors[state=start] <br />
%\showstruts<br />
\setupTABLE[background=color,backgroundcolor=yellow]<br />
\setupframed[framecolor=darkgreen]<br />
<br />
\defineparagraphs[ThreeCols]<br />
<br />
\startThreeCols<br />
<br />
First<br />
<br />
\def\StartTable<br />
{\setupTABLE[row] [first][topframe=off]%<br />
\setupTABLE[row] [last] [bottomframe=off]%<br />
\setupTABLE[column][first][leftframe=off]%<br />
\setupTABLE[column][last] [rightframe=off]%<br />
\framed[strut=no,corner=round,offset=.5\linewidth]<br />
\bgroup}<br />
<br />
\def\StopTable<br />
{\egroup}<br />
<br />
\StartTable<br />
\bTABLE<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\eTABLE<br />
\StopTable<br />
<br />
\nextThreeCols<br />
<br />
Second<br />
<br />
\setupTABLE[row] [first][topframe=off]<br />
\setupTABLE[row] [last] [bottomframe=off]<br />
\setupTABLE[column][first][leftframe=off]<br />
\setupTABLE[column][last] [rightframe=off]<br />
\framed[strut=no,corner=round,offset=.5\linewidth,,rulethickness=1mm]\bgroup<br />
\bTABLE<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\eTABLE<br />
\egroup<br />
<br />
\nextThreeCols<br />
<br />
Third<br />
<br />
\setupTABLE[row] [first][topframe=off]<br />
\setupTABLE[row] [last] [bottomframe=off]<br />
\setupTABLE[column][first][leftframe=off]<br />
\setupTABLE[column][last] [rightframe=off]<br />
\framed[strut=no,corner=round,<br />
radius=1.4mm,offset=-1mm,,rulethickness=.1mm]\bgroup<br />
\framed[strut=no,corner=round,<br />
radius=1.5mm,offset=0mm,,rulethickness=1mm,framecolor=white]\bgroup<br />
\bTABLE<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\bTR \bTD test \eTD \bTD test \eTD \eTR<br />
\eTABLE<br />
\egroup<br />
\egroup<br />
<br />
\stopThreeCols<br />
<br />
\stoptext<br />
</context><br />
<br />
From 2006-10-11 on, ConTeXt contains one more mechanism for round corners. Watch the example:<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
\starttext<br />
\setupcolors[state=start]<br />
\setupTABLE [y] [first][background=color,backgroundcolor=blue,frame=off,bottomframe=on,topframe=on,framecolor=white]<br />
\setupTABLE [first][first][backgroundcorner=2,corner=10,frame=on]<br />
\setupTABLE [last] [first][backgroundcorner=4,corner=12,frame=on]<br />
\setupTABLE [row] [each] [background=color,backgroundcolor=blue,frame=on,framecolor=white]<br />
\setupTABLE [first][2] [corner=8]<br />
\setupTABLE [last] [2] [corner=5]<br />
\setupTABLE [first][last] [corner=7]<br />
\setupTABLE [last] [last] [corner=6]<br />
<br />
\bTABLE[frame=off,align=middle]<br />
\bTR \bTD one \eTD \bTD two \eTD \bTD three \eTD \eTR<br />
\bTR \bTD first \eTD \bTD second \eTD \bTD third \eTD \eTR<br />
\bTR \bTD alpha \eTD \bTD beta \eTD \bTD gamma \eTD \eTR<br />
\eTABLE<br />
\stoptext<br />
</context><br />
<br />
== Other options ==<br />
<br />
Some other useful options that were not covered above:<br />
* <tt>align=yes</tt> will align the text both left and right justified<br />
* <tt>loffset</tt>, <tt>roffset</tt>, <tt>toffset</tt>, <tt>boffset</tt> can be used in addition to <tt>offset</tt> to specify cell content offsets in each direction separately, see also {{cmd|framed}}<br />
<br />
= TABLEs with old table syntax =<br />
<br />
From the mailing list in March 2009, by Wolfgang Schuster and Hans Hagen:<br />
<br />
<texcode><br />
\def\startTABLE<br />
{\dosingleempty\dostartTABLE}<br />
<br />
\def\dostartTABLE[#1]%<br />
{\bgroup<br />
\bTABLE[#1]%<br />
\let\NC\doTABLENC<br />
\let\NR\doTABLENR<br />
\let\bTR\relax<br />
\let\bTD\relax<br />
\let\bTH\relax<br />
\let\bTN\relax}<br />
<br />
\def\stopTABLE<br />
{\eTABLE<br />
\egroup}<br />
<br />
\newconditional\inTABLEnc<br />
<br />
\unexpanded\def\doTABLENR<br />
{\eTR<br />
\setfalse\inTABLEnc}<br />
<br />
\unexpanded\def\doTABLENC<br />
{\futurelet\next\dodoTABLENC}<br />
<br />
\def\dodoTABLENC<br />
{\ifx\next\doTABLENR \else<br />
\expandafter\dododoTABLENC<br />
\fi}<br />
<br />
\long\def\dododoTABLENC#1\NC<br />
{\ifconditional\inTABLEnc\else\settrue\inTABLEnc\parseTR[][]\fi<br />
\dodoubleempty\parseTD#1\eTD\NC}<br />
</texcode><br />
<br />
This is now part of the core as the [[source:tabl-nte.tex|NTE module]]. Quoting its internal documentation:<br />
<br />
This module is suggested by Wolfgang Schuster who also prototyped it and came up with the rationale:<br />
<br />
This module provides an easy way to use natural in a similiar way as the older table module (based on the [[TABLE]] macros) and the newer [[tabulate]] module.<br />
<br />
You can see the advantage in the following table, once created with the new macros and once with the normal macros provided with the natural table module.<br />
<br />
Let us start with the original macros:<br />
<br />
<texcode><br />
\bTABLE<br />
\bTR<br />
\bTD Text 1 \eTD<br />
\bTD Text 2 \eTD<br />
\eTR<br />
\bTR<br />
\bTD Text 3 \pasteeTD<br />
\bTD Text 4 \eTD<br />
\eTR<br />
\eTABLE<br />
</texcode><br />
<br />
Watch how the new macros use less code:<br />
<br />
<texcode><br />
\startTABLE<br />
\NC Text 1 \NC Text 2 \NC\NR<br />
\NC Text 3 \NC Text 4 \NC\NR<br />
\stopTABLE<br />
</texcode><br />
<br />
The actual code differs from the prototype that it does not need to collect whole rows and parse them but looks ahead instead.<br />
<br />
= Get current row/column number =<br />
See for example here: [[Command/currentTABLErow]]<br />
<br />
[[Category:Tables]]<br />
[[Category:XML]]<br />
tt>\bTD</div>Peterhttps://wiki.contextgarden.net/index.php?title=Humour&diff=21408Humour2013-01-30T21:44:50Z<p>Peter: link to Arthur's message</p>
<hr />
<div>== A poem about documentation ==<br />
<br />
"Yet another context user" posted [http://archive.contextgarden.net/message/20100403.155801.7098c48a.en.html this poem] to the mailing list<br />
<br />
<pre><br />
If you were surprised, like me<br />
Fifty emails, in your inbox to see<br />
<br />
Let me help you with a summary<br />
Of what happended, using a poor excuse for poetry <br />
<br />
It was the day of fools<br />
When Arthur tried to be cool<br />
<br />
In ConTeXt mailing list he shouted, "Look<br />
I am going to write a ConTeXt book!"<br />
<br />
Everyone was happy and had a thrill<br />
Till Martin said, "it is the first of April"<br />
<br />
His joke ruined, Arthur was sad<br />
He said Martin, this is bad<br />
<br />
Other users were also upset, taken for a ride<br />
The lack of a book, is not a matter of pride<br />
<br />
There were cries and a big fuss<br />
I was just getting started, said Russ<br />
<br />
After that comments did pour<br />
Its not even funny, said Gour<br />
<br />
All of us would be out of luck<br />
If Hans were to be hit by a bus!<br />
<br />
Citing Douglas Adams said Taco<br />
That will make the bus, a shamed loco<br />
<br />
In time back it 'ill go<br />
And slam its breaks, like a pro<br />
<br />
Writing documentation is no fun<br />
It that the reason it is shun<br />
<br />
Even if you do write something<br />
Does anyone even read the damn thing?<br />
<br />
Taco lamented all he hears is that 'it sucks'<br />
Demotivated, he may just pass the buck<br />
<br />
"Oh please, don't let the project slack<br />
If you write something, we will give you feedback"<br />
<br />
This circle of arguments is always repeated<br />
Whenever the question of documentation gets tweeted<br />
<br />
A new conspiracy theory was added this time<br />
"They want to keep it a secret," it's a crime<br />
<br />
I am sick and tired of all the pretext<br />
Why do you think anyone should write a book on ConTeXt?<br />
<br />
Taco and Hans, their hands are full<br />
Everyone else is just using a tool<br />
<br />
(Actually when I was writing this chronology<br />
Irdis was thinking about a typographical ontology)<br />
<br />
If you think that the documentation is lacking<br />
Do something, rather than grumbling<br />
<br />
Here's a suggestion, if I may give to thee<br />
Follow it, and you'll be a ConTeXt prodigee<br />
<br />
Pick up a pen and go 'n write<br />
On any part of ConTeXt that you like<br />
<br />
A wiki article, a blog post, are good places to start<br />
People reading them will relish the knowledge it imparts<br />
<br />
Write an example, show how things work<br />
Don't just hide there and lurk<br />
<br />
If nothing else, write about what you find confusing<br />
Others writing documentation may find it motivating<br />
<br />
On this note, this summary I'll end<br />
You were not offended, I'll pretend<br />
<br />
Finally a request, if I may<br />
Let me be anonymous, please, I pray<br />
<br />
A promise in passing, I'll also make<br />
Someday a ConTeXt book or tutorial, I may bake<br />
<br />
I am waiting for time and a muse<br />
At least, that is my excuse<br />
<br />
<br />
<br />
-- A ConTeXt User<br />
<br />
<br />
</pre><br />
<br />
* Later in the thread Idris told how his name should be pronounced<br />
<pre><br />
&gt;&gt;&gt; (Actually when I was writing this chronology<br />
&gt;&gt;&gt; Irdis was thinking about a typographical ontology)<br />
&gt;&gt;<br />
&gt;&gt; Who is this Irdis?<br />
<br />
&gt; Oh, my heart now bleeds<br />
&gt; That I couldn't spell the name of Prof Hamid<br />
<br />
Our anonymous YACU ran, slipped and had to skid,<br />
Neither did (s)he know how to rhyme with Hamid<br />
<br />
Accent in Hamid is on the first syllable,<br />
Otherwise pronouncing it will be untenable<br />
</pre><br />
<br />
Not a poem, but well written:<br />
[http://www.ntg.nl/pipermail/ntg-context/2010/048197.html by Arthur]<br />
<br />
== What if Hans were hit by a bus ==<br />
* Taco's brilliant [http://archive.contextgarden.net/message/20100403.065454.97ad25ba.en.html answer] to this question<br />
<br />
<pre><br />
&gt; This raises another concern and that is: what is the future of ConTeXt<br />
&gt; is Hans "get hit by the bus"? (Of course, we even do not want to think<br />
&gt; about it...)<br />
<br />
The answer to this question is quite obvious if you have read Douglas<br />
Adams' books: the bus will think about the impact of its actions on the<br />
universe for a moment. Then, deeply immersed in gut-wrenching shame,<br />
it will travel back in time half a minute and push its own breaks for<br />
an emergency stop.<br />
</pre><br />
<br />
== latex and LaTeX ==<br />
<br />
Taco Hoekwater [http://archive.contextgarden.net/message/20100911.100030.b6e30e98.en.html explaining] the similarity between latex and LaTeX<br />
<br />
<blockquote><br />
Creating beautiful latex garments is at least as challenging as creating beautiful LaTeX documents (I<br />
tried, in earlier days). And just like in LaTeX, the problem areas are glue control and insert<br />
placement. Selling latex garments is also similar to selling LaTeX books: it is quite a niche market and your clients are considered fetishists by most other people.<br />
</blockquote><br />
<br />
== ConTeXt logic ==<br />
<br />
Steffen Wolfrum [http://www.mail-archive.com/ntg-context@ntg.nl/msg22409.html bewildered] at ConTeXt syntax:<br />
<br />
<blockquote><br />
Sometimes ConTeXt's syntax looks kind of "female" to me:<br />
It certainly has an inner logic, but this is far more ... rich and varied as my <br />
single-minded, male structured mind would expect -)<br />
</blockquote><br />
<br />
== Where is my update? ==<br />
<br />
Vnpenguin was [http://www.mail-archive.com/ntg-context@ntg.nl/msg47711.html confused] why he was not able to update ConTeXt, until Hans resolved the mystery.<br />
<br />
<pre><br />
> Since one week, I update my minimal ConTeXt almost everyday (Win32<br />
> version), but the version is alway the same:<br />
<br />
sure, as i didn't update context for a week<br />
</pre><br />
<br />
== Can you run it for me? ==<br />
<br />
Peter Rolf asking R. Bastian [http://www.mail-archive.com/ntg-context@ntg.nl/msg49587.html not to be afraid]:<br />
<br />
<blockquote><br />
<p><br />
&gt; Does this work in Mk II ?<br />
</p><br />
<br />
<p><br />
You can set your mind at rest and test it yourself.<br />
The 'nuke_my_computer_by_running_context' module is no longer part of<br />
the official distribution ;-)<br />
</p><br />
</blockquote><br />
<br />
== Finite Life ==<br />
<br />
The following exchange between the Philosophers Ludovicus Scarso<br />
and Ioannes Hagenius could be observed on the mailing list[http://archive.contextgarden.net/message/20101218.131804.c250b741.en.html].<br />
<pre><br />
> Live is too short to learn all those languages and stay<br />
> fluent in them, i.e. one simply forgets a lot when usage zeros.<br />
we should start to think how to to become immortal.<br />
</pre><br />
<br />
== Installation chant ==<br />
<br />
Patrick shared this conversation on 2011-12-21:<br />
<pre><br />
Hello Marek,<br />
<br />
> Hi Mr. Gundla<br />
> Just want to say Im very dissapointed that no installing package of ConText exist. <br />
> I mean like you install things in Win – two cliks and Done!<br />
> I was studying ConText whole afternoon and i liked it – But – im very very sick of this kind of installing. <br />
> It just makes people like me to hate the whole thing about trying something else then MS Word. <br />
> I was eager to learn this ConText ant than BIIIIIIG! Frustration cause i could not run it. <br />
> All those versions of packages - i wanted to shoot myself.<br />
<br />
> Yea, i know you dont get paid for this, BUT - come on Mr. Gundla. <br />
> Is it that hard to make one ABSOLUTE DUMMY PACKAGE (you geeks can call it <br />
> how you want i know you like to use word dummies for people who are lesser geeks than you :) ) <br />
> two cliks and lalala! <br />
> Hello Word! You save afternoon to many other people :D Just think about it, ok?<br />
<br />
Well, ConTeXt _is_ hard to install. First you have to sacrifice one of your family members. <br />
Afterwards, you need to hum the magic chant in order to open your spirit. <br />
After you have done that, please draw a circle around your computer and put candles on it, making the shape of a pentagram. <br />
Now, and this is important, go six times clockwise around that circle, six times counter clockwise <br />
and then six times clockwise again. <br />
After that, turn on your computer and start your webbrowser and go to<br />
<br />
http://wiki.contextgarden.net/Simple_Windows_Installation<br />
<br />
and download the installer.<br />
<br />
Sincerely your Mr. Gundla<br />
</pre><br />
<br />
== Wolfgang Interface ==<br />
<br />
> Gosh this list is nice! Reminds me of the "good old days" when we<br />
> used UUCP, bang-paths and C-News to communicate (or the early<br />
> ARPANET days): polite, expert, very willing to share knowledge &c.<br />
<br />
Wolfgang is ConTeXt's natural language interface.<br />
<br />
In fact, with careful use of the filter module and a couple of mail<br />
programs, it should be possible to create something like:<br />
<texcode><br />
\usemodule[filter]<br />
<br />
\defineexternalfilter<br />
[wolfgang]<br />
[filtercommand={ ... code to send email and fetch reply ... },<br />
cache=yes]<br />
<br />
\startwolfgang<br />
Hello list,<br />
<br />
I wonder if anyone could tell me how to implement the following in<br />
ConTeXt.<br />
<br />
... description goes here ...<br />
\stopwolfgang<br />
</texcode><br />
It's important to include the cache=yes, so Wolfgang only has to reply<br />
once.<br />
<br />
= Comparison between various TeX and GUI systems =<br />
<br />
William Adam on the difference between [[Comparison_between_ConTeXt_and_other_typesetting_programs|TeX and other GUI document design systems]]<br />
<br />
= Pictures =<br />
<br />
== Future ConTeXt Users ==<br />
[[Future ConTeXt Users]]<br />
<br />
== Super Wolfgang ==<br />
<br />
A [http://meeting.contextgarden.net/2010/talks/2010-09-17-closing/wolfgang-color.jpg cartoon] by Duane Bibby at the Fourth ConTeXt meeting</div>Peterhttps://wiki.contextgarden.net/index.php?title=Layers&diff=21373Layers2013-01-12T11:28:20Z<p>Peter: add explanation from Wolfgang</p>
<hr />
<div>< [[Layout]] | [[Columns]] | [[Overlays]] | [[Logos]] | [[Collectors]] ><br />
<br />
'''Layers''' are ConTeXt's mechanism for absolute positioning of elements and other advanced techniques like switching elements on and off.<br />
<br />
There's still no manual about them.<br />
<br />
==My first Layer==<br />
<br />
Define a layer that takes the whole page<br />
<texcode><br />
\definelayer[mybg] % name of the layer<br />
[x=0mm, y=0mm, % from upper left corner of paper<br />
width=\paperwidth, height=\paperheight] % let the layer cover the full paper<br />
</texcode><br />
<br />
Now you can put something in that layer:<br />
<texcode><br />
\setlayer[mybg] % name of the layer<br />
[hoffset=1cm, voffset=1cm] % placement (from upper left corner of the layer)<br />
{\framed[frame=on, width=3cm, height=2cm]{LAYER}} % the actual contents of the layer<br />
</texcode><br />
<br />
Activate the layer as a background:<br />
<texcode><br />
\setupbackgrounds[page][background=mybg]<br />
</texcode><br />
This command makes the contents of the layer appear only once after the background is activated. If you want to repeat the contents of the layer on each page, use the option <code>repeat=yes</code> in the {{cmd|definelayer}} command. Then the contents of the layer will be shown on every page. You can add to these contents by a new {{cmd|setlayer}}[mybg] command. To clear the accumulated contents use {{cmd|resetlayer}}>[mybg]. To make the layer appear on each page, so that it can be populated with different content, set the option <code>state=repeat</code> in {{cmd|setupbackgrounds}}.<br />
<br />
Now you can test the whole thing:<br />
<context source=yes><br />
\setuppapersize[A10][A9,landscape]<br />
\setuparranging[2UP] % two pages side by side<br />
\showframe % show entire pages<br />
<br />
\definelayer[mybg] % name of the layer<br />
[x=0mm, y=0mm, % from upper left corner of paper<br />
width=\paperwidth, height=\paperheight, % let the layer cover the full paper<br />
]<br />
<br />
\setupbackgrounds[page][background=mybg]<br />
<br />
\setlayer[mybg] % name of the layer<br />
[hoffset=0.2cm, voffset=0.2cm] % placement (from upper left corner of the layer)<br />
{\framed[frame=on, width=2cm, height=1cm]{LAYER}} % the actual contents of the layer<br />
<br />
\starttext<br />
<br />
\dorecurse{2}{\page[empty]} % for testing, to get 2 pages, 1st with layer, 2nd without<br />
<br />
\stoptext<br />
<br />
</context><br />
<br />
<br />
==Placement==<br />
<br />
There are several possibilities for defining the placement of layer content:<br />
* x, y : offset from upper left corner of paper [=the current block; can sometimes be the text area instead of the page/paper!]<br />
* hoffset, voffset : offset from upper left corner of layer<br />
* corner : reference point, something like <code>{left, top}</code><br />
* location : alignment of the element relative to the corner, something like <code>{right, bottom}</code><br />
* preset : a named location, see below<br />
<br />
There are some "presets" for paper edge placement:<br />
<texcode><br />
% These four are defined by ConTeXt!<br />
\definelayerpreset [lefttop] [corner={left,top}, location={right,bottom}]<br />
\definelayerpreset [righttop] [corner={right,top}, location={left,bottom}]<br />
\definelayerpreset [leftbottom] [corner={left,bottom}, location={right,top}]<br />
\definelayerpreset [rightbottom] [corner={right,bottom}, location={left,top}]<br />
</texcode><br />
Similarly you can define your own presets.<br />
<br />
==State==<br />
<br />
The available options for the "state" of a layer are:<br />
<br />
* start: layer appears only on the current page<br />
* stop: layer doesn't show up<br />
* repeat: layer prints on all pages<br />
* next: layer appears on the following page<br />
* continue: layer appears on all pages except the first<br />
<br />
==Line breaking and fixed size==<br />
<br />
You may experience cases where the defined size of your layer is ignored and you can’t get linebreaking or multiple lines at all.<br />
This is due to <cmd>setlayer</cmd> using <cmd>hbox</cmd> internally. You can work around the problem using <cmd>setlayerframed</cmd>:<br />
<br />
<context source=yes><br />
\setuppapersize[A6]<br />
<br />
\definelayer[AddressBg][<br />
x=20mm, y=30mm, <br />
width=65mm, height=30mm, <br />
state=start] % size is ignored!<br />
\setupbackgrounds[paper][<br />
setups=ALayer, <br />
background=AddressBg, <br />
state=start]<br />
<br />
\starttext<br />
\strut<br />
\startsetups ALayer<br />
\setlayer[AddressBg] % Change this to \setlayerframed to get it to work<br />
[width=65mm, height=30mm,<br />
frame=off,<br />
hoffset=0mm, voffset=0mm,<br />
align=right] % You must set align to get multiple lines!<br />
{<br />
PRAGMA Advanced Document Engineering\crlf<br />
Mr. Hans Hagen (the wizard who wrote it all, \CONTEXT\ and everything else, <br />
with the help of his little elves)\crlf<br />
Ridderstraat 27\crlf<br />
8061GH Hasselt\crlf<br />
THE NETHERLANDS<br />
}<br />
\stopsetups<br />
\stoptext<br />
</context><br />
<br />
<br />
==Place labels on pictures==<br />
<br />
Layers can be used to put labels on pictures, alternative ways can be found in the [[manual:details.pdf| Details]] manual<br />
(see also [[Collectors]]).<br />
<br />
<context source="yes"><br />
\setupexternalfigures[location={local,default}]<br />
% (necessary for the wiki conTeXt live processor)<br />
<br />
\definelayer [figure][width=\overlaywidth,height=\overlayheight]<br />
\defineoverlay[figure][{\directsetup{figure}\tightlayer[figure]}]<br />
<br />
\setupcolors[state=start]<br />
<br />
\starttext<br />
<br />
\startsetups figure<br />
<br />
\setlayerframed<br />
[figure]<br />
[preset=rightbottom,<br />
x=.25\layerwidth,<br />
y=.25\layerheight]<br />
{\green HERE}<br />
<br />
\setlayerframed<br />
[figure]<br />
[preset=leftbottom,<br />
x=.15\layerwidth,<br />
y=.35\layerheight]<br />
{\red THERE}<br />
<br />
\stopsetups<br />
<br />
\externalfigure[cow][background={foreground,figure},width=4cm,height=3cm]<br />
<br />
\stoptext<br />
</context><br />
<br />
==Use dynamic content==<br />
<br />
The content of layer is fixed after your set it and will appear in the same way on each page.<br />
<br />
<texcode><br />
\definelayer<br />
[pagenumber]<br />
[width=\paperwidth,<br />
height=\paperheight,<br />
preset=middle,<br />
state=repeat]<br />
<br />
\setlayer[pagenumber]{Page \pagenumber}<br />
<br />
\setupbackgrounds[page][background=pagenumber]<br />
<br />
\starttext<br />
\dorecurse{4}{\page[empty]} % Every page will say "Page 1"<br />
\stoptext<br />
</texcode><br />
<br />
This is not always what you desire like in the example above, where on each page the current page number should be shown and not the number from the first page.<br />
<br />
To recalculate the content on each new page you have to enclose the <cmd>setlayer</cmd> settings within <cmd>startsetups</cmd> ... <cmd>stopsetups</cmd> and<br />
write <code>\setupbackgrounds[page][setups=setupname,background=layername]</code> in your document.<br />
<br />
<texcode><br />
\definelayer<br />
[pagenumber]<br />
[width=\paperwidth,<br />
height=\paperheight,<br />
preset=middle]<br />
<br />
\startsetups layer<br />
<br />
\setlayer[pagenumber]{Page \pagenumber}<br />
<br />
\stopsetups<br />
<br />
\setupbackgrounds[page][setups=layer,background=pagenumber]<br />
<br />
\starttext<br />
\dorecurse{4}{\page[empty]} % You get "Page 1, Page 2" etc.<br />
\stoptext<br />
</texcode><br />
<br />
<br />
Another solution was given by Wolfgang on the mailing list on February 21, 2012. He writes: ''Here is a slightly different version which is better when you need more dynamic layers.''<br />
<br />
<texcode><br />
<br />
\definelayer [pagenumber][width=\overlaywidth,height=\overlayheight,preset=middle]<br />
\defineoverlay[pagenumber][\texsetup{layer}]<br />
<br />
\startsetups layer<br />
<br />
\setlayer[pagenumber]{Page \pagenumber}<br />
<br />
\tightlayer[pagenumber]<br />
<br />
\stopsetups<br />
<br />
\setupbackgrounds[page][setups=layer,background=pagenumber]<br />
<br />
\starttext<br />
\dorecurse{4}{\page[empty]}<br />
\stoptext<br />
<br />
</texcode><br />
<br />
== Layers and the delayed font mechanism ==<br />
<br />
Until some years ago the Latin Modern font was always automatically<br />
loaded, regardless of the users choice of font. Font loading takes a<br />
considerable amount of time (check the stats at the end of a context<br />
run to get an idea). This led to the question:<br />
<br />
“Why start loading a big, complex font like Latin Modern before we<br />
know which font the user actually wants to use and waste several<br />
seconds on it, just to start loading the users choice afterwards?”<br />
<br />
The answer was:<br />
<br />
”We delay loading the font until we know which font the user wants<br />
to use. If the user doesn't tell us, then we fall back to Latin<br />
Modern.”<br />
<br />
The body font is set up in the setup area (the part above<br />
<code>\starttext</code>). That, in turn, means that when having reached<br />
<code>\starttext</code>, the users choice of font is known and can be loaded. It<br />
is more efficient if a font other then Latin Modern is used.<br />
<br />
One drawback is that typeset text in the setup area has no font<br />
setup and will fall back to Latin Modern Mono. Usually no text is<br />
typeset in the setup area. However, layers are an exception and<br />
a font needs to be set up beforehand.<br />
<br />
== See Also ==<br />
<br />
* Some applications in the [[manual:details.pdf|Details]] manual<br />
* [[Sample documents]]: [[BusinessCard]] and [[Letter style]]<br />
* Source: [[source:pack-lyr.mkii|pack-lyr.mkii]] or [[source:pack-lyr.mkiv|pack-lyr.mkiv]]<br />
* Example of [[Alternating backgrounds and repeating layers]] and [[Draft Watermark]]<br />
* [http://www.ntg.nl/pipermail/ntg-context/2013/070935.html Layer vs. overlay] by Wolfgang<br />
<br />
{{todo|We need a lot of documentation and samples for this complicated subject.}}<br />
<br />
<br />
[[Category:Graphics]] [[Category:Layers]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Overlays&diff=21372Overlays2013-01-12T11:26:39Z<p>Peter: add explanation from Wolfgang</p>
<hr />
<div>< [[Graphics]]<br />
<br />
== What are Overlays? ==<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 everywhere, where there's 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 />
== See Also ==<br />
<br />
* [[:Category:Command/Overlays]]<br />
* [http://www.ntg.nl/pipermail/ntg-context/2013/070935.html Layer vs. overlay] by Wolfgang<br />
<br />
[[Category:Graphics]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/env&diff=20510Command/env2012-09-10T21:01:06Z<p>Peter: \env is a short-cut</p>
<hr />
<div>{{Reference<br />
|name=env<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\env<!--<br />
--><span class="first">{...}</span><!--<br />
--></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">{...}</td><br />
<td>''argument name''</td><br />
</tr><br />
</table><br />
<br />
== Description ==<br />
A shortcut for {{code|\getvariable{environment}{...}}}.<br />
Access arguments were passed from the command line via {{code|--arguments}}:<br />
<br />
context --arguments=arg1=value1,arg2="value 2"<br />
<br />
== Example ==<br />
<texcode><br />
% official-response.tex<br />
\starttext<br />
The request is \env{permission}.<br />
\stoptext<br />
</texcode><br />
<br />
context --arguments=permission=granted official-response.tex<br />
<br />
== See also ==<br />
* {{cmd|getvariable}}<br />
* {{cmd|doifdocumentargument}}<br />
* {{cmd|getdocumentargument}}<br />
* {{cmd|env}}<br />
<br />
== Help from ConTeXt-Mailinglist/Forum ==<br />
All issues with:<br />
{{Forum|env}}<br />
<br />
[[Category:Command/Internals|env]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Catalogue_raisonn%C3%A9&diff=20376Catalogue raisonné2012-09-06T23:10:43Z<p>Peter: new book</p>
<hr />
<div>< [[Sample documents]]<br />
<br />
This is an example for:<br />
* using the [http://modules.contextgarden.net/grph-downsample downsample module]<br />
* using a Lua file as database<br />
* using a CLD file as main input file for ConTeXt<br />
* using a Makefile and modes for generating different kinds of outputs<br />
* placing original text and translation side by side in two columns<br />
* placing images and captions automatically on the page<br />
<br />
Files:<br />
* [http://pmrb.free.fr/cr/screen1.pdf example output] with 20 DPI resolution (to keep the file small)<br />
* [http://pmrb.free.fr/cr/Makefile Makefile] that calls ConTeXt with the right "--result=" argument<br />
* [http://pmrb.free.fr/cr/main.cld main.cld], the main CLD file, that gets processed by ConTeXt, all the Lua code<br />
* [http://pmrb.free.fr/cr/env.tex env.tex] style file and a bit more, all the TeX code<br />
* [http://pmrb.free.fr/cr/etchings.lua etchings.lua] the database, one entry per image<br />
<br />
[[Category:Sample documents]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Catalogue_raisonn%C3%A9&diff=20375Catalogue raisonné2012-09-06T22:15:35Z<p>Peter: todo</p>
<hr />
<div>todo</div>Peterhttps://wiki.contextgarden.net/index.php?title=Sample_documents&diff=20374Sample documents2012-09-06T22:15:04Z<p>Peter: new book</p>
<hr />
<div>< [[Main Page]]<br />
<br />
== PRAGMA Documents ==<br />
* [[This Way|Magazines]] (source code is in the document)<br />
* [http://context.aanhet.net/svn/manuals Sources] of (some) [http://www.pragma-ade.com/overview.htm official manuals]. <br />
* pdftex Documentation:<br />
** [http://www.pragma-ade.com/pdftex/pdftex-t.tex Source]<br />
** [http://www.pragma-ade.com/pdftex/pdftex-s.pdf Screen] | [http://www.pragma-ade.com/pdftex/pdftex-a.pdf A4] | [http://www.pragma-ade.com/pdftex/pdftex-b.pdf A5 Booklet] | [http://www.pragma-ade.com/pdftex/pdftex-l.pdf Letter]<br />
<br />
== Simple Documents ==<br />
* Letter: german DIN [[Letter style]] by Holger Schöner<br />
* Building application: French [[Bauplan style]]<br />
* Research paper: [[MLA style]]<br />
* [http://www.pragma-ade.com/third/siep/samples.zip Sample documents (broken link)] by Siep Kroonenberg<br />
* [http://pmrb.free.fr/work/OS/ConTeXt/e-phd.tex Style file] for PhD thesis with KOMA-script layout<br />
* [[Law Faculty University of Ljubljana Styling and citations]] for diploma thesis and other works (Pravna fakulteta Univerze v Ljubljani)<br />
* A very simple cover page: [[A Very Simple Cover Page]]<br />
* [[Calendar script]]<br />
* [[Curriculum Vitae]]<br />
* [[Invoice]] using Wolfgang’s letter module<br />
<br />
== Labels and Businesscards ==<br />
* [[BusinessCard]] (many cards on one page, all cards the same)<br />
* [[FileCard| File Card]] (many cards on one page, each card different)<br />
<br />
== [[Presentations]] (screen documents) ==<br />
* Presentation: ''fiëé'' [[ConTeXt info style]] by [[User:Hraban|Hraban]] with much help from [http://www.pragma-ade.com Hans]<br />
* Presentation: [[Skdk style]] by [[User:Hraban|Hraban]]<br />
* Presentation: A sample conference presentation ([http://dpdx.net/research/papers/ILASS2005_Moses_slides.tex ConTeXt source] and [http://dpdx.net/research/papers/ILASS2005_Moses_slides.pdf PDF output]) by [[User:Brooks|Brooks]]<br />
<br />
== Books and Periodicals ==<br />
* Book: [[Ubuch style]] by [[User:Hraban|Hraban]] (contains deprecated code)<br />
* Book: [[Uno style]] by [[User:Hraban|Hraban]]<br />
* Book: [[Theory book style]] by [[User:Thomas|Thomas]]<br />
* Book: [[Proceedings style]] by [[User:Hraban|Hraban]]<br />
* Book: [[Biochemistry textbook]] by [[User:Jorg|Jorg]]<br />
* Book: [[Fairy style]] by [[User:Hraban|Hraban]]<br />
* Book: [[Sidenotes style]] by [[User:Andy|Andy]]<br />
* Book: [[Catalogue raisonné]] by [[User:Peter|Peter]]<br />
<br />
== Sample macros ==<br />
* Macro for [[Chromatograms]]<br />
* Macro for [[Changes]] (revision history)<br />
* Macro for [[Chapters headers]]<br />
* Macro for [[Chapter head with absolute positioning of following text]]<br />
* Macro for [[Section head with underlining to width of last line]]<br />
<br />
== [[MetaPost]], [[MetaFun]] and alike ==<br />
* [[Simple Cover Page]] by Hans Hagen<br />
* [[Colorful CD Inlay]] by Hans Hagen<br />
* [[EuroAnim|Animated construction of the "euro" symbol]]<br>This is a JavaScript based animation as described in the MetaFun manual.<br />
* [[CD Booklet|A full CD booklet]] for the current CD of the famous Dresden choir [http://www.wildrosescrew.de Wild Roses Crew] and the things learned by producing it.<br />
<br />
== Other resources ==<br />
See also the [[:Category:Sample documents| list of sample documents in this wiki]].<br />
<br />
[[Category:Sample documents]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=File:Pierre.jpg&diff=20117File:Pierre.jpg2012-07-20T21:18:47Z<p>Peter: </p>
<hr />
<div>Pierre, Peter's first son. Born on June 16, 2005.</div>Peterhttps://wiki.contextgarden.net/index.php?title=Fonts_in_LuaTeX&diff=20049Fonts in LuaTeX2012-07-16T11:09:33Z<p>Peter: stretch -> extend</p>
<hr />
<div>{{note|This page is not finished yet}}<br />
<br />
'''Please, someone, fill this page !'''<br />
<br />
'''This page is being regorganized'''<br />
<br />
Using [[LuaTeX]] as the processing engine in ConTeXt allows one to directly use fonts installed on the user's system. Instead of converting all fonts into the standard <code>.tfm</code> and <code>.vf</code> formats (as outlined in some [[My Way]] documents<ref>[http://dl.contextgarden.net/websitesarchive/atl/tex/OpenType.pdf OpenType in ConTeXt] by Adam Lindsay</ref><ref>[http://dl.contextgarden.net/myway/expertfonts.pdf Installing Expert Fonts: Minion Pro] by Idris Samawi Hamid</ref>), LuaTeX creates these metric files automatically at run-time. This greatly simplifies font installation in ConTeXt.<br />
<br />
= How LuaTeX handles system fonts =<br />
<br />
LuaTeX can use fonts in non-TeX format (e.g. OpenType, TrueType or Type1 format) directly. When ConTeXt processes a file that uses such non-traditional fonts, the actual fonts themselves are loaded in LuaTeX's embedded section of fontforge to extract their metric information. This removes the need for tfm and vf files on your disk, but it is also a somewhat lengthy and often memory-hungry process. Fortunately, the result of that internal preprocessing are also saved inside the texmf cache. Future runs using the same font (not just this file, but all files using that particular font) can then use the cached version of the metrics instead.<br />
<br />
Mac OS users should note that the current version of LuaTeX (0.60) has severe problems dealing with the new TrueType collection fonts in Snow Leopard (Mac OS 10.6). The older Mac OS .dfont format works fine nowadays.<br />
<br />
== Building the font database ==<br />
<br />
You need to specify where the fonts should be looked for, by setting the <code>OSFONTDIR</code> environment variable. On Windows, this might be achieved by running<br />
set OSFONTDIR=c:/windows/fonts/<br />
if the fonts should be found in <code>c:/windows/fonts/</code>. For Unix machines,<br />
export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts"<br />
indicate that the fonts should be found in both <code>/usr/local/share/fonts</code> and <code>$HOME/.fonts</code>.<br />
<br />
The font database will then be automatically generated in the next run of <code>context</code>. You can also generate it manually by typing <br />
mtxrun --script fonts --reload<br />
<br />
The output should look like<br />
MTXrun | fontnames: identifying tree font files with suffix otf<br />
MTXrun | fontnames: identifying tree font files with suffix OTF<br />
MTXrun | fontnames: 331 tree files identified, 332 hash entries added, runtime 7.653 seconds<br />
MTXrun | fontnames: identifying tree font files with suffix ttf<br />
MTXrun | fontnames: identifying tree font files with suffix TTF<br />
MTXrun | fontnames: 17 tree files identified, 14 hash entries added, runtime 4.645 seconds<br />
...<br />
MTXrun | fontnames: 94 system files identified, 94 hash entries added, runtime 0.554 seconds<br />
MTXrun | fontnames: 3837 files read, 3342 normal and 49 extra entries added, 5 rejected, 3386 valid<br />
<br />
If mtxrun has problem finding the mtx-fonts.lua file, it may be necessary to regenerate ConTeXt's file database:<br />
context --generate<br />
<br />
== Querying the font database ==<br />
<br />
The command<br />
mtxrun --script fonts --list --all --pattern=*<br />
will return the whole entries of the font database as a list, such as<br />
<br />
...<br />
warnockprobold WarnockPro-Bold E:/Fonts/Warnock Pro/WarnockPro-Bold.otf<br />
warnockproboldcapt WarnockPro-BoldCapt E:/Fonts/Warnock Pro/WarnockPro-BoldCapt.otf<br />
warnockprobolddisp WarnockPro-BoldDisp E:/Fonts/Warnock Pro/WarnockPro-BoldDisp.otf<br />
warnockproboldit WarnockPro-BoldIt E:/Fonts/Warnock Pro/WarnockPro-BoldIt.otf<br />
warnockprobolditcapt WarnockPro-BoldItCapt E:/Fonts/Warnock Pro/WarnockPro-BoldItCapt.otf<br />
warnockprobolditdisp WarnockPro-BoldItDisp E:/Fonts/Warnock Pro/WarnockPro-BoldItDisp.otf<br />
warnockprobolditsubh WarnockPro-BoldItSubh E:/Fonts/Warnock Pro/WarnockPro-BoldItSubh.otf<br />
warnockproboldsubh WarnockPro-BoldSubh E:/Fonts/Warnock Pro/WarnockPro-BoldSubh.otf<br />
...<br />
<br />
You can query the database against a particular pattern. For instance,<br />
mtxrun --script fonts --list --all --pattern=Delicious*<br />
will return<br />
deliciousbold Delicious-Bold /usr/local/share/fonts/d/delicious_bold.otf<br />
deliciousbolditalic Delicious-BoldItalic /usr/local/share/fonts/d/delicious_bolditalic.otf<br />
deliciousheavy Delicious-Heavy /usr/local/share/fonts/d/delicious_heavy.otf<br />
deliciousitalic Delicious-Italic /usr/local/share/fonts/d/delicious_italic.otf<br />
deliciousroman Delicious-Roman /usr/local/share/fonts/d/delicious_roman.otf<br />
delicioussmallcaps Delicious-SmallCaps /usr/local/share/fonts/d/delicious_smallcaps.otf<br />
<br />
You can get useful informations about your fonts by using the <code>--info</code> option. For instance,<br />
mtxrun --script fonts --list --info --pattern=Delicious*Roman<br />
will return<br />
MTXrun | fontname: deliciousroman<br />
MTXrun | fullname: Delicious-Roman<br />
MTXrun | filename: /usr/local/share/fonts/d/delicious_roman.otf<br />
MTXrun |<br />
MTXrun | gpos features:<br />
MTXrun |<br />
MTXrun | feature script languages<br />
MTXrun |<br />
MTXrun | kern latn dflt<br />
MTXrun |<br />
MTXrun | gsub features:<br />
MTXrun |<br />
MTXrun | feature script languages<br />
MTXrun |<br />
MTXrun | tlig all all<br />
MTXrun | trep all all<br />
<br />
== Installing new fonts ==<br />
<br />
After installing new fonts, the font database must be rebuilt for LuaTeX to access them.<br />
<br />
In current versions of Mark IV (earlier than July 2008) this is automatically done whenever a named font cannot be found.<br />
<br />
You only have to do the reload manually when you have installed updates to already installed fonts that cause the font and/or file names to change. <br />
This normally only happens for fonts that are still in development like [[TeX Gyre]] and [[Latin Modern]].<br />
<br />
You can rebuild the database manually, using the already-mentioned command<br />
mtxrun --script fonts --reload<br />
<br />
Alternatively, you can turn off the automatic rebuild of the database, by setting either of<br />
MTX.FONTS.AUTOLOAD<br />
MTX_FONTS_AUTOLOAD<br />
to "no".<br />
<br />
== Get a warning if the glyph is missing ==<br />
<br />
You need to add the command <code>\checkcharactersinfont</code> or<br />
(better) <code>\enabletrackers[fonts.missing]</code> in the preamble<br />
of your document.<br />
<br />
== References ==<br />
<br />
[http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf The new manual chapter on fonts]<br />
<br />
= Using fonts =<br />
<br />
Handling fonts in LuaTeX can be done<br />
* in a simple but limited way, using the <code>simplefonts</code> module;<br />
* in the standard way, using [[TypeScripts]]<br />
<br />
== With the <code>simplefonts</code> module ==<br />
<br />
[http://www.ctan.org/tex-archive/macros/context/contrib/context-simplefonts simplefonts] is a third-party module written by Wolfgang Schuster.<br />
<br />
It simplifies the use of fonts in LuaTeX by<br />
* freeing the user from writing or using [[TypeScripts]];<br />
* offering an interface similar to the [http://www.ctan.org/tex-archive/macros/xetex/latex/fontspec/ fontspec package for XeTeX]<br />
<br />
For instance, assuming the [http://www.exljbris.com/delicious.html Delicious fonts] are properly installed and recognized by ConTeXt, you can simply write:<br />
<br />
<texcode><br />
\usemodule[simplefonts] % load the module.<br />
\setmainfont[Delicious] % set Delicious as main (serif) font<br />
% \setmonofont[mymonofont]<br />
% \setmathfont[mymathfont]<br />
% \setsansfont[mysansfont]<br />
<br />
\starttext<br />
\rm\tf roman \it italic \bf bold \bi bolditalic \sc smallcaps<br />
\stoptext<br />
</texcode><br />
<br />
=== Installing <code>simplefonts</code> ===<br />
<br />
* If you're using LuaTeX along with TeXlive 2009, <code>simplefonts</code> is already installed<br />
* If you're running [[ConTeXt Standalone]], <code>simplefonts</code> can be installed like [http://wiki.contextgarden.net/ConTeXt_Standalone#Installing_third_party_modules any third-party module]:<br />
first-setup.sh --modules="t-simplefonts"<br />
<br />
=== Handling special cases ===<br />
<br />
If the font in question has an unusual naming scheme and is missing some features, it may be necessary to specify the names to look for and the font features to implement. In [http://archive.contextgarden.net/message/20111017.113829.e2b20bf4.en.html this example] the font names do not end with *bold and *regular but with *fett and *nor (from the german words "fett" for bold and "normal" for regular). Also the font doesn't provide an italic font face, so it has to be emulated.<br />
<br />
Wolfgang Schuster proposed the following [http://archive.contextgarden.net/message/20111017.144952.1a72175c.en.html solutions]:<br />
<br />
<texcode><br />
\usemodule[simplefonts] <br />
<br />
\definefontfeature[fakeitalic][default][slant=.25] % for fake bold use “extend=<number>” <br />
<br />
\setmainfont <br />
[telegrotesk] <br />
[regularfont=* nor, <br />
italicfont=* nor, <br />
boldfont=* fett, <br />
bolditalicfont=* fett, <br />
italicfeatures=fakeitalic, % just the name of a fontfeature <br />
bolditalicfeatures=fakeitalic]<br />
</texcode><br />
<br />
== The standard way: Typescripts ==<br />
<br />
=== Installing typescripts ===<br />
<br />
Installing typescripts consists in the following:<br />
<br />
1. Copy the typescript files into either <br />
<texcode>$TEXMF/tex/texmf-fonts/tex/context/user<br />
$TEXMF/tex/texmf-project/tex/context/user</texcode><br />
2. Run <code>context --generate</code><br />
<br />
By convention, typescript files are named like <code>type-(fontname|foundry).tex</code>. <br />
<br />
It may happen that some <code>type-xx.tex</code> typescript file depends on mkiv-specific code located in a matching <code>type-xx.mkiv</code> file. In this case, both files need to be installed.<br />
<br />
=== Loading typescripts ===<br />
<br />
A typescript file named <code>type-xx.tex</code> should be loaded using<br />
\usetypescriptfile[type-xx]<br />
<br />
An alternative way is<br />
\usetypefile[xx]<br />
where ConTeXt prepends <code>type-</code> when it loads the file; but <br />
<cmd>usetypescriptfile</cmd> is the preferred command because it takes care of the<br />
<cmd>starttypescriptcollection</cmd>/<cmd>stoptypescriptcollection</cmd> environments.<br />
<br />
=== Very simple example of typescript ===<br />
<br />
If you are new to typescript you might have a look at this [[Simple Typescript Example]] to get a first idea how to use it.<br />
<br />
=== Where to find existing typescripts ===<br />
<br />
Each of the typescripts below defines a keyword to use with <cmd>setupbodyfont</cmd>. Usually this is the same as the name of the typescript, but there is one exception (<code>antykwa-torunska</code>)<br />
<br />
* Latin Modern (typescript name: <code>modern</code>; this is the default font set)<br />
* Latin Modern variant (ts name: <code>modernvariable</code>; LM variable typewriter for serif)<br />
* Postscript (ts name: <code>postscript</code>; Termes for serif, Heros for sans, Cursor for mono)<br />
* Antykwa Toruńska (ts name: <code>antykwa-torunska</code>; only serif; defines <tt>antykwa</tt> as keyword for <cmd>setupbodyfont</cmd>)<br />
* Iwona (ts name: <code>iwona</code>; only sans serif)<br />
* Iwona Light, Medium and Heavy (ts names: <code>iwona-light</code>, <code>iwona-medium</code>, <code>iwona-heavy</code>; only sans; the medium variant is a small bit heavier than a "regular" one)<br />
* Pagella (ts name: <code>palatino</code>; only serif)<br />
* Termes (ts name: <code>times</code>; only serif, Heros for sans)<br />
<br />
=== Usage example ===<br />
<br />
<texcode><br />
\usetypescript[palatino]<br />
\setupbodyfont[palatino,18pt]<br />
<br />
\starttext<br />
Hello world, I'm Pagella!<br />
\stoptext<br />
</texcode><br />
<br />
The first line seems to order ConTeXt to "install" (for the current file) the given typescript (it accepts what I have earlier called a "typescript name"). The last one starts using it (you may omit the size if you are satisfied with the default).<br />
<br />
=== Combining predefined fonts in your own typescripts ===<br />
<br />
It is also possible to combine fonts from the TeX Gyre collection in your own typescripts. The example below combines Bonum (Bookman) roman, Adventor (AvantGarde) for sans serif, Cursor (Courier) for teletype, and Euler for math. The <code>rscale=...</code> option ensures that all fonts have the same x-height. (You can lookup the relative x-heigt of a font using fontforge.)<br />
<br />
<texcode><br />
\starttypescript [Bonum]<br />
\definetypeface [Bonum] [rm] [serif] [bonum] [default]<br />
\definetypeface [Bonum] [ss] [sans] [adventor] [default] [rscale=0.887]<br />
\definetypeface [Bonum] [tt] [mono] [cursor] [default] [rscale=1.163]<br />
\definetypeface [Bonum] [mm] [math] [euler] [default] [rscale=1.050]<br />
\stoptypescript<br />
<br />
\usetypescript[Bonum]<br />
\setupbodyfont[Bonum,12pt]<br />
<br />
\starttext<br />
Hello world, I'm Bonum!<br />
\stoptext<br />
</texcode><br />
<br />
= Old contents =<br />
<br />
* [[TrueType fonts in luaTeX]]<br />
<br />
==== Good ol' typescripts ====<br />
<br />
Of course, Mark IV allows you to use typescripts as you've always done; for example:<br />
<br />
<texcode><br />
\usetypescript[palatino]<br />
\setupbodyfont[palatino,12pt]<br />
effe fietsen 2: \input tufte $\sqrt{2}$ \eogonek<br />
<br />
\sc effe fietsen 2: \input tufte $\sqrt{2}$ \eogonek<br />
</texcode><br />
<br />
That's as simple as using a traditional ConTeXt typescript!<br />
<br />
But ... how is it any different, then? Well, the difference is that in Mark IV, we can use an Opentype font directly, so that what is done here: when we want to use Palatino, the [[TeX Gyre]] equivalent (“Pagella”) is called and we can use its Opentype “features”; read on.<br />
<br />
==== Opentype features ====<br />
<br />
A “feature”, in the Opentype jargon, is a set of rules describing changes in the appearance of the text. Hmm, that's not very precise. Let's show some examples. First of all, you have to know that features are referred to by 4-letter tags, and you will see this a lot. One of them is ‘smcp‘, for “small caps“. Let's consider the following Mark IV-only code:<br />
<br />
<texcode><br />
\definefontfeature[smallcaps][language=DFLT,script=latn,smcp=yes]<br />
\font\palasmallcaps=texgyrepagella-regular*smallcaps<br />
\palasmallcaps This is a text in small capitals.<br />
</texcode><br />
<br />
Here you basically define a (Mark IV) feature with the name ”smallcaps”, and associate it with the (Opentype) feature “smcp”. You have to specify which script you want to use it with; scripts in Opentype are also tagged with four letters, and “latn” is of course Latin.<br />
<br />
Then you define a TeX font with that feature.<br />
<br />
You can see what features are defined in a particular font with the following bit of code<br />
<br />
<texcode><br />
\ctxlua<br />
{<br />
fontname = 'texgyrepagella-regular.otf'<br />
<br />
--[[ First read the font data.<br />
This makes heavy use of some of the Mark IV code]]<br />
tfmdata = fonts.tfm.read_and_define("file:" .. fontname, 655360)<br />
font = tfmdata.shared.otfdata<br />
if font<br />
then<br />
gsubfeatures = fonts.otf.analyze_features(font.gsub)<br />
gposfeatures = fonts.otf.analyze_features(font.gpos)<br />
end<br />
<br />
if gsubfeatures then<br />
table.sort(gsubfeatures) % We want our list sorted alphabetically!<br />
tex.sprint("\\rm GSUB features: \\tt ") % Beware: you don't want \rm to be interpreted by lua (\rm would yield carriage return + letter m)!<br />
for _, feat in ipairs(gsubfeatures)<br />
do tex.sprint(feat) tex.sprint(' ')<br />
end<br />
else tex.sprint("\\rm No GSUB features")<br />
end<br />
tex.sprint("\\par")<br />
<br />
if gposfeatures then<br />
tex.sprint("\\rm GPOS features: \\tt ")<br />
table.sort(gposfeatures)<br />
for _, feat in ipairs(gposfeatures)<br />
do tex.sprint(feat) tex.sprint(' ')<br />
end<br />
else tex.sprint("\\rm No GPOS features")<br />
end<br />
}<br />
</texcode><br />
<br />
It prints the list on the page. You'll notice there are two sets of features, each one of them defined in a different table of the Opentype font: the <code>GSUB</code> table (for Glyph SUBstitution) gives rules for replacing glyphs in certains circumstances (think of ligatures: f + i -> fi); the <code>GPOS</code> table (Glyph POSititioning) gives rules for moving glyphs (think of kerning: A + V -> A <kerning> V).<br />
<br />
Incidentally, the above code gives some basic examples of LuaTeX programming, a mixture of both Lua and TeX programming with some special features (features in the general sense, not the Opentype one :-).<br />
<br />
==== A (Complete) Typescript Example ====<br />
<br />
<texcode><br />
\starttypescript [sans] [franklin]<br />
<br />
\definefontsynonym [FranklinBookRegular] [name:FranklinGothicBookITC-Regular] [features=default]<br />
\definefontsynonym [FranklinMediumRegular] [name:FranklinGothicMediumITC-Regular] [features=default]<br />
\definefontsynonym [FranklinDemiRegular] [name:FranklinGothicDemiITC-Regular] [features=default]<br />
\definefontsynonym [FranklinHeavyRegular] [name:FranklinGothicHeavyITC-Regular] [features=default]<br />
<br />
\definefontsynonym [FranklinBookItalic] [name:FranklinGothicBookITC-Italic] [features=default]<br />
\definefontsynonym [FranklinDemiItalic] [name:FranklinGothicMediumITC-Italic] [features=default]<br />
\definefontsynonym [FranklinHeavyItalic] [name:FranklinGothicDemiITC-Italic] [features=default]<br />
\definefontsynonym [FranklinMediumItalic] [name:FranklinGothicHeavyITC-Italic] [features=default]<br />
<br />
\stoptypescript<br />
<br />
\starttypescript [sans] [franklin]<br />
<br />
\definefontsynonym [Sans] [FranklinBookRegular] [features=default]<br />
\definefontsynonym [SansItalic] [FranklinBookItalic] [features=default]<br />
\definefontsynonym [SansBold] [FranklinDemiRegular] [features=default]<br />
\definefontsynonym [SansBoldItalic] [FranklinDemiItalic] [features=default]<br />
\definefontsynonym [SansSlanted] [SansItalic] [features=default]<br />
\definefontsynonym [SansBoldSlanted] [SansBoldItalic] [features=default]<br />
\definefontsynonym [SansCaps] [Sans] [features=smallcaps]<br />
<br />
\stoptypescript<br />
<br />
\definetypeface[franklin][rm][sans][franklin][default]<br />
\definetypeface[franklin][ss][sans][franklin][default]<br />
\definetypeface[franklin][tt][mono][modern] [default][rscale=1.12]<br />
\definetypeface[franklin][mm][math][iwona] [default][rscale=1.02]<br />
<br />
\setupbodyfont[franklin,ss,10pt]<br />
</texcode><br />
<br />
<br />
<br />
Just the simplest way to use an otf font — or any font that does appear in <tt>mtxrun --script font --list</tt> — in all the document.<br />
<br />
I’m stick here :<br />
<br />
\definefontfeature [myfontfeature] [method=node, kern=yes, OTHER_FEATURE_COMMA_SEPERATED]<br />
\definefontsynonym [MyFontRegular] [name:TheFontName-Regular][features=myfontfeature]<br />
\definedfont [MyFontRegular at 16pt]<br />
<br />
This doesn’t run for my title which use « \tfc », only for the body of the text.<br />
<br />
*\definefontfeature<br />
**[myfontfeature] : you can use the name you want. It will be use at the next line ;<br />
**the fonts feature can be found with <tt>otfinfo -f TheFontFile.otf</tt>.<br />
*\definefontsynonym :<br />
**[MyFontRegular] : you can use the name you want. It will be use at the next line ;<br />
**The name after <tt>name:</tt> is the name given by <tt>mtxrun --script font --list</tt><br />
**The « name: » part can be replaced by <tt>file:TheFontFile.otf</tt><br />
<br />
<br />
== Example ==<br />
<br />
<br />
Now to access, say the regular warnock font, the following are valid. And I ought to mention that Hans recommends the first http://article.gmane.org/gmane.comp.tex.context/43685.<br />
<br />
<texcode><br />
% Hans recommends this format;<br />
\definefontsynonym [WarnockPro-Regular] [name:warnockproregular] <br />
</texcode><br />
<br />
and<br />
<br />
<texcode><br />
\definefontsynonym [WarnockPro-Regular] [name:WarnockPro-Regular]<br />
</texcode><br />
<br />
An entire typescript would be defined as;<br />
<br />
<texcode><br />
\definefontfeature[latin-smallcaps][smallcaps][script=latn]<br />
<br />
\starttypescript [serif] [warnockpro]<br />
\setups[font:fallback:sans]<br />
\definefontsynonym [WarnockPro-Regular] [name:WarnockPro-Regular] <br />
\definefontsynonym [WarnockPro-Bold] [name:WarnockPro-Bold] <br />
\definefontsynonym [WarnockPro-Italic] [name:WarnockPro-It] <br />
\definefontsynonym [WarnockPro-BoldItalic] [name:WarnockPro-BoldIt] <br />
\stoptypescript<br />
<br />
\starttypescript [serif] [warnockpro]<br />
\definefontsynonym [Serif] [WarnockPro-Regular] [features=default]<br />
\definefontsynonym [SerifBold] [WarnockPro-Bold] [features=default]<br />
\definefontsynonym [SerifItalic] [WarnockPro-Italic] [features=default]<br />
\definefontsynonym [SerifBoldItalic] [WarnockPro-BoldItalic] [features=default]<br />
\definefontsynonym [SerifCaps] [Serif] [features=latin-smallcaps]<br />
\stoptypescript<br />
<br />
\definetypeface[adobe][rm][serif][warnockpro][default]<br />
\setupbodyfont[adobe,11pt]<br />
<br />
</texcode><br />
<br />
= References =<br />
<references/><br />
<br />
[[Category:Fonts]]<br />
[[Category:International]]<br />
[[Category:LuaTeX]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Columns&diff=19786Columns2012-06-29T16:10:57Z<p>Peter: spell-fix</p>
<hr />
<div>< [[Visuals]] | [[Layout]] ><br />
<br />
There are different possibilities to typeset text in two or more columns:<br />
* columns : for simple cases of multi column text<br />
* paragraphs : if you need a table-like structure (translations, questionaires etc.)<br />
* column sets : the flexible way for varying columns or other complex tasks<br />
* streams : set different text synchronized side-by-side (e.g. bilingual editions)<br />
<br />
Columns and columnset are two different mechanism to produce a document<br />
with text and two or more columns. <br />
* The <code>columns</code> mechanism is the older one with limited control about the placement of figures but allows you to mix one column and multicolumns text on a page. <br />
* <code>columnsets</code> is a new version of the column mechanism with more control about the placement of figures and other features like spanned columns etc. (look at the [[Columns#Column_Sets|manual]] for more); it is better than <code>columns</code> for magazine-like layouts.<br />
<br />
=Columns=<br />
<br />
<texcode><br />
\startcolumns[n=3]<br />
\input knuth<br />
\stopcolumns<br />
</texcode><br />
<br />
<context><br />
\setupbodyfont[rm, 9pt]<br />
\startcolumns[n=3]<br />
\input knuth<br />
\stopcolumns<br />
</context><br />
<br />
You can add all the options of <cmd>setupcolumns</cmd> to <cmd>startcolumns</cmd>. For example, simple ruled columns are easy:<br />
<br />
<texcode><br />
\setupbodyfont[9pt]<br />
\startcolumns[n=2,rule=on]<br />
\input knuth<br />
\stopcolumns<br />
</texcode><br />
<br />
<context><br />
\setupbodyfont[9pt]<br />
\startcolumns[n=2,rule=on]<br />
\input knuth<br />
\stopcolumns<br />
</context><br />
<br />
Normally, columns are automatically balanced with the text distributed over the number or requested columns. You can provoke a column switch using <cmd>column</cmd>.<br />
<br />
<texcode><br />
\startcolumns[n=2]<br />
\input knuth<br />
\column<br />
\input tufte<br />
\stopcolumns<br />
</texcode><br />
<br />
<context ><br />
\setupbodyfont[9pt]<br />
\startcolumns[n=2]<br />
\input knuth<br />
\column<br />
\input tufte<br />
\stopcolumns<br />
</context><br />
<br />
Column balancing fails in "lines" mode (e.g. for poetry).<br />
<br />
=Paragraphs=<br />
<br />
Paragraphs are useful in collecting text to be displayed together.<br />
For example:<br />
<context source="yes"><br />
\enableregime[utf]<br />
\defineparagraphs[TwoThird][n=2]<br />
\setupparagraphs[TwoThird][1][width=.66\textwidth]<br />
% The width of the second paragraph is automatically calculated if unspecified.<br />
\startTwoThird<br />
\quotation{...{\it why is there something rather than nothing?}<br />
For nothing is simpler and easier than something.<br />
Furthermore, assuming that things must exist,<br />
one must be able to explain<br />
{\it why they must exist thus,}<br />
and not otherwise.}<br />
\nextTwoThird<br />
G. W. Leibniz, {\it\fr Principes de la nature et de la grâce fondés en raison,} 1714.<br />
\stopTwoThird<br />
</context><br />
<br />
See "Paragraphs in Columns" section in the [[manual:cont-enp.pdf|manual]]<br />
for further details.<br />
<br />
=(Simple)Columns in a narrow frame=<br />
It is hard to put multiple columns in a frame (at least for me), but this one works.<br />
<br />
<context source="yes"><br />
\framed[width=0.9\hsize,location=middle]\bgroup<br />
\startnarrower[2*middle]<br />
\setlocalhsize \hsize\localhsize <br />
\startsimplecolumns<br />
\input tufte<br />
\stopsimplecolumns<br />
\stopnarrower<br />
\egroup<br />
</context><br />
<br />
Another possibility is to use [[TextBackground|textbackground]] around the text. (The examples don't work in this wiki because, for security reasons, it has [[write18]] disabled. They should work for you, though, provided that [[write18]] is enabled on your local installation.)<br />
<br />
<context source="yes"><br />
\setupcolors[state=start]<br />
\definetextbackground [book]<br />
[state=start, topoffset=.5ex, location=paragraph,<br />
leftoffset=1ex,bottomoffset=1ex]<br />
<br />
\starttextbackground[book]<br />
Tufte again<br />
\startcolumns[n=2]<br />
\input tufte<br />
\stopcolumns<br />
\stoptextbackground<br />
</context><br />
<br />
=Column Sets=<br />
<br />
An alternative method of typesetting text into columns uses columnsets.<br />
This method offers more possibilities than simple columns,<br />
in particular in placing floats such as figures and in creating columnspans.<br />
See [[manual:columns.pdf|Columns manual]] or [[source:page-set.tex|column sets source]] for many examples.<br />
<br />
If you don't need much more than the "normal" columns, but e.g. "lines" mode, try this:<br />
<br />
<context source="yes"><br />
\definecolumnset[TwoColumns][n=2]<br />
<br />
\startcolumnset[TwoColumns]<br />
<br />
\startlines % enforce line breaks<br />
Starlight, star bright,<br />
first star I see tonight;<br />
\stoplines<br />
<br />
\column<br />
<br />
\startlines<br />
I wish I may, I wish I might<br />
have the wish I wish tonight.<br />
\stoplines<br />
<br />
\stopcolumnset<br />
</context><br />
<br />
For more details (layout grid features, spreads, different column widths etc.) please refer to the [[manual:columns.pdf|manual]]!<br />
<br />
==Vertical lines between columnsets (rules)==<br />
<br />
Sometimes it is required to have a vertical line between the columns of your columnset. This code draws MetaPost lines in the right place (note that it uses textbackground):<br />
<br />
<texcode><br />
\startuseMPgraphic{verticalline}<br />
for i=1 upto NOfTextColumns-1 :<br />
draw (rightboundary TextColumns[i]) shifted (2.5mm,0) shifted -\MPxy\textanchor ;<br />
endfor ;<br />
setbounds currentpicture to OverlayBox ;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[verticalline][\useMPgraphic{verticalline}]<br />
\setupbackgrounds[text][background=verticalline] <br />
\definecolumnset[example][n=3,distance=5mm]<br />
\setupcolumnset[example][1,2][balance=yes]<br />
<br />
\starttext<br />
\chapter{Chapter One}<br />
\startcolumnset[example]<br />
\starttextbackground[text] \dorecurse {10}{\input knuth} \stoptextbackground<br />
\stopcolumnset<br />
\stoptext<br />
</texcode><br />
<br />
=Streams=<br />
<br />
From the [[http://archive.contextgarden.net/message/20060331.175831.414d087b.en.html announcement mail]] by Thomas Schmitz:<br />
<br />
We have streams for even and odd pages that can be synchronized at certain points. <br />
This is useful for, e.g., typesetting bilingual books: have the original on the even pages, the translation on the odd pages, and synchronize at certain points.<br />
<br />
For details see [[source:m-streams.tex|streams module source]]<br />
<br />
The module provides a rather low-lever interface. Hans suggested some handy shortcuts:<br />
<texcode><br />
\usemodule[streams] <br />
<br />
\def\StartCouple{\page\SwitchToNormal} <br />
\def\StopCouple {\SwitchToNormal \SynchronizeLeftAndRight \FlushLeftAndRight} <br />
\def\Original {\SwitchToNormal\SynchronizeLeftAndRight\SwitchToLeft} <br />
\def\Translation{\SwitchToRight} <br />
<br />
\Original\en<br />
Are you sleeping, brother John?<br />
<br />
\Translation\de<br />
Bruder Jakob, schläfst du noch?<br />
</texcode><br />
<br />
So you put the part of your document where synchronization should take place between <cmd>StartCouple</cmd> and <cmd>StopCouple</cmd>. After that , <cmd>Original</cmd> and <cmd>Translation</cmd> switches between even and odd pages. <br />
<br />
Beware, streams don't work in columns and not very good in columnsets.<br />
<br />
{{todo|We need documentation and samples for Paragraphs, Streams and Column Sets}}<br />
<br />
=Floats and other limitations of columns=<br />
<br />
Columns and one-column floats don't work well together in TeX. It seems that you can't have a float that spans one column automatically put at the top or the bottom and have the columns balanced automatically at the end. Neither ConTeXt nor LaTeX can do it in a automatized way (like with floats that span more than a column). Here you have some tricks to make it work more or less:<br />
<br />
==Columnsets==<br />
<br />
With columnsets you can put floats that span one, two or any number of columns and in any position (top, bottom, middle of the text). The price for this is that you have to balance the columns manually at the end (see [[manual:columns.pdf|Columnset manual]]).<br />
<br />
Columnsets have a limitation, however: they are very strongly grid-based, and you can't change the interlinespace within the columnset (e.g., if some paragraphs are typed in a smaller font). You can change the interlinespace if the entire text with a smaller interlinespace fits in one column, like a float or a section title (putting it between <code>\startlinecorrection\stoplinecorrection</code>), but if the text with a smaller interlinespace starts in one column and has to continue in the following one, nothing will work, and the layout will be completely messed.<br />
<br />
Changing the font weight or shape inbetween <cmd>startcolumnset</cmd> and <cmd>stopcolumnset</cmd> may cause some columns to be shifted vertically. Then you must use <cmd>restoreinterlinespace</cmd> after the font switch (<cmd>bf</cmd>, <cmd>ss</cmd>) to correct the interline spacing. See [http://thread.gmane.org/gmane.comp.tex.context/20932].<br />
<br />
So, if you want columns and one-column floats and don't have to change the interlinespacing, use Columnsets. If not, you can use Columns with some tricks.<br />
<br />
==Columns and Floats ==<br />
<br />
With Columns you have the columns automatically balanced at the end, but only certain floats are "officially" supported:<br />
<br />
* '''Floats that span more than a column at the top of the following page'''<br />
* '''Floats that span one column in the middle of the text, accidentally at the top of the following page'''<br />
<br />
Here, the optional argument <code>placefloat[here, top, bottom, etc.]</code> does nothing. When you place a float, if its width is larger than the column width (<code>\textwidth</code>), that float will be automatically put at the top of the following page, spanning the columns needed. If its width is shorter than the column width, the float will be put in the middle of the text, spanning one column. If there is not enough space left in the column, it will float until the top of the following column. You can use this method to put floats at the top of a column, but it's not recommended, because it is tedious and if you change the text before the float, you will probably find it then in the middle of the column.<br />
<br />
There is a semi-automatic way to put:<br />
<br />
* '''Floats that span one column at the top of the left column of a page'''<br />
* '''Any float in a separated page, without text'''<br />
<br />
with the possibility of changing the text and having the float always correctly put, like with "officially" supported floats, using <code>\startpostponing\stoppostponing</code>. Everything that goes into this environment will be put at the beginning of the next page, or in the page indicated in the optional argument (e.g., <code>\startpostponing[34]</code>; see [[Latex_Packages#afterpage|this wiki entry]]). If we write<br />
<br />
<texcode><br />
\startpostponing[35]<br />
\vbox{\vskip-\baselineskip<br />
\placefigure{caption}{\externalfigure[file][width=\textwidth]}<br />
}<br />
\stoppostponing<br />
</texcode><br />
<br />
the figure will be put at the top of the first column at page 35, or four pages further on, if we put [+4], or on the following page, with no optional argument. The figure has to be enclosed in a box, or the grid will be broken. Putting the figure in a box lowers it a line (why?), so it has to be corrected with the <code>\vskip-\baselineskip</code>.<br />
<br />
You can put more than a float in the same column, but they have to be into the same box, or the grid will be broken<br />
<br />
<texcode><br />
\startpostponing<br />
\vbox{\vskip-\baselineskip<br />
\placefigure{caption}{\externalfigure[file][width=\textwidth]}<br />
\placefigure{caption2}{\externalfigure[file2][width=\textwidth]}<br />
}<br />
\stoppostponing<br />
</texcode><br />
<br />
With this method you can put a float in a separated page, without any text<br />
<br />
<texcode><br />
\startpostponing[+5]<br />
\vbox{<br />
\placefigure{caption}{\externalfigure[file][width=\makeupwidth]}<br />
}<br />
\page<br />
\stoppostponing<br />
</texcode><br />
<br />
And you can use it to put a float that span more than a column in a page other than the one chosen by the algorithm (without <code>\vbox</code>):<br />
<br />
<texcode><br />
\startpostponing[67]<br />
\placefigure{caption}{\externalfigure[file][width=\makeupwidth]}<br />
\stoppostponing<br />
</texcode><br />
<br />
This has some limitations, too. If you put a float at the top of a column and there is another float that spans more than a column over all, the grid will be broken, so you have to put it in another page, but you can put more than one float of the same type together, as seen above.</div>Peterhttps://wiki.contextgarden.net/index.php?title=FAQ&diff=19666FAQ2012-06-12T11:49:00Z<p>Peter: space-gobbling fixed in mkiv</p>
<hr />
<div>{{todo|This FAQ needs to have a lot of things worked on. To avoid clutter from repeated TODO tags, just note missing answers with "...", and put notes about missing information in parentheses.}}<br />
<br />
== ConTeXt General ==<br />
<br />
=== What is ConTeXt? ===<br />
:It is a document production system based on Donald Knuth's [http://www.tug.org/ TeX]. It is a set of high-level macros written in the (somewhat arcane) TeX language, and these macros simplify the task of designing layouts, making hyperlinks, etc.<br />
<br />
=== How does ConTeXt versioning work? ===<br />
:There are 2 different development trees for ConTeXt, called Mark II and Mark IV (MkII, MkIV). They are always released together in a single package because they share a fair amount of code. MkII is stable and is in maintenance-only mode, MkIV is actively developed, including several enhanced features and completely new font handling.<br />
:There are 3 different typesetting engines that work with ConTeXt: pdfTeX, XeTeX and LuaTeX. MkIV works only with LuaTeX, MkII with any one of the engines (pdfTeX is the default). Font setups (typescripts) differ per engine. <br />
:ConTeXt releases are identified by a time stamp, e.g. ''2010.06.23 12:45''. At most times, there is both a ''current'' and a ''beta'' ConTeXt release package available. As explained above, both packages contain MkII and MkIV, the difference between ''current'' and ''beta'' is that the latter contains the unstable developments to MkIV for testing by power users.<br />
:Since "betas" are declared "current" only a few times a year and no bugfixes happen for "currents" (in contrary to "stable" branches in many software projects), you’re mostly better off with beta. It has some bugs fixed, bur mostly some new bugs. If you need a really stable and reliable system and can’t wait a few days for a fix, stick with MkII.<br />
<br />
== Starting with ConTeXt ==<br />
<br />
=== How do I install ConTeXt? ===<br />
:See [[Installation]]<br />
<br />
=== Is there a hello-world document? ===<br />
:Yes. See [[First Document]] and [[Hello world]].<br />
<br />
=== Is ConTeXt free (libre, open source) software? ===<br />
:Yes. See the [[Read Me]] page for details.<br />
<br />
=== Does ConTeXt support Unicode? ===<br />
:Yes. It supports Unicode (UTF-8). In [[XeTeX]] and [[LuaTeX]] it is the default input encoding, while you need to use <cmd>enableregime</cmd><tt>[utf-8]</tt> command when working with [[pdfTeX]]. See also [[Encodings and Regimes]] (This needs a bit of elaboration!)<br />
<br />
=== Why should I only use letters, digits and hyphens in file/path names? ===<br />
:Please see section "Files" of the [http://pmrb.free.fr/contextref.pdf ConTeXt manual]. And also [http://www.ntg.nl/pipermail/ntg-context/2011/057342.html here] for some discussion on the mailing-list.<br />
<br />
== ConTeXt vs. LaTeX ==<br />
<br />
=== What are the differences between ConTeXt and LaTeX? ===<br />
<br />
:The main difference between the two, in my opinion, is a philosophical one: LaTeX was created with the idea of separating content and presentation to such an extent that the typical author would write their content and then use a style file created by someone else to provide the visual presentation. Thus, the proliferation of style files and related things.<br />
<br />
:ConTeXt, on the other hand, retained the idea of separating content and presentation, but was created with the idea of being used for books, where each book tends to have a different layout, and so the expected "end user" is the person doing all the layout. Thus, it's designed to provide a vast amount of flexibility for layout in a way that can be fairly easily defined without needing to write a package (or go find one that's already written).<br />
<br />
:To some extent, modern LaTeX has become a lot more like ConTeXt's intent, with a large quantity of packages, and classes like "memoir" that are designed to give the end user a large amount of control of the visual presentation. Thus, the difference is more one of focus and arrangement -- ConTeXt is all "of a piece" and most things are built in and designed as a complete set, whereas with LaTeX it's generally the case that when you want to do something different, you need to find the right package, and sometimes find that there are three that almost do what you want and none that are quite right (but, then, that also means that there are usually choices for how to do things, which can be good.)<br />
<br />
:Another difference is that IMO, ConTeXt is a lot easier to program in. It was designed a fair bit later than LaTeX, for much faster computers, and thus includes a lot of things that make it load and run slower but make programming a lot easier. <br />
<br />
:Author: Brooks Moses on c.t.t. usenet<br />
<br />
:(Note that the internal coding of ConTeXt has become much easier, too, with the use of LuaTeX - or perhaps seemingly more complicated, as one has to then learn lua to understand the internal workings of ConTeXt. Most users will never delve into this level, but do indeed benefit from the increased performance of the ConTeXt system. The loading of the ConTeXt macros and the processing of even very large typesetting projects is not slow!)<br />
<br />
=== What are the advantages of ConTeXt over LaTeX? ===<br />
<br />
:ConTeXt is a macro package that’s far more advanced than LaTeX. You can enhance LaTeX with third party packages, but not all macro packages work together with each other. ConTeXt is an integrated, powerful and flexible macro package for which you seldom need third party packages. ConTeXt also has been used to create large and complex on-screen documents, including hyperlinks, on screen buttons, forms, cross-document links, and so on.<br />
<br />
:Source: ''LaTeX in proper ConTeXt'' (by Berend de Boer)<br />
<br />
=== What are the advantages of LaTeX over ConTeXt? ===<br />
<br />
:It has been a long battle to get publishers of scientific journals, for example, to accept submissions coded in LaTeX. Currently, submitting a ConTeXt document to such journals or to open repositories such as arXiv is problematic. This is one reason to continue using LaTeX for such work.<br />
<br />
:Another advantage is that many good books on LaTeX exist. Documentation of ConTeXt is not satisfactory, as attested by much activity on the mailing list, but is slowly being improved. And good books on the use of ConTeXt need to be written!<br />
<br />
=== How transcribe this LaTeX macro to ConTeXt? ===<br />
Could you please advice me, how transcribe this macro, controlling that no last line of a paragraph is shorter than the paragraph indenting?<br />
<br />
<texcode><br />
\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em<br />
</texcode><br />
<br />
Like this:<br />
<texcode><br />
\installalign<br />
{block}<br />
{\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em}<br />
<br />
% followed by<br />
\setupalign[block]<br />
</texcode><br />
<br />
== XML and other formats ==<br />
<br />
=== How can I convert a document into RTF or HTML? ===<br />
<br />
:Hot topic on the mailing list!<br />
<br />
:There's currently no converter such as LaTeX2html available for ConTeXt. If you're ready to pay a price and put some more effort in your document, the best way is to use XML and produce PDF out of it with ConTeXt and HTML using XSLT.<br />
<br />
:[http://archive.contextgarden.net/thread/20050921.151245.b6a6f87e.en.html ConTeXt to RTF Conversion]<br />
<br />
=== What about the other way around? ===<br />
<br />
:[http://archive.contextgarden.net/thread/20050926.213139.45057948.en.html DOC/RTF to ConTeXt via XML]<br />
<br />
=== XML: please tell me more about it ===<br />
There is a section on the wiki dedicated to typesetting [[XML]] under the various flavours of ConTeXt.<br />
<br />
== Fonts and Typography ==<br />
<br />
=== Can I change to LaTeX’s Computer Modern font? ===<br />
<br />
I see differences in screen between default fonts in ConTeXt (Latin Modern) and LaTeX (Computer Modern). Can I switch to LaTeX default font?. I think it's more aesthetical.<br />
: No.<br />
: ''(I mean - of course you can; you only need to modify a few type-xxx.tex files and replace lm with cm in the source. But that solution is not/will not be supported officially.)''<br />
:: Is there any tutorial for doing it?<br />
::: ''No. There are no tutorials for the things that one is not supposed to mess with. Take a look at how things are done in those files and replace any occurrence of lm with cm.''<br />
: There might be a workaround for this. Install the [http://cm-unicode.sourceforge.net/ OpenType version of Computer Modern fonts] on your system and use it with <code>simplefonts</code>.<br />
<br />
=== How can I get the “oldstyle numbers” (text figures) in a document? ===<br />
The mediaeval numbers can be inserted locally via the font switch <code>\os</code>.<br />
<br />
With OpenType fonts that come with text figures you can just ''add'' the respective<br />
font feature to the set of font features.<br />
<br />
<texcode><br />
\definefontfeature[default][default][onum=yes]<br />
<br />
\setupbodyfont[schola,8pt]<br />
<br />
\starttext<br />
1234567890<br />
\stoptext<br />
</texcode><br />
<br />
or<br />
<br />
<texcode><br />
\setupbodyfont[schola,8pt]<br />
<br />
\definefontfeature[oldstyle][onum=yes]<br />
<br />
\starttext<br />
1234567890 {\addff{oldstyle}1234567890}<br />
\stoptext<br />
</texcode><br />
<br />
See mailing list discussion at http://www.ntg.nl/pipermail/ntg-context/2011/058394.html .<br />
<br />
(You can check whether your font supports the “onum” feature by running<br />
<code>otfinfo -f</code> on the OTF file.)<br />
<br />
== Alignment ==<br />
<br />
=== Why does <code>\startalignment[right]</code> or <code>\framed[align=right]{some text}</code> align my text left instead of right and vice versa? ===<br />
:This is for backward compatibility with older versions; see [[Right and left]]. Hans was originally thinking of "ragged right" and "ragged left" alignment. Use '''flushleft''' and '''flushright''' instead.<br />
<br />
=== Why is \framed{} not centred? ===<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\framed{middle?}<br />
\stopalignment<br />
\startalignment[middle]<br />
middle!<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
Answer: \framed switches to vmode, so you need \dontleavehmode:<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\dontleavehmode<br />
\framed{middle!}<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
== Spacing ==<br />
<br />
=== <code>\setupindenting[medium]</code> doesn't work? ===<br />
:This does work, but the effect is not what you expect. Without <code>yes</code>, you have now set up the default size, but you have not turned paragraph indenting on. You have to execute <code>\setupindenting[yes]</code> before it starts actually indenting your paragraphs.<br />
<br />
=== How can I get a horizontal space with a defined width, so as ex. "\hspace{3em}" or "\hspace*{3em}" in LaTeX? ===<br />
:A horizontal space can be inserted with the TeX-Primitive <code>\hskip〈dimension〉</code> or with the ConTeXt command <cmd>hspace</cmd><tt>[identifier]</tt>.<br />
<br />
=== Why is there a line-break in the output after some commands? ===<br />
<texcode><br />
\starttext<br />
\externalfigure[hacker][width=1cm] Why a new line here?<br />
\stoptext<br />
</texcode><br />
<br />
Answer: \externalfigure switches to vmode, so you need \dontleavehmode:<br />
<texcode><br />
\starttext<br />
\dontleavehmode<br />
\externalfigure[hacker][width=1cm] Same line!<br />
\stoptext<br />
</texcode><br />
<br />
== Math ==<br />
<br />
=== Does $$...$$ work for display math, like in (La)TeX? ===<br />
:No; the spacing above and below the equation will be wrong, and maybe other aspects too. Instead use <cmd>startformula</cmd> and <cmd>stopformula</cmd> (just as one rather generally prefers to use <cmd>begin{equation}</cmd> and <cmd>end{equation}</cmd> in LaTeX).<br />
<br />
=== How do I get a numbered equation? ===<br />
:Add <cmd>placeformula</cmd> before the <cmd>startformula</cmd>.<br />
<br />
== Misc ==<br />
<br />
=== Can I use some simpler bibliography method? ===<br />
<br />
I see that the method of [[http://wiki.contextgarden.net/Bibliography adding references in ConTexT]] is like bibtex in latex. Is there any simple methood like build-in latex method (\thebibliography)?<br />
: Perhaps [[http://wiki.contextgarden.net/Simple_Bibliography Simple bibliography (in simple bibliography)]]?<br />
<br />
=== How do I make a presentation? ===<br />
<br />
:You don't need any special package (like prosper or seminar in LaTeX) to make a presentation. In contrast to LaTeX, changing the document size, changing colors, adding hyperlinks, ... appears to be extremely simple in ConTeXt. See [[Presentations]] for more specific topics.</div>Peterhttps://wiki.contextgarden.net/index.php?title=Future_ConTeXt_Users&diff=13496Future ConTeXt Users2011-11-25T15:37:02Z<p>Peter: just a comma</p>
<hr />
<div>[[Image:Pierre.jpg|200px|Pierre, Peter's first son]][[Image:Mario.jpg|200px|Mario, Peter's second son]]<br><br />
[[Image:Rudy.jpg|200px|Rudy, Peter's third son]][[Image:Julia.jpg|200px|Julia, Peter's first daughter]]<br />
<br />
Pierre, Mario, Rudy and Julia, [[User:Peter|Peter]]'s children<br />
<br />
[[Image:Martina.jpg|400px|Son of Luigi]]<br />
<br />
Martina, [[User:Luigi.scarso|Luigi]]'s second daughter, born 09 August 2007 (09/08/07)<br />
<br />
<br />
[[Image:Pius.jpg|400px|Son of Steffen]]<br />
<br />
Pius, third child of [[User:Steffen|Steffen]], born 09 August 2007 (09/08/07), too.<br />
<br />
<br />
[[Image:KonradRobert.jpg|400px|Son of Patrick]]<br />
<br />
Konrad Robert, son of [[User:Patrick Gundlach|Patrick]], born 2006-10-31.</div>Peterhttps://wiki.contextgarden.net/index.php?title=Future_ConTeXt_Users&diff=13460Future ConTeXt Users2011-11-01T19:03:15Z<p>Peter: some more children</p>
<hr />
<div>[[Image:Pierre.jpg|200px|Pierre, Peter's first son]][[Image:Mario.jpg|200px|Mario, Peter's second son]]<br><br />
[[Image:Rudy.jpg|200px|Rudy, Peter's third son]][[Image:Julia.jpg|200px|Julia, Peter's first daughter]]<br />
<br />
Pierre, Mario, Rudy and Julia [[User:Peter|Peter]]'s children<br />
<br />
[[Image:Martina.jpg|400px|Son of Luigi]]<br />
<br />
Martina, [[User:Luigi.scarso|Luigi]]'s second daughter, born 09 August 2007 (09/08/07)<br />
<br />
<br />
[[Image:Pius.jpg|400px|Son of Steffen]]<br />
<br />
Pius, third child of [[User:Steffen|Steffen]], born 09 August 2007 (09/08/07), too.<br />
<br />
<br />
[[Image:KonradRobert.jpg|400px|Son of Patrick]]<br />
<br />
Konrad Robert, son of [[User:Patrick Gundlach|Patrick]], born 2006-10-31.</div>Peterhttps://wiki.contextgarden.net/index.php?title=File:Julia.jpg&diff=13459File:Julia.jpg2011-11-01T18:54:17Z<p>Peter: Julia</p>
<hr />
<div>Julia</div>Peterhttps://wiki.contextgarden.net/index.php?title=File:Rudy.jpg&diff=13458File:Rudy.jpg2011-11-01T18:52:18Z<p>Peter: Rudy</p>
<hr />
<div>Rudy</div>Peterhttps://wiki.contextgarden.net/index.php?title=File:Mario.jpg&diff=13457File:Mario.jpg2011-11-01T18:46:01Z<p>Peter: uploaded a new version of &quot;File:Mario.jpg&quot;: square</p>
<hr />
<div>Mario, Peter's second son. Born on June 29, 2007.<br />
Photo taken on June 30, 2007.</div>Peterhttps://wiki.contextgarden.net/index.php?title=File:Pierre.jpg&diff=13456File:Pierre.jpg2011-11-01T18:44:48Z<p>Peter: uploaded a new version of &quot;File:Pierre.jpg&quot;: square</p>
<hr />
<div>Pierre, Peter's first son. Born on June 16, 2005.<br />
Photo taken on August 11, 2007.</div>Peterhttps://wiki.contextgarden.net/index.php?title=Mark_IV&diff=12948Mark IV2011-03-27T20:00:33Z<p>Peter: /* Troubleshooting */ more details from Taco</p>
<hr />
<div>== Introducing Mark IV (and MkVI) ==<br />
<br />
Mark IV is the name of the [[LuaTeX]]-aware part of ConTeXt; that is, when you use ConTeXt over the LuaTeX engine instead of PDFTeX or XeTeX. You run it with<br />
texexec --lua filename<br />
or<br />
context filename<br />
<br />
There are fundamental differences between Mark IV and Mark II that you should be aware of. Many parts of ConTeXt have been redesigned from scratch making extensive use of the Lua programming language. And that is besides the heavy use of LuaTeX-only features in MkIV. As a result, there are a few intentional incompatibilities between the two ConTeXt versions. See [[MkIV Differences]] for these details.<br />
<br />
The first public beta has been released on the 6th of August, 2007. Currently the easiest way to try it out is to install [[ConTeXt Minimals]].<br />
<br />
It takes advantage of the amazing capabilities of LuaTeX and opens up a whole new world of possibilities, in particular with fonts.<br />
<br />
In the distribution the MkII files have suffix 'mkiv'. There are also files with suffix 'mkvi' and more will follow. The most significant difference is that these files use a different (and still somewhat experimental) syntax. <br />
<br />
== Installation and maintenance ==<br />
<br />
The Mark IV code needs to be configured before it is usable. [[Running Mark IV|This page]] explains how to do that. <br />
<br />
== Troubleshooting ==<br />
<br />
The environment variable TEXINPUTS has to be empty or unset. If not, you can get errors about "file/module/whatever not found".<br />
<br />
TEXINPUTS can *always* be a problem and really should not be used at all any more. It is a historical environment variable from the nineties, and it overrules just about every path in a modern texmf tree.<br />
<br />
If you need something special, use TEXMFLOCAL or TEXMFPROJECT instead.<br />
<br />
== Sample code ==<br />
<br />
Here are some examples of cool stuff you can do with Mark IV.<br />
=== Lua core ===<br />
<br />
The first thing you will want to test are the lua functions. Try<br />
<br />
<texcode><br />
\ctxlua{a = 1.5 ; b = 1.8 ; c = a*b ; tex.print(c) ;}<br />
</texcode><br />
<br />
or the equivalent:<br />
<br />
<texcode><br />
\startlua<br />
a = 1.5<br />
b = 1.8<br />
c = a*b<br />
tex.print(c)<br />
\stoplua<br />
</texcode><br />
<br />
You can also do more elaborate calculations with the lua <code>math</code> library:<br />
<br />
<texcode><br />
\ctxlua{tex.print("$\string\\sqrt{2} = " .. math.sqrt(2) .. "$")}<br />
</texcode><br />
<br />
Note that the above works with any flavour of LuaTeX; nothing is actually ConTeXt-specific (except for <cmd>ctxlua</cmd> and <cmd>startlua</cmd>/<cmd>stoplua</cmd>).<br />
<br />
=== Fonts and typescripts ===<br />
<br />
This is detailed in [[Fonts in LuaTeX]].<br />
<br />
=== More sample code ===<br />
<br />
Other examples of Lua(TeX) code are to be found on [[User:Luigi.scarso#Luatex_examples|Luigi's user page]] as well as [http://luatex.bluwiki.com/ http://luatex.bluwiki.com/]<br />
<br />
[[Category:LuaTeX]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=FAQ&diff=12927FAQ2011-03-18T10:03:44Z<p>Peter: minor corrections</p>
<hr />
<div>{{todo|This FAQ needs to have a lot of things worked on. To avoid clutter from repeated TODO tags, just note missing answers with "...", and put notes about missing information in parentheses.}}<br />
<br />
== ConTeXt General ==<br />
<br />
=== What is ConTeXt? ===<br />
:It is a document production system based on Donald Knuth's [http://www.tug.org/ TeX]. It is a set of high-level macros written in the (somewhat arcane) TeX language, and these macros simplify the task of designing layouts, making hyperlinks, etc.<br />
<br />
=== How does ConTeXt versioning work? ===<br />
:There are 2 different development trees for ConTeXt, called Mark II and Mark IV (MkII, MkIV). They are always released together in a single package because they share a fair amount of code. MkII is stable and is in maintenance-only mode, MkIV is actively developed, including several enhanced features and completely new font handling.<br />
:There are 3 different typesetting engines that work with ConTeXt: pdfTeX, XeTeX and LuaTeX. MkIV works only with LuaTeX, MkII with any one of the engines (pdfTeX is the default). Font setups (typescripts) differ per engine. <br />
:ConTeXt releases are identified by a time stamp, e.g. ''2010.06.23 12:45''. At most times, there is both a ''current'' and a ''beta'' ConTeXt release package available. As explained above, both packages contain MkII and MkIV, the difference between ''current'' and ''beta'' is that the latter contains the unstable developments to MkIV for testing by power users.<br />
:Since "betas" are declared "current" only a few times a year and no bugfixes happen for "currents" (in contrary to "stable" branches in many software projects), you’re mostly better off with beta. It has some bugs fixed, bur mostly some new bugs. If you need a really stable and reliable system and can’t wait a few days for a fix, stick with MkII.<br />
<br />
== Starting with ConTeXt ==<br />
<br />
=== How do I install ConTeXt? ===<br />
:See [[Installation]]<br />
<br />
=== Is there a hello-world document? ===<br />
:Yes. See [[First Document]] and [[Hello world]].<br />
<br />
=== Is ConTeXt free (libre, open source) software? ===<br />
:Yes. See the [[Read Me]] page for details.<br />
<br />
=== Does ConTeXt support Unicode? ===<br />
:Yes. It supports Unicode (UTF-8). In [[XeTeX]] and [[LuaTeX]] it is the default input encoding, while you need to use <cmd>enableregime</cmd><tt>[utf-8]</tt> command when working with [[pdfTeX]]. See also [[Encodings and Regimes]] (This needs a bit of elaboration!)<br />
<br />
=== Why should I only use letters, digits and hyphens in file/path names? ===<br />
:Please see section "Files" of the [http://pmrb.free.fr/contextref.pdf ConTeXt manual]. And also [http://www.ntg.nl/pipermail/ntg-context/2011/057342.html here] for some discussion on the mailing-list.<br />
<br />
== ConTeXt vs. LaTeX ==<br />
<br />
=== What are the differences between ConTeXt and LaTeX? ===<br />
<br />
:The main difference between the two, in my opinion, is a philosophical one: LaTeX was created with the idea of separating content and presentation to such an extent that the typical author would write their content and then use a style file created by someone else to provide the visual presentation. Thus, the proliferation of style files and related things.<br />
<br />
:ConTeXt, on the other hand, retained the idea of separating content and presentation, but was created with the idea of being used for books, where each book tends to have a different layout, and so the expected "end user" is the person doing all the layout. Thus, it's designed to provide a vast amount of flexibility for layout in a way that can be fairly easily defined without needing to write a package (or go find one that's already written).<br />
<br />
:To some extent, modern LaTeX has become a lot more like ConTeXt's intent, with a large quantity of packages, and classes like "memoir" that are designed to give the end user a large amount of control of the visual presentation. Thus, the difference is more one of focus and arrangement -- ConTeXt is all "of a piece" and most things are built in and designed as a complete set, whereas with LaTeX it's generally the case that when you want to do something different, you need to find the right package, and sometimes find that there are three that almost do what you want and none that are quite right (but, then, that also means that there are usually choices for how to do things, which can be good.)<br />
<br />
:Another difference is that IMO, ConTeXt is a lot easier to program in. It was designed a fair bit later than LaTeX, for much faster computers, and thus includes a lot of things that make it load and run slower but make programming a lot easier. <br />
<br />
:Author: Brooks Moses on c.t.t. usenet<br />
<br />
:(Note that the internal coding of ConTeXt has become much easier, too, with the use of LuaTeX - or perhaps seemingly more complicated, as one has to then learn lua to understand the internal workings of ConTeXt. Most users will never delve into this level, but do indeed benefit from the increased performance of the ConTeXt system. The loading of the ConTeXt macros and the processing of even very large typesetting projects is not slow!)<br />
<br />
=== What are the advantages of ConTeXt over LaTeX? ===<br />
<br />
:ConTeXt is a macro package that’s far more advanced than LaTeX. You can enhance LaTeX with third party packages, but not all macro packages work together with each other. ConTeXt is an integrated, powerful and flexible macro package for which you seldom need third party packages. ConTeXt also has been used to create large and complex on-screen documents, including hyperlinks, on screen buttons, forms, cross-document links, and so on.<br />
<br />
:Source: ''LaTeX in proper ConTeXt'' (by Berend de Boer)<br />
<br />
=== What are the advantages of LaTeX over ConTeXt? ===<br />
<br />
:It has been a long battle to get publishers of scientific journals, for example, to accept submissions coded in LaTeX. Currently, submitting a ConTeXt document to such journals or to open repositories such as arXiv is problematic. This is one reason to continue using LaTeX for such work.<br />
<br />
:Another advantage is that many good books on LaTeX exist. Documentation of ConTeXt is not satisfactory, as attested by much activity on the mailing list, but is slowly being improved. And good books on the use of ConTeXt need to be written!<br />
<br />
=== How transcribe this LaTeX macro to ConTeXt? ===<br />
Could you please advice me, how transcribe this macro, controlling that no last line of a paragraph is shorter than the paragraph indenting?<br />
<br />
<texcode><br />
\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em<br />
</texcode><br />
<br />
Like this:<br />
<texcode><br />
\installalign<br />
{block}<br />
{\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em}<br />
<br />
% followed by<br />
\setupalign[block]<br />
</texcode><br />
<br />
== XML and other formats ==<br />
<br />
=== How can I convert a document into RTF or HTML? ===<br />
<br />
:Hot topic on the mailing list!<br />
<br />
:There's currently no converter such as LaTeX2html available for ConTeXt. If you're ready to pay a price and put some more effort in your document, the best way is to use XML and produce PDF out of it with ConTeXt and HTML using XSLT.<br />
<br />
:[http://archive.contextgarden.net/thread/20050921.151245.b6a6f87e.en.html ConTeXt to RTF Conversion]<br />
<br />
=== What about the other way around? ===<br />
<br />
:[http://archive.contextgarden.net/thread/20050926.213139.45057948.en.html DOC/RTF to ConTeXt via XML]<br />
<br />
=== XML: please tell me more about it ===<br />
There is a section on the wiki dedicated to typesetting [[XML]] under the various flavours of ConTeXt.<br />
<br />
== Fonts and Typography ==<br />
<br />
=== Can I change to LaTeX’s Computer Modern font? ===<br />
<br />
I see differences in screen between default fonts in ConTeXt (latin modern) and LaTeX (computer modern). Can I switch to latex default font?. I think it's more stetical<br />
: No.<br />
: ''(I mean - of course you can; you only need to modify a few type-xxx.tex files and replace lm with cm in the source. But that solution is not/will not be supported officially.)''<br />
:: Is there any tutorial for doing it?<br />
::: ''No. There are no tutorials for the things that one is not supposed to mess with. Take a look at how things are done in those files and replace any occurrence of lm with cm.''<br />
<br />
=== How can I get the “oldstyle numbers” (text figures) in a document? ===<br />
The mediaeval numbers can be inserted locally via the font switch <code>\os</code>.<br />
<br />
With OpenType fonts that come with text figures you can just ''add'' the respective<br />
font feature to the current set of font features.<br />
<br />
<texcode><br />
% defining a new feature set called “oldstyle”<br />
\definefontfeature [oldstyle] [default] [onum=yes]<br />
<br />
% adding this feature set<br />
\addff{oldstyle}<br />
<br />
\starttext<br />
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987<br />
\stoptext<br />
</texcode><br />
<br />
(You can check whether your font supports the “onum” feature by running<br />
<code>otfinfo -f</code> on the OTF file.)<br />
<br />
== Alignment ==<br />
<br />
=== Why does <code>\startalignment[right]</code> or <code>\framed[align=right]{some text}</code> align my text left instead of right and vice versa? ===<br />
:This is for backward compatibility with older versions; see [[Right and left]]. Hans was originally thinking of "ragged right" and "ragged left" alignment. Use '''flushleft''' and '''flushright''' instead.<br />
<br />
=== Why is \framed{} not centred? ===<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\framed{middle?}<br />
\stopalignment<br />
\startalignment[middle]<br />
middle!<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
Answer: \framed switches to vmode, so you need \dontleavehmode:<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\dontleavehmode<br />
\framed{middle!}<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
== Spacing ==<br />
<br />
=== <code>\setupindenting[medium]</code> doesn't work? ===<br />
:This does work, but the effect is not what you expect. Without <code>yes</code>, you have now set up the default size, but you have not turned paragraph indenting on. You have to execute <code>\setupindenting[yes]</code> before it starts actually indenting your paragraphs.<br />
<br />
=== How can I get a horizontal space with a defined width, so as ex. "\hspace{3em}" or "\hspace*{3em}" in LaTeX? ===<br />
:A horizontal space can be inserted with the TeX-Primitive<code>hskip〈dimension〉</code> or with the ConTeXt command <cmd>hspace</cmd><tt>[identifier]</tt>.<br />
<br />
=== Why is there a line-break in the output after some commands? ===<br />
<texcode><br />
\starttext<br />
\externalfigure[hacker][width=1cm] Why a new line here?<br />
\stoptext<br />
</texcode><br />
<br />
Answer: \externalfigure switches to vmode, so you need \dontleavehmode:<br />
<texcode><br />
\starttext<br />
\dontleavehmode<br />
\externalfigure[hacker][width=1cm] Same line!<br />
\stoptext<br />
</texcode><br />
<br />
=== Why the space is gobbled after some commands? ===<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm] X<br />
\stoptext<br />
</texcode><br />
<br />
Answer: When you don't use all of the optional square bracket arguments,<br />
ConTeXt gobbles the space after the last square bracket. You have at<br />
least 2 solutions:<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm][] X % adding empty square brackets<br />
<br />
X \externalfigure[hacker][width=1cm]\ X % adding explicit space command<br />
\stoptext<br />
</texcode><br />
<br />
== Math ==<br />
<br />
=== Does $$...$$ work for display math, like in (La)TeX? ===<br />
:No; the spacing above and below the equation will be wrong, and maybe other aspects too. Instead use <cmd>startformula</cmd> and <cmd>stopformula</cmd> (just as one rather generally prefers to use <cmd>begin{equation}</cmd> and <cmd>end{equation}</cmd> in LaTeX).<br />
<br />
=== How do I get a numbered equation? ===<br />
:Add <cmd>placeformula</cmd> before the <cmd>startformula</cmd>.<br />
<br />
== Misc ==<br />
<br />
=== Can I use some simpler bibliography method? ===<br />
<br />
I see that the method of [[http://wiki.contextgarden.net/Bibliography adding references in ConTexT]] is like bibtex in latex. Is there any simple methood like build-in latex method (\thebibliography)?<br />
: Perhaps [[http://wiki.contextgarden.net/Simple_Bibliography Simple bibliography (in simple bibliography)]]?<br />
<br />
=== How do I make a presentation? ===<br />
<br />
:You don't need any special package (like prosper or seminar in LaTeX) to make a presentation. In contrast to LaTeX, changing the document size, changing colors, adding hyperlinks, ... appears to be extremely simple in ConTeXt. See [[Presentations]] for more specific topics.</div>Peterhttps://wiki.contextgarden.net/index.php?title=FAQ&diff=12913FAQ2011-03-14T22:33:09Z<p>Peter: /* Why should I only use letters, digits and hyphens in file/path names? */ fixed brackets</p>
<hr />
<div>{{todo|This FAQ needs to have a lot of things worked on. To avoid clutter from repeated TODO tags, just note missing answers with "...", and put notes about missing information in parentheses.}}<br />
<br />
=== What is ConTeXt? ===<br />
:It is a document production system based on Donald Knuth's [http://www.tug.org/ TeX]. It is a set of high-level macros written in the (somewhat arcane) TeX language, and these macros simplify the task of designing layouts, making hyperlinks, etc.<br />
<br />
=== How does ConTeXt versioning work? ===<br />
:There are 2 different development trees for ConTeXt, called Mark II and Mark IV (MkII, MkIV). They are always released together in a single package because they share a fair amount of code. MkII is stable and is in maintenance-only mode, MkIV is actively developed, including several enhanced features and completely new font handling.<br />
:There are 3 different typesetting engines that work with ConTeXt: pdfTeX, XeTeX and LuaTeX. MkIV works only with LuaTeX, MkII with any one of the engines (pdfTeX is the default). Font setups (typescripts) differ per engine. <br />
:ConTeXt releases are identified by a time stamp, e.g. ''2010.06.23 12:45''. At most times, there is both a ''current'' and a ''beta'' ConTeXt release package available. As explained above, both packages contain MkII and MkIV, the difference between ''current'' and ''beta'' is that the latter contains the unstable developments to MkIV for testing by power users.<br />
<br />
=== Is there a hello-world document? ===<br />
:Yes. See [[First Document]] and [[Hello world]].<br />
<br />
=== Is ConTeXt free (open source) software? ===<br />
:Yes. See the [[Read Me]] page for details.<br />
<br />
=== How do I install ConTeXt? ===<br />
<br />
:See [[Installation]]<br />
<br />
=== Does ConTeXt support Unicode? ===<br />
:Yes. It supports Unicode (UTF-8). In [[XeTeX]] and [[LuaTeX]] it is the default input encoding, while you need to use <cmd>enableregime</cmd><tt>[utf-8]</tt> command when working with [[pdfTeX]]. See also [[Encodings and Regimes]] (This needs a bit of elaboration!)<br />
<br />
=== Why does <code>\startalignment[right]</code> or <code>\framed[align=right]{some text}</code> align my text left instead of right and vice versa? ===<br />
:This is for backward compatibility with older versions; see [[Right and left]]. Hans was originally thinking of "ragged right" and "ragged left" alignment. Use '''flushleft''' and '''flushright''' instead.<br />
<br />
=== What are the differences between ConTeXt and LaTeX? ===<br />
<br />
:The main difference between the two, in my opinion, is a philosophical one: LaTeX was created with the idea of separating content and presentation to such an extent that the typical author would write their content and then use a style file created by someone else to provide the visual presentation. Thus, the proliferation of style files and related things.<br />
<br />
:ConTeXt, on the other hand, retained the idea of separating content and presentation, but was created with the idea of being used for books, where each book tends to have a different layout, and so the expected "end user" is the person doing all the layout. Thus, it's designed to provide a vast amount of flexibility for layout in a way that can be fairly easily defined without needing to write a package (or go find one that's already written).<br />
<br />
:To some extent, modern LaTeX has become a lot more like ConTeXt's intent, with a large quantity of packages, and classes like "memoir" that are designed to give the end user a large amount of control of the visual presentation. Thus, the difference is more one of focus and arrangement -- ConTeXt is all "of a piece" and most things are built in and designed as a complete set, whereas with LaTeX it's generally the case that when you want to do something different, you need to find the right package, and sometimes find that there are three that almost do what you want and none that are quite right (but, then, that also means that there are usually choices for how to do things, which can be good.)<br />
<br />
:Another difference is that IMO, ConTeXt is a lot easier to program in. It was designed a fair bit later than LaTeX, for much faster computers, and thus includes a lot of things that make it load and run slower but make programming a lot easier. <br />
<br />
:Author: Brooks Moses on c.t.t. usenet<br />
<br />
:(Note that the internal coding of ConTeXt has become much easier, too, with the use of LuaTeX - or perhaps seemingly more complicated, as one has to then learn lua to understand the internal workings of ConTeXt. Most users will never delve into this level, but do indeed benefit from the increased performance of the ConTeXt system. The loading of the ConTeXt macros and the processing of even very large typesetting projects is not slow!)<br />
<br />
=== What are the advantages of ConTeXt over LaTeX? ===<br />
<br />
:ConTeXt is a macro package that’s far more advanced than LaTeX. You can enhance LaTeX with third party packages, but not all macro packages work together with each other. ConTeXt is an integrated, powerful and flexible macro package for which you seldom need third party packages. ConTeXt also has been used to create large and complex on-screen documents, including hyperlinks, on screen buttons, forms, cross-document links, and so on.<br />
<br />
:Source: ''LaTeX in proper ConTeXt'' (by Berend de Boer)<br />
<br />
=== What are the advantages of LaTeX over ConTeXt? ===<br />
<br />
:It has been a long battle to get publishers of scientific journals, for example, to accept submissions coded in LaTeX. Currently, submitting a ConTeXt document to such journals or to open repositories such as arXiv is problematic. This is one reason to continue using LaTeX for such work.<br />
<br />
:Another advantage is that many good books on LaTeX exist. Documentation of ConTeXt is not satisfactory, as attested by much activity on the mailing list, but is slowly being improved. And good books on the use of ConTeXt need to be written!<br />
<br />
=== How can I convert a document into RTF or HTML? ===<br />
<br />
:Hot topic on the mailing list!<br />
<br />
:There's currently no converter such as LaTeX2html available for ConTeXt. If you're ready to pay a price and put some more effort in your document, the best way is to use XML and produce PDF out of it with ConTeXt and HTML using XSLT.<br />
<br />
:[http://archive.contextgarden.net/thread/20050921.151245.b6a6f87e.en.html ConTeXt to RTF Conversion]<br />
<br />
=== What about the other way around? ===<br />
<br />
:[http://archive.contextgarden.net/thread/20050926.213139.45057948.en.html DOC/RTF to ConTeXt via XML]<br />
<br />
<br />
=== Can I change to Computer Modern's LaTeX font? ===<br />
<br />
I see differences in screen between default fonts in ConTeXt (latin modern) and LaTeX (computer modern). Can I switch to latex default font?. I think it's more stetical<br />
: No.<br />
: ''(I mean - of course you can; you only need to modify a few type-xxx.tex files and replace lm with cm in the source. But that solution is not/will not be supported officially.)''<br />
:: Is there any tutorial for doing it?<br />
::: ''No. There are no tutorials for the things that one is not supposed to mess with. Take a look at how things are done in those files and replace any occurrence of lm with cm.''<br />
<br />
=== Can I use some simpler bibliography method? ===<br />
<br />
I see that the method of [[http://wiki.contextgarden.net/Bibliography adding references in ConTexT]] is like bibtex in latex. Is there any simple methood like build-in latex method (\thebibliography)?<br />
: Perhaps [[http://wiki.contextgarden.net/Simple_Bibliography Simple bibliography (in simple bibliography)]]?<br />
<br />
=== XML: please tell me more about it ===<br />
There is a section on the wiki dedicated to typesetting [[XML]] under the various flavours of ConTeXt.<br />
<br />
=== How do I make a presentation? ===<br />
<br />
:You don't need any special package (like prosper or seminar in LaTeX) to make a presentation. In contrast to LaTeX, changing the document size, changing colors, adding hyperlinks, ... appears to be extremely simple in ConTeXt. See [[Presentations]] for more specific topics.<br />
<br />
=== <code>\setupindenting[medium]</code> doesn't work? ===<br />
<br />
:This does work, but the effect is not what you expect. Without <code>yes</code>, you have now set up the default size, but you have not turned paragraph indenting on. You have to execute <code>\setupindenting[yes]</code> before it starts actually indenting your paragraphs.<br />
<br />
=== Does $$...$$ work for display math, like in (La)TeX? ===<br />
:No; the spacing above and below the equation will be wrong, and maybe other aspects too. Instead use <cmd>startformula</cmd> and <cmd>stopformula</cmd> (just as one rather generally prefers to use <cmd>begin{equation}</cmd> and <cmd>end{equation}</cmd> in LaTeX).<br />
<br />
=== How do I get a numbered equation? ===<br />
:Add <cmd>placeformula</cmd> before the <cmd>startformula</cmd>.<br />
<br />
=== How can I get a horizontal space with a defined width, so as ex. "\hspace{3em}" or "\hspace*{3em}" in LaTeX? ===<br />
:A horizontal space can be inserted with the TeX-Primitive<cmd>hskip〈dimension〉</cmd> or with the ConTeXt command <cmd>hspace[identifier]</cmd>.<br />
<br />
=== How can I get the “oldstyle numbers” (text figures) in a document? ===<br />
The mediaeval numbers can be inserted locally via the font switch <code>\os</code>.<br />
<br />
With OpenType fonts that come with text figures you can just ''add'' the respective<br />
font feature to the current set of font features.<br />
<br />
<texcode><br />
% defining a new feature set called “oldstyle”<br />
\definefontfeature [oldstyle] [default] [onum=yes]<br />
<br />
% adding this feature set<br />
\addff{oldstyle}<br />
<br />
\starttext<br />
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987<br />
\stoptext<br />
</texcode><br />
<br />
(You can check whether your font supports the “onum” feature by running<br />
<code>otfinfo -f</code> on the OTF file.)<br />
<br />
=== How transcribe this LaTeX macro to ConTEXt? ===<br />
Could you please advice me, how transcribe this macro, controlling that no last line of a paragraph is shorter than the paragraph indenting?<br />
<br />
<texcode><br />
\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em<br />
</texcode><br />
<br />
Like this:<br />
<texcode><br />
\installalign<br />
{block}<br />
{\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em}<br />
<br />
% followed by<br />
\setupalign[block]<br />
</texcode><br />
<br />
=== Why is \framed{} not centred? ===<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\framed{middle?}<br />
\stopalignment<br />
\startalignment[middle]<br />
middle!<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
Answer: \framed switches to vmode, so you need \dontleavehmode:<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\dontleavehmode<br />
\framed{middle!}<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
=== Why is there a line-break in the output after some commands? ===<br />
<texcode><br />
\starttext<br />
\externalfigure[hacker][width=1cm] Why a new line here?<br />
\stoptext<br />
</texcode><br />
<br />
Answer: See previous answer!<br />
<texcode><br />
\starttext<br />
\dontleavehmode<br />
\externalfigure[hacker][width=1cm] Same line!<br />
\stoptext<br />
</texcode><br />
<br />
=== Why the space is gobbled after some commands? ===<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm] X<br />
\stoptext<br />
</texcode><br />
<br />
Answer: When you don't use all of the optional square bracket arguments,<br />
ConTeXt gobbles the space after the last square bracket. You have at<br />
least 2 solutions:<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm][] X % adding empty square brackets<br />
<br />
X \externalfigure[hacker][width=1cm]\ X % adding explicit space command<br />
\stoptext<br />
</texcode><br />
<br />
=== Why should I only use letters, digits and hyphens in file/path names? ===<br />
<br />
Answer: Please see section "Files" of the<br />
[http://pmrb.free.fr/contextref.pdf ConTeXt manual]. And also<br />
[http://www.ntg.nl/pipermail/ntg-context/2011/057342.html here] for<br />
some discussion on the mailing-list.</div>Peterhttps://wiki.contextgarden.net/index.php?title=FAQ&diff=12912FAQ2011-03-14T22:27:31Z<p>Peter: file names</p>
<hr />
<div>{{todo|This FAQ needs to have a lot of things worked on. To avoid clutter from repeated TODO tags, just note missing answers with "...", and put notes about missing information in parentheses.}}<br />
<br />
=== What is ConTeXt? ===<br />
:It is a document production system based on Donald Knuth's [http://www.tug.org/ TeX]. It is a set of high-level macros written in the (somewhat arcane) TeX language, and these macros simplify the task of designing layouts, making hyperlinks, etc.<br />
<br />
=== How does ConTeXt versioning work? ===<br />
:There are 2 different development trees for ConTeXt, called Mark II and Mark IV (MkII, MkIV). They are always released together in a single package because they share a fair amount of code. MkII is stable and is in maintenance-only mode, MkIV is actively developed, including several enhanced features and completely new font handling.<br />
:There are 3 different typesetting engines that work with ConTeXt: pdfTeX, XeTeX and LuaTeX. MkIV works only with LuaTeX, MkII with any one of the engines (pdfTeX is the default). Font setups (typescripts) differ per engine. <br />
:ConTeXt releases are identified by a time stamp, e.g. ''2010.06.23 12:45''. At most times, there is both a ''current'' and a ''beta'' ConTeXt release package available. As explained above, both packages contain MkII and MkIV, the difference between ''current'' and ''beta'' is that the latter contains the unstable developments to MkIV for testing by power users.<br />
<br />
=== Is there a hello-world document? ===<br />
:Yes. See [[First Document]] and [[Hello world]].<br />
<br />
=== Is ConTeXt free (open source) software? ===<br />
:Yes. See the [[Read Me]] page for details.<br />
<br />
=== How do I install ConTeXt? ===<br />
<br />
:See [[Installation]]<br />
<br />
=== Does ConTeXt support Unicode? ===<br />
:Yes. It supports Unicode (UTF-8). In [[XeTeX]] and [[LuaTeX]] it is the default input encoding, while you need to use <cmd>enableregime</cmd><tt>[utf-8]</tt> command when working with [[pdfTeX]]. See also [[Encodings and Regimes]] (This needs a bit of elaboration!)<br />
<br />
=== Why does <code>\startalignment[right]</code> or <code>\framed[align=right]{some text}</code> align my text left instead of right and vice versa? ===<br />
:This is for backward compatibility with older versions; see [[Right and left]]. Hans was originally thinking of "ragged right" and "ragged left" alignment. Use '''flushleft''' and '''flushright''' instead.<br />
<br />
=== What are the differences between ConTeXt and LaTeX? ===<br />
<br />
:The main difference between the two, in my opinion, is a philosophical one: LaTeX was created with the idea of separating content and presentation to such an extent that the typical author would write their content and then use a style file created by someone else to provide the visual presentation. Thus, the proliferation of style files and related things.<br />
<br />
:ConTeXt, on the other hand, retained the idea of separating content and presentation, but was created with the idea of being used for books, where each book tends to have a different layout, and so the expected "end user" is the person doing all the layout. Thus, it's designed to provide a vast amount of flexibility for layout in a way that can be fairly easily defined without needing to write a package (or go find one that's already written).<br />
<br />
:To some extent, modern LaTeX has become a lot more like ConTeXt's intent, with a large quantity of packages, and classes like "memoir" that are designed to give the end user a large amount of control of the visual presentation. Thus, the difference is more one of focus and arrangement -- ConTeXt is all "of a piece" and most things are built in and designed as a complete set, whereas with LaTeX it's generally the case that when you want to do something different, you need to find the right package, and sometimes find that there are three that almost do what you want and none that are quite right (but, then, that also means that there are usually choices for how to do things, which can be good.)<br />
<br />
:Another difference is that IMO, ConTeXt is a lot easier to program in. It was designed a fair bit later than LaTeX, for much faster computers, and thus includes a lot of things that make it load and run slower but make programming a lot easier. <br />
<br />
:Author: Brooks Moses on c.t.t. usenet<br />
<br />
:(Note that the internal coding of ConTeXt has become much easier, too, with the use of LuaTeX - or perhaps seemingly more complicated, as one has to then learn lua to understand the internal workings of ConTeXt. Most users will never delve into this level, but do indeed benefit from the increased performance of the ConTeXt system. The loading of the ConTeXt macros and the processing of even very large typesetting projects is not slow!)<br />
<br />
=== What are the advantages of ConTeXt over LaTeX? ===<br />
<br />
:ConTeXt is a macro package that’s far more advanced than LaTeX. You can enhance LaTeX with third party packages, but not all macro packages work together with each other. ConTeXt is an integrated, powerful and flexible macro package for which you seldom need third party packages. ConTeXt also has been used to create large and complex on-screen documents, including hyperlinks, on screen buttons, forms, cross-document links, and so on.<br />
<br />
:Source: ''LaTeX in proper ConTeXt'' (by Berend de Boer)<br />
<br />
=== What are the advantages of LaTeX over ConTeXt? ===<br />
<br />
:It has been a long battle to get publishers of scientific journals, for example, to accept submissions coded in LaTeX. Currently, submitting a ConTeXt document to such journals or to open repositories such as arXiv is problematic. This is one reason to continue using LaTeX for such work.<br />
<br />
:Another advantage is that many good books on LaTeX exist. Documentation of ConTeXt is not satisfactory, as attested by much activity on the mailing list, but is slowly being improved. And good books on the use of ConTeXt need to be written!<br />
<br />
=== How can I convert a document into RTF or HTML? ===<br />
<br />
:Hot topic on the mailing list!<br />
<br />
:There's currently no converter such as LaTeX2html available for ConTeXt. If you're ready to pay a price and put some more effort in your document, the best way is to use XML and produce PDF out of it with ConTeXt and HTML using XSLT.<br />
<br />
:[http://archive.contextgarden.net/thread/20050921.151245.b6a6f87e.en.html ConTeXt to RTF Conversion]<br />
<br />
=== What about the other way around? ===<br />
<br />
:[http://archive.contextgarden.net/thread/20050926.213139.45057948.en.html DOC/RTF to ConTeXt via XML]<br />
<br />
<br />
=== Can I change to Computer Modern's LaTeX font? ===<br />
<br />
I see differences in screen between default fonts in ConTeXt (latin modern) and LaTeX (computer modern). Can I switch to latex default font?. I think it's more stetical<br />
: No.<br />
: ''(I mean - of course you can; you only need to modify a few type-xxx.tex files and replace lm with cm in the source. But that solution is not/will not be supported officially.)''<br />
:: Is there any tutorial for doing it?<br />
::: ''No. There are no tutorials for the things that one is not supposed to mess with. Take a look at how things are done in those files and replace any occurrence of lm with cm.''<br />
<br />
=== Can I use some simpler bibliography method? ===<br />
<br />
I see that the method of [[http://wiki.contextgarden.net/Bibliography adding references in ConTexT]] is like bibtex in latex. Is there any simple methood like build-in latex method (\thebibliography)?<br />
: Perhaps [[http://wiki.contextgarden.net/Simple_Bibliography Simple bibliography (in simple bibliography)]]?<br />
<br />
=== XML: please tell me more about it ===<br />
There is a section on the wiki dedicated to typesetting [[XML]] under the various flavours of ConTeXt.<br />
<br />
=== How do I make a presentation? ===<br />
<br />
:You don't need any special package (like prosper or seminar in LaTeX) to make a presentation. In contrast to LaTeX, changing the document size, changing colors, adding hyperlinks, ... appears to be extremely simple in ConTeXt. See [[Presentations]] for more specific topics.<br />
<br />
=== <code>\setupindenting[medium]</code> doesn't work? ===<br />
<br />
:This does work, but the effect is not what you expect. Without <code>yes</code>, you have now set up the default size, but you have not turned paragraph indenting on. You have to execute <code>\setupindenting[yes]</code> before it starts actually indenting your paragraphs.<br />
<br />
=== Does $$...$$ work for display math, like in (La)TeX? ===<br />
:No; the spacing above and below the equation will be wrong, and maybe other aspects too. Instead use <cmd>startformula</cmd> and <cmd>stopformula</cmd> (just as one rather generally prefers to use <cmd>begin{equation}</cmd> and <cmd>end{equation}</cmd> in LaTeX).<br />
<br />
=== How do I get a numbered equation? ===<br />
:Add <cmd>placeformula</cmd> before the <cmd>startformula</cmd>.<br />
<br />
=== How can I get a horizontal space with a defined width, so as ex. "\hspace{3em}" or "\hspace*{3em}" in LaTeX? ===<br />
:A horizontal space can be inserted with the TeX-Primitive<cmd>hskip〈dimension〉</cmd> or with the ConTeXt command <cmd>hspace[identifier]</cmd>.<br />
<br />
=== How can I get the “oldstyle numbers” (text figures) in a document? ===<br />
The mediaeval numbers can be inserted locally via the font switch <code>\os</code>.<br />
<br />
With OpenType fonts that come with text figures you can just ''add'' the respective<br />
font feature to the current set of font features.<br />
<br />
<texcode><br />
% defining a new feature set called “oldstyle”<br />
\definefontfeature [oldstyle] [default] [onum=yes]<br />
<br />
% adding this feature set<br />
\addff{oldstyle}<br />
<br />
\starttext<br />
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987<br />
\stoptext<br />
</texcode><br />
<br />
(You can check whether your font supports the “onum” feature by running<br />
<code>otfinfo -f</code> on the OTF file.)<br />
<br />
=== How transcribe this LaTeX macro to ConTEXt? ===<br />
Could you please advice me, how transcribe this macro, controlling that no last line of a paragraph is shorter than the paragraph indenting?<br />
<br />
<texcode><br />
\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em<br />
</texcode><br />
<br />
Like this:<br />
<texcode><br />
\installalign<br />
{block}<br />
{\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em}<br />
<br />
% followed by<br />
\setupalign[block]<br />
</texcode><br />
<br />
=== Why is \framed{} not centred? ===<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\framed{middle?}<br />
\stopalignment<br />
\startalignment[middle]<br />
middle!<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
Answer: \framed switches to vmode, so you need \dontleavehmode:<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\dontleavehmode<br />
\framed{middle!}<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
=== Why is there a line-break in the output after some commands? ===<br />
<texcode><br />
\starttext<br />
\externalfigure[hacker][width=1cm] Why a new line here?<br />
\stoptext<br />
</texcode><br />
<br />
Answer: See previous answer!<br />
<texcode><br />
\starttext<br />
\dontleavehmode<br />
\externalfigure[hacker][width=1cm] Same line!<br />
\stoptext<br />
</texcode><br />
<br />
=== Why the space is gobbled after some commands? ===<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm] X<br />
\stoptext<br />
</texcode><br />
<br />
Answer: When you don't use all of the optional square bracket arguments,<br />
ConTeXt gobbles the space after the last square bracket. You have at<br />
least 2 solutions:<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm][] X % adding empty square brackets<br />
<br />
X \externalfigure[hacker][width=1cm]\ X % adding explicit space command<br />
\stoptext<br />
</texcode><br />
<br />
=== Why should I only use letters, digits and hyphens in file/path names? ===<br />
<br />
Answer: Please see section "Files" of the<br />
[[http://pmrb.free.fr/contextref.pdf ConTeXt manual]]. And also<br />
[[http://www.ntg.nl/pipermail/ntg-context/2011/057342.html here]] for<br />
some discussion on the mailing-list.</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/setupbackends&diff=12056Command/setupbackends2010-09-23T17:13:06Z<p>Peter: yet another spell-error-redirect</p>
<hr />
<div>#REDIRECT [[Reference/en/setupbackend]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=FAQ&diff=11811FAQ2010-06-27T07:26:37Z<p>Peter: /* Why the space is gobbled after some commands? */</p>
<hr />
<div>{{todo|This FAQ needs to have a lot of things worked on. To avoid clutter from repeated TODO tags, just note missing answers with "...", and put notes about missing information in parentheses.}}<br />
<br />
=== What is ConTeXt? ===<br />
:It is a document production system based on Donald Knuth's [[http://www.tug.org/ TeX]]. It is a set of high-level macros written in the (somewhat arcane) TeX language, and these macros simplify the task of designing layouts, making hyperlinks, etc.<br />
<br />
=== Is there a hello-world document? ===<br />
:Yes. See [[First Document]] and [[Hello world]].<br />
<br />
=== Is ConTeXt free (open source) software? ===<br />
:Yes. See the [[Read Me]] page for details.<br />
<br />
=== How do I install ConTeXt? ===<br />
<br />
:See [[Installation]]<br />
<br />
=== Does ConTeXt support Unicode? ===<br />
:Yes. It supports Unicode (utf-8) input, with the <cmd>enableregime</cmd><tt>[utf-8]</tt> command. See also [[Encodings and Regimes]] (This needs a bit of elaboration!) If you use [[XeTeX]], Unicode should work by default.<br />
<br />
=== Why does <code>\startalignment[right]</code> or <code>\framed[align=right]{some text}</code> align my text left instead of right and vice versa? ===<br />
:This is for backward compatibility with older versions; see [[Right and left]]. Hans was originally thinking of "ragged right" and "ragged left" alignment. Use '''flushleft''' and '''flushright''' instead.<br />
<br />
=== What are the differences between ConTeXt and LaTeX? ===<br />
<br />
:The main difference between the two, in my opinion, is a philosophical one: LaTeX was created with the idea of separating content and presentation to such an extent that the typical author would write their content and then use a style file created by someone else to provide the visual presentation. Thus, the proliferation of style files and related things.<br />
<br />
:ConTeXt, on the other hand, retained the idea of separating content and presentation, but was created with the idea of being used for books, where each book tends to have a different layout, and so the expected "end user" is the person doing all the layout. Thus, it's designed to provide a vast amount of flexibility for layout in a way that can be fairly easily defined without needing to write a package (or go find one that's already written).<br />
<br />
:To some extent, modern LaTeX has become a lot more like ConTeXt's intent, with a large quantity of packages, and classes like "memoir" that are designed to give the end user a large amount of control of the visual presentation. Thus, the difference is more one of focus and arrangement -- ConTeXt is all "of a piece" and most things are built in and designed as a complete set, whereas with LaTeX it's generally the case that when you want to do something different, you need to find the right package, and sometimes find that there are three that almost do what you want and none that are quite right (but, then, that also means that there are usually choices for how to do things, which can be good.)<br />
<br />
:Another difference is that IMO, ConTeXt is a lot easier to program in. It was designed a fair bit later than LaTeX, for much faster computers, and thus includes a lot of things that make it load and run slower but make programming a lot easier. <br />
<br />
:Author: Brooks Moses on c.t.t. usenet<br />
<br />
:(Note that the internal coding of ConTeXt has become much easier, too, with the use of LuaTeX - or perhaps seemingly more complicated, as one has to then learn lua to understand the internal workings of ConTeXt. Most users will never delve into this level, but do indeed benefit from the increased performance of the ConTeXt system. The loading of the ConTeXt macros and the processing of even very large typesetting projects is not slow!)<br />
<br />
=== What are the advantages of ConTeXt over LaTeX? ===<br />
<br />
:ConTeXt is a macro package that’s far more advanced than LaTeX. You can enhance LaTeX with third party packages, but not all macro packages work together with each other. ConTeXt is an integrated, powerful and flexible macro package for which you seldom need third party packages. ConTeXt also has been used to create large and complex on-screen documents, including hyperlinks, on screen buttons, forms, cross-document links, and so on.<br />
<br />
:Source: ''LaTeX in proper ConTeXt'' (by Berend de Boer)<br />
<br />
=== What are the advantages of LaTeX over ConTeXt? ===<br />
<br />
:It has been a long battle to get publishers of scientific journals, for example, to accept submissions coded in LaTeX. Currently, submitting a ConTeXt document to such journals or to open repositories such as arXiv is problematic. This is one reason to continue using LaTeX for such work.<br />
<br />
:Another advantage is that many good books on LaTeX exist. Documentation of ConTeXt is not satisfactory, as attested by much activity on the mailing list, but is slowly being improved. And good books on the use of ConTeXt need to be written!<br />
<br />
=== How can I convert a document into RTF or HTML? ===<br />
<br />
:Hot topic on the mailing list!<br />
<br />
:There's currently no converter such as LaTeX2html available for ConTeXt. If you're ready to pay a price and put some more effort in your document, the best way is to use XML and produce PDF out of it with ConTeXt and HTML using XSLT.<br />
<br />
:[http://archive.contextgarden.net/thread/20050921.151245.b6a6f87e.en.html ConTeXt to RTF Conversion]<br />
<br />
=== What about the other way around? ===<br />
<br />
:[http://archive.contextgarden.net/thread/20050926.213139.45057948.en.html DOC/RTF to ConTeXt via XML]<br />
<br />
<br />
=== Can I change to Computer Modern's LaTeX font? ===<br />
<br />
I see differences in screen between default fonts in ConTeXt (latin modern) and LaTeX (computer modern). Can I switch to latex default font?. I think it's more stetical<br />
: No.<br />
: ''(I mean - of course you can; you only need to modify a few type-xxx.tex files and replace lm with cm in the source. But that solution is not/will not be supported officially.)''<br />
:: Is there any tutorial for doing it?<br />
::: ''No. There are no tutorials for the things that one is not supposed to mess with. Take a look at how things are done in those files and replace any occurrence of lm with cm.''<br />
<br />
=== Can I use some simpler bibliography method? ===<br />
<br />
I see that the method of [[http://wiki.contextgarden.net/Bibliography adding references in ConTexT]] is like bibtex in latex. Is there any simple methood like build-in latex method (\thebibliography)?<br />
: Perhaps [[http://wiki.contextgarden.net/Simple_Bibliography Simple bibliography (in simple bibliography)]]?<br />
<br />
=== XML: please tell me more about it ===<br />
<br />
=== How do I make a presentation? ===<br />
<br />
:You don't need any special package (like prosper or seminar in LaTeX) to make a presentation. In contrast to LaTeX, changing the document size, changing colors, adding hyperlinks, ... appears to be extremely simple in ConTeXt. See [[Presentations]] for more specific topics.<br />
<br />
=== <code>\setupindenting[medium]</code> doesn't work? ===<br />
<br />
:This does work, but the effect is not what you expect. Without <code>yes</code>, you have now set up the default size, but you have not turned paragraph indenting on. You have to execute <code>\setupindenting[yes]</code> before it starts actually indenting your paragraphs.<br />
<br />
=== Does $$...$$ work for display math, like in (La)TeX? ===<br />
:No; the spacing above and below the equation will be wrong, and maybe other aspects too. Instead use <cmd>startformula</cmd> and <cmd>stopformula</cmd>.<br />
<br />
=== How do I get a numbered equation? ===<br />
:Add <cmd>placeformula</cmd> before the <cmd>startformula</cmd>.<br />
<br />
=== How can I get a horizontal space with a defined width, so as ex. "\hspace{3em}" or "\hspace*{3em}" in LaTeX? ===<br />
:A horizontal space can be inserted with the TeX-Primitive<cmd>hspace〈dimension〉</cmd> or with the ConTeXt command <cmd>hspace[identifier]</cmd>.<br />
<br />
=== How can I get the lowercase (medieval, oldstyle figures) numbers in a document? ===<br />
The mediaeval numbers can be inserted locally by "\os". I would prefer a global setting of them but I don't know how to do it.<br />
<br />
=== How transcribe this LaTeX macro to ConTEXt? ===<br />
Could you please advice me, how transcribe this macro, controlling that no last line of a paragraph is shorter than the paragraph indenting?<br />
<br />
<texcode><br />
\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em<br />
</texcode><br />
<br />
=== Why is \framed{} not centred? ===<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\framed{middle?}<br />
\stopalignment<br />
\startalignment[middle]<br />
middle!<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
Answer: \framed switches to vmode, so you need \dontleavehmode:<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\dontleavehmode<br />
\framed{middle!}<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
=== Why is there a line-break in the output after some commands? ===<br />
<texcode><br />
\starttext<br />
\externalfigure[hacker][width=1cm] Why a new line here?<br />
\stoptext<br />
</texcode><br />
<br />
Answer: See previous answer!<br />
<texcode><br />
\starttext<br />
\dontleavehmode<br />
\externalfigure[hacker][width=1cm] Same line!<br />
\stoptext<br />
</texcode><br />
<br />
=== Why the space is gobbled after some commands? ===<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm] X<br />
\stoptext<br />
</texcode><br />
<br />
Answer: When you don't use all of the optional square bracket arguments,<br />
ConTeXt gobbles the space after the last square bracket. You have at<br />
least 2 solutions:<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm][] X % adding empty square brackets<br />
<br />
X \externalfigure[hacker][width=1cm]\ X % adding explicit space command<br />
\stoptext<br />
</texcode></div>Peterhttps://wiki.contextgarden.net/index.php?title=FAQ&diff=11809FAQ2010-06-27T07:12:04Z<p>Peter: 2 new entries</p>
<hr />
<div>{{todo|This FAQ needs to have a lot of things worked on. To avoid clutter from repeated TODO tags, just note missing answers with "...", and put notes about missing information in parentheses.}}<br />
<br />
=== What is ConTeXt? ===<br />
:It is a document production system based on Donald Knuth's [[http://www.tug.org/ TeX]]. It is a set of high-level macros written in the (somewhat arcane) TeX language, and these macros simplify the task of designing layouts, making hyperlinks, etc.<br />
<br />
=== Is there a hello-world document? ===<br />
:Yes. See [[First Document]] and [[Hello world]].<br />
<br />
=== Is ConTeXt free (open source) software? ===<br />
:Yes. See the [[Read Me]] page for details.<br />
<br />
=== How do I install ConTeXt? ===<br />
<br />
:See [[Installation]]<br />
<br />
=== Does ConTeXt support Unicode? ===<br />
:Yes. It supports Unicode (utf-8) input, with the <cmd>enableregime</cmd><tt>[utf-8]</tt> command. See also [[Encodings and Regimes]] (This needs a bit of elaboration!) If you use [[XeTeX]], Unicode should work by default.<br />
<br />
=== Why does <code>\startalignment[right]</code> or <code>\framed[align=right]{some text}</code> align my text left instead of right and vice versa? ===<br />
:This is for backward compatibility with older versions; see [[Right and left]]. Hans was originally thinking of "ragged right" and "ragged left" alignment. Use '''flushleft''' and '''flushright''' instead.<br />
<br />
=== What are the differences between ConTeXt and LaTeX? ===<br />
<br />
:The main difference between the two, in my opinion, is a philosophical one: LaTeX was created with the idea of separating content and presentation to such an extent that the typical author would write their content and then use a style file created by someone else to provide the visual presentation. Thus, the proliferation of style files and related things.<br />
<br />
:ConTeXt, on the other hand, retained the idea of separating content and presentation, but was created with the idea of being used for books, where each book tends to have a different layout, and so the expected "end user" is the person doing all the layout. Thus, it's designed to provide a vast amount of flexibility for layout in a way that can be fairly easily defined without needing to write a package (or go find one that's already written).<br />
<br />
:To some extent, modern LaTeX has become a lot more like ConTeXt's intent, with a large quantity of packages, and classes like "memoir" that are designed to give the end user a large amount of control of the visual presentation. Thus, the difference is more one of focus and arrangement -- ConTeXt is all "of a piece" and most things are built in and designed as a complete set, whereas with LaTeX it's generally the case that when you want to do something different, you need to find the right package, and sometimes find that there are three that almost do what you want and none that are quite right (but, then, that also means that there are usually choices for how to do things, which can be good.)<br />
<br />
:Another difference is that IMO, ConTeXt is a lot easier to program in. It was designed a fair bit later than LaTeX, for much faster computers, and thus includes a lot of things that make it load and run slower but make programming a lot easier. <br />
<br />
:Author: Brooks Moses on c.t.t. usenet<br />
<br />
:(Note that the internal coding of ConTeXt has become much easier, too, with the use of LuaTeX - or perhaps seemingly more complicated, as one has to then learn lua to understand the internal workings of ConTeXt. Most users will never delve into this level, but do indeed benefit from the increased performance of the ConTeXt system. The loading of the ConTeXt macros and the processing of even very large typesetting projects is not slow!)<br />
<br />
=== What are the advantages of ConTeXt over LaTeX? ===<br />
<br />
:ConTeXt is a macro package that’s far more advanced than LaTeX. You can enhance LaTeX with third party packages, but not all macro packages work together with each other. ConTeXt is an integrated, powerful and flexible macro package for which you seldom need third party packages. ConTeXt also has been used to create large and complex on-screen documents, including hyperlinks, on screen buttons, forms, cross-document links, and so on.<br />
<br />
:Source: ''LaTeX in proper ConTeXt'' (by Berend de Boer)<br />
<br />
=== How can I convert a document into RTF or HTML? ===<br />
<br />
:Hot topic on the mailing list!<br />
<br />
:There's currently no converter such as LaTeX2html available for ConTeXt. If you're ready to pay a price and put some more effort in your document, the best way is to use XML and produce PDF out of it with ConTeXt and HTML using XSLT.<br />
<br />
:[http://archive.contextgarden.net/thread/20050921.151245.b6a6f87e.en.html ConTeXt to RTF Conversion]<br />
<br />
=== What about the other way around? ===<br />
<br />
:[http://archive.contextgarden.net/thread/20050926.213139.45057948.en.html DOC/RTF to ConTeXt via XML]<br />
<br />
<br />
=== Can I change to Computer Modern's LaTeX font? ===<br />
<br />
I see diferences in screen between default fonts in ConTeXt (latin modern) and LaTeX (computer modern). Can I switch to latex default font?. I think it's more stetical<br />
: No.<br />
: ''(I mean - of course you can; you only need to modify a few type-xxx.tex files and replace lm with cm in the source. But that solution is not/will not be supported officially.)''<br />
:: Is there any tutorial for doing it?<br />
::: ''No. There are no tutorials for the things that one is not supposed to mess with. Take a look at how things are done in those files and replace any occurrence of lm with cm.''<br />
<br />
=== Can I use some simpler bibliography method? ===<br />
<br />
I see that the method of [[http://wiki.contextgarden.net/Bibliography adding references in ConTexT]] is like bibtex in latex. Is there any simple methood like build-in latex method (\thebibliography)?<br />
: Perhaps [[http://wiki.contextgarden.net/Simple_Bibliography Simple bibliography (in simple bibliography)]]?<br />
<br />
=== XML: please tell me more about it ===<br />
<br />
=== How do I make a presentation? ===<br />
<br />
:You don't need any special package (like prosper or seminar in LaTeX) to make a presentation. In contrast to LaTeX, changing the document size, changing colors, adding hyperlinks, ... appears to be extremely simple in ConTeXt. See [[Presentations]] for more specific topics.<br />
<br />
=== <code>\setupindenting[medium]</code> doesn't work? ===<br />
<br />
:This does work, but the effect is not what you expect. Without <code>yes</code>, you have now set up the default size, but you have not turned paragraph indenting on. You have to execute <code>\setupindenting[yes]</code> before it starts actually indenting your paragraphs.<br />
<br />
=== Does $$...$$ work for display math, like in (La)TeX? ===<br />
:No; the spacing above and below the equation will be wrong, and maybe other aspects too. Instead use <cmd>startformula</cmd> and <cmd>stopformula</cmd>.<br />
<br />
=== How do I get a numbered equation? ===<br />
:Add <cmd>placeformula</cmd> before the <cmd>startformula</cmd>.<br />
<br />
=== How can I get a horizontal space with a defined width, so as ex. "\hspace{3em}" or "\hspace*{3em}" in LaTeX? ===<br />
:A horizontal space can be inserted with the TeX-Primitive<cmd>hspace〈dimension〉</cmd> or with the ConTeXt command <cmd>hspace[identifier]</cmd>.<br />
<br />
=== How can I get the lowercase (medieval, oldstyle figures) numbers in a document? ===<br />
The mediaeval numbers can be inserted locally by "\os". I would prefer a global setting of them but I don't know how to do it.<br />
<br />
=== How transcribe this LaTeX macro to ConTEXt? ===<br />
Could you please advice me, how transcribe this macro, controlling that no last line of a paragraph is shorter than the paragraph indenting?<br />
<br />
<texcode><br />
\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em<br />
</texcode><br />
<br />
=== Why is \framed{} not centred? ===<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\framed{middle?}<br />
\stopalignment<br />
\startalignment[middle]<br />
middle!<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
Answer: \framed switches to vmode, so you need \dontleavehmode:<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\dontleavehmode<br />
\framed{middle!}<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
=== Why is there a line-break in the output after some commands? ===<br />
<texcode><br />
\starttext<br />
\externalfigure[hacker][width=1cm] Why a new line here?<br />
\stoptext<br />
</texcode><br />
<br />
Answer: See previous answer!<br />
<texcode><br />
\starttext<br />
\dontleavehmode<br />
\externalfigure[hacker][width=1cm] Same line!<br />
\stoptext<br />
</texcode><br />
<br />
=== Why the space is gobbled after some commands? ===<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm] X<br />
\stoptext<br />
</texcode><br />
<br />
Answer: When you don't use all of the optional square bracket arguments,<br />
the ConTeXt gobbles the space after the last square bracket. You have at<br />
least 2 solutions:<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm][] X % adding empty square brackets<br />
<br />
X \externalfigure[hacker][width=1cm]\ X % adding explicit space command<br />
\stoptext<br />
</texcode></div>Peterhttps://wiki.contextgarden.net/index.php?title=FAQ&diff=11806FAQ2010-06-27T06:24:29Z<p>Peter: new faq</p>
<hr />
<div>{{todo|This FAQ needs to have a lot of things worked on. To avoid clutter from repeated TODO tags, just note missing answers with "...", and put notes about missing information in parentheses.}}<br />
<br />
=== What is ConTeXt? ===<br />
:It is a document production system based on Donald Knuth's [[http://www.tug.org/ TeX]]. It is a set of high-level macros written in the (somewhat arcane) TeX language, and these macros simplify the task of designing layouts, making hyperlinks, etc.<br />
<br />
=== Is there a hello-world document? ===<br />
:Yes. See [[First Document]] and [[Hello world]].<br />
<br />
=== Is ConTeXt free (open source) software? ===<br />
:Yes. See the [[Read Me]] page for details.<br />
<br />
=== How do I install ConTeXt? ===<br />
<br />
:See [[Installation]]<br />
<br />
=== Does ConTeXt support Unicode? ===<br />
:Yes. It supports Unicode (utf-8) input, with the <cmd>enableregime</cmd><tt>[utf-8]</tt> command. See also [[Encodings and Regimes]] (This needs a bit of elaboration!) If you use [[XeTeX]], Unicode should work by default.<br />
<br />
=== Why does <code>\startalignment[right]</code> or <code>\framed[align=right]{some text}</code> align my text left instead of right and vice versa? ===<br />
:This is for backward compatibility with older versions; see [[Right and left]]. Hans was originally thinking of "ragged right" and "ragged left" alignment. Use '''flushleft''' and '''flushright''' instead.<br />
<br />
=== What are the differences between ConTeXt and LaTeX? ===<br />
<br />
:The main difference between the two, in my opinion, is a philosophical one: LaTeX was created with the idea of separating content and presentation to such an extent that the typical author would write their content and then use a style file created by someone else to provide the visual presentation. Thus, the proliferation of style files and related things.<br />
<br />
:ConTeXt, on the other hand, retained the idea of separating content and presentation, but was created with the idea of being used for books, where each book tends to have a different layout, and so the expected "end user" is the person doing all the layout. Thus, it's designed to provide a vast amount of flexibility for layout in a way that can be fairly easily defined without needing to write a package (or go find one that's already written).<br />
<br />
:To some extent, modern LaTeX has become a lot more like ConTeXt's intent, with a large quantity of packages, and classes like "memoir" that are designed to give the end user a large amount of control of the visual presentation. Thus, the difference is more one of focus and arrangement -- ConTeXt is all "of a piece" and most things are built in and designed as a complete set, whereas with LaTeX it's generally the case that when you want to do something different, you need to find the right package, and sometimes find that there are three that almost do what you want and none that are quite right (but, then, that also means that there are usually choices for how to do things, which can be good.)<br />
<br />
:Another difference is that IMO, ConTeXt is a lot easier to program in. It was designed a fair bit later than LaTeX, for much faster computers, and thus includes a lot of things that make it load and run slower but make programming a lot easier. <br />
<br />
:Author: Brooks Moses on c.t.t. usenet<br />
<br />
=== What are the advantages of ConTeXt over LaTeX? ===<br />
<br />
:ConTeXt is a macro package that’s far more advanced than LaTeX. You can enhance LaTeX with third party packages, but not all macro packages work together with each other. ConTeXt is an integrated, powerful and flexible macro package for which you seldom need third party packages. ConTeXt also has been used to create large and complex on-screen documents, including hyperlinks, on screen buttons, forms, cross-document links, and so on.<br />
<br />
:Source: ''LaTeX in proper ConTeXt'' (by Berend de Boer)<br />
<br />
=== How can I convert a document into RTF or HTML? ===<br />
<br />
:Hot topic on the mailing list!<br />
<br />
:There's currently no converter such as LaTeX2html available for ConTeXt. If you're ready to pay a price and put some more effort in your document, the best way is to use XML and produce PDF out of it with ConTeXt and HTML using XSLT.<br />
<br />
:[http://archive.contextgarden.net/thread/20050921.151245.b6a6f87e.en.html ConTeXt to RTF Conversion]<br />
<br />
=== What about the other way around? ===<br />
<br />
:[http://archive.contextgarden.net/thread/20050926.213139.45057948.en.html DOC/RTF to ConTeXt via XML]<br />
<br />
<br />
=== Can I change to Computer Modern's LaTeX font? ===<br />
<br />
I see diferences in screen between default fonts in ConTeXt (latin modern) and LaTeX (computer modern). Can I swicth to latex default font?. I think it's more stetical<br />
: No.<br />
: ''(I mean - of course you can; you only need to modify a few type-xxx.tex files and replace lm with cm in the source. But that solution is not/will not be supported officially.)''<br />
:: Is there any tutorial for doing it?<br />
::: ''No. There are no tutorials for the things that one is not supposed to mess with. Take a look at how things are done in those files and replace any occurrence of lm with cm.''<br />
<br />
=== Can I use some simpler bibliography method? ===<br />
<br />
I see that the method of [[http://wiki.contextgarden.net/Bibliography adding references in ConTexT]] is like bibtex in latex. Is there any simple methood like build-in latex method (\thebibliography)?<br />
: Perhaps [[http://wiki.contextgarden.net/Simple_Bibliography Simple bibliography (in simple bibliography)]]?<br />
<br />
=== XML: please tell me more about it ===<br />
<br />
=== How do I make a presentation? ===<br />
<br />
:You don't need any special package (like prosper or seminar in LaTeX) to make a presentation. In contrast to LaTeX, changing the document size, changing colors, adding hyperlinks, ... appears to be extremely simple in ConTeXt. See [[Presentations]] for more specific topics.<br />
<br />
=== <code>\setupindenting[medium]</code> doesn't work? ===<br />
<br />
:This does work, but the effect is not what you expect. Without <code>yes</code>, you have now set up the default size, but you have not turned paragraph indenting on. You have to execute <code>\setupindenting[yes]</code> before it starts actually indenting your paragraphs.<br />
<br />
=== Does $$...$$ work for display math, like in (La)TeX? ===<br />
:No; the spacing above and below the equation will be wrong, and maybe other aspects too. Instead use <cmd>startformula</cmd> and <cmd>stopformula</cmd>.<br />
<br />
=== How do I get a numbered equation? ===<br />
:Add <cmd>placeformula</cmd> before the <cmd>startformula</cmd>.<br />
<br />
=== How can I get a horizontal space with a defined width, so as ex. "\hspace{3em}" or "\hspace*{3em}" in LaTeX? ===<br />
:A horizontal space can be inserted with the TeX-Primitive<cmd>hspace〈dimension〉</cmd> or with the ConTeXt command <cmd>hspace[identifier]</cmd>.<br />
<br />
=== How can I get the lowercase (medieval, oldstyle figures) numbers in a document? ===<br />
The mediaeval numbers can be inserted locally by "\os". I would prefer a global setting of them but I don't know how to do it.<br />
<br />
=== How transcribe this LaTeX macro to ConTEXt? ===<br />
Could you please advice me, how transcribe this macro, controlling that no last line of a paragraph is shorter than the paragraph indenting?<br />
<br />
<texcode><br />
\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em<br />
</texcode><br />
<br />
=== Why is \framed{} not centred? ===<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\framed{middle?}<br />
\stopalignment<br />
\startalignment[middle]<br />
middle!<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
Answer: \framed switches to vmode, so you need \dontleavehmode:<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\dontleavehmode<br />
\framed{middle!}<br />
\stopalignment<br />
\stoptext<br />
</texcode></div>Peterhttps://wiki.contextgarden.net/index.php?title=Verbatim_text&diff=11569Verbatim text2010-04-17T11:24:28Z<p>Peter: /* Included Formatters */</p>
<hr />
<div>< [[Visuals]] | [[Verbatim with line breaks]] ><br />
<br />
=Displayed text=<br />
<cmd>starttyping</cmd>,<br />
<cmd>typebuffer</cmd><br />
<br />
Unlike LaTeX's <code>verbatim</code> environment, ConTeXt's <code>typing</code> environments have quite a range of built-in options for formatting the verbatim text, see below.<br />
<br />
=In-line text=<br />
<br />
<code>\startTEX ... \stopTEX</code> only works when typesetting the whole paragraph. If you need to type only a command or two as in-line text, you can use the following [[User:Taco|Taco's]] macro (hopefully this will land in the core once in the future):<br />
<br />
<texcode><br />
\def\typeTEX<br />
{\bgroup<br />
\def\processinlineverbatim##1%<br />
{\processingverbatimtrue<br />
\localcatcodestrue<br />
\def\endofverbatimcommand{\TEXendofcommand##1}%<br />
\bgroup<br />
\aftergroup\endofverbatimcommand<br />
\futurelet\next\doprocessinlineverbatim}%<br />
\initializetyping{TEX}%<br />
\startverbatimcolor<br />
\processinlineverbatim\egroup }<br />
</texcode><br />
<br />
Now you can say:<br />
<br />
<texcode><br />
\typeTEX+\typeTEX{\typeTEX is a wonderful macro}+, isn't it?<br />
</texcode><br />
<context><br />
\setupcolors[state=start]<br />
\def\typeTEX<br />
{\bgroup<br />
\def\processinlineverbatim##1%<br />
{\processingverbatimtrue<br />
\localcatcodestrue<br />
\def\endofverbatimcommand{\TEXendofcommand##1}%<br />
\bgroup<br />
\aftergroup\endofverbatimcommand<br />
\futurelet\next\doprocessinlineverbatim}%<br />
\initializetyping{TEX}%<br />
\startverbatimcolor<br />
\processinlineverbatim\egroup }<br />
<br />
\typeTEX+\typeTEX{\typeTEX is a wonderful macro}+, isn't it?<br />
</context><br />
<br />
Source: [http://archive.contextgarden.net/thread/20050907.093522.baf795f5.en.html]<br />
<br />
= Making a tight vertical fit =<br />
By default, typing environments include some blank space before the first line and after the last line of the verbatim text. This is because the <tt>before</tt> and <tt>after</tt> commands are set to <tt>\blank</tt> by default. For example:<br />
<br />
<context source="yes"><br />
\framed[offset=0mm,strut=no,align=right]{<br />
\starttyping<br />
Foo<br />
\stoptyping<br />
}<br />
</context><br />
<br />
Here, we've added a <tt>\framed</tt> so you can see the extra spacing, but with <tt>offset=0mm</tt> and <tt>strut=no</tt> to prevent framed from introducing spacing, and <tt>align=right</tt> to prevent framed from eating all newlines (not sure why that works like this).<br />
<br />
To prevent this extra vertical space, we must unset the <tt>before</tt> and <tt>after</tt> options:<br />
<context source="yes"><br />
\setuptyping[before=,after=]<br />
\framed[offset=0mm,strut=no,align=right]{<br />
\starttyping<br />
Foo<br />
\stoptyping<br />
}<br />
</context><br />
<br />
= Embedded formatting commands =<br />
<br />
The <tt>option=commands</tt> setting allows the usage of ConTeXt commands inside verbatim text, as in this example:<br />
<texcode><br />
\definetyping[C][option=commands]<br />
\startC<br />
#include &lt;stdio.h&gt;<br />
int main(){<br />
return 0;<br />
/BTEX{\em unreachedCode;}/ETEX<br />
}<br />
\stopC<br />
</texcode><br />
<br />
<context><br />
\definetyping[C][option=commands]<br />
\startC<br />
#include <stdio.h><br />
int main(){<br />
return 0;<br />
/BTEX{\em unreachedCode;}/ETEX<br />
}<br />
\stopC<br />
</context><br />
<br />
In mkiv option-commands is gone and escape no longer is an escape character but a condition (range or start), as in this example:<br />
<br />
<texcode><br />
\setuptyping[TEX][escape=yes]<br />
<br />
\startTEX<br />
/BTEX\em sometex/ETEX<br />
/BTEX\em sometex/ETEX \after<br />
\before /BTEX\em sometex/ETEX<br />
\before /BTEX\em sometex/ETEX \after<br />
\before /BTEX\em sometex/ETEX \inbetween /BTEX\em sometex/ETEX \after<br />
\before \after<br />
\stopTEX<br />
<br />
\setuptyping[TEX][escape={[[,]]}]<br />
<br />
\startTEX<br />
[[\em sometex]]<br />
[[\em sometex]] \after<br />
\before [[\em sometex]]<br />
\before [[\em sometex]] \after<br />
\before [[\em sometex]] \inbetween [[\em sometex]] \after<br />
\before \after<br />
\stopTEX<br />
<br />
\setuptyping[TEX][escape=//]<br />
<br />
\startTEX<br />
//\em sometex<br />
\before //\em sometex<br />
\stopTEX<br />
</texcode><br />
<br />
[[Image:Verbatim-mkiv.png]]<br />
<br />
= Pretty printing =<br />
The context distribution includes a number of formatters (or pretty<br />
printers), that can apply some nice formatting to your verbatim text.<br />
Each formatter knows how to handle a specific file format or programming<br />
language and applies syntax highlighting or other fancy displaying.<br />
<br />
ConTeXt includes a number of predefined formatters, but it is also<br />
possible to define your own. Pretty printing has been completely<br />
redesigned in MkIV, so there are a few differences between MkII and<br />
MkIV. In particular, MkII commonly refers to "formatters", while MkIV<br />
often uses "pretty printers".<br />
<br />
== Included Formatters ==<br />
There are already some formatters for several programming languages in<br />
the ConTeXt distributionr. The following list is for MkII and MkIV.<br />
<br />
{|<br />
! Language !! Code for MkII !! Code for MkIV<br />
|-<br />
| C || [[source:verb-c.mkii|C]] || [[modules:pret-c|C]]<br />
|-<br />
| Eiffel || [[source:verb-eif.mkii|EIF]] ||<br />
|-<br />
| JavaScript || [[source:verb-js.mkii|JS]] ||<br />
|-<br />
| Java || [[source:verb-jv.mkii|JV]] ||<br />
|-<br />
| Lua || || [[source:pret-lua.lua|LUA]]<br />
|-<br />
| MetaPost & MetaFont || [[source:verb-mp.mkii|MP]] || [[source:pret-mp.lua|MP]]<br />
|-<br />
| Pascal & Modula || [[source:verb-pas.mkii|PAS]] ||<br />
|-<br />
| Perl 5 || [[source:verb-pl.mkii|PL]] ||<br />
|-<br />
| SQL || [[source:verb-sql.mkii|SQL]] ||<br />
|-<br />
| TeX || [[source:verb-tex.mkii|TEX]] || [[source:pret-tex.lua|TEX]]<br />
|-<br />
| XML || [[source:verb-xml.mkii|XML]] || [[source:pret-xml.lua|XML]]<br />
|-<br />
|}<br />
<br />
== Your own formatter ==<br />
<br />
You should start from the definition that is closest to the language you want to define (especially wrt comment and string syntax) and can probably have a go at making a version of this. Some <br />
questions occur:<br />
<br />
=== How should I name my file? ===<br />
; MkII: <tt>verb-xxxx.tex</tt>, where <tt>xxxx</tt> is the lowercase name of the formatter.<br />
; MkIV: <tt>pret-xxxx.lua</tt>, where <tt>xxxx</tt> is the lowercase name of the pretty printer.<br />
<br />
=== Where should i put my file? ===<br />
<br />
# Possibly the best place is: In the context distribution, but that depends a bit on what language it is, precisely (you can email me the completed file, in that case).<br />
# Second best place: http://modules.contextgarden.net, so it can be included in cont-ext.zip (third-party addons that are distributed by Pragma-Ade alongside the normal distribution).<br />
# Third best: The directory <$HOME/texmf/tex/context/base> (the place where your TeX installation finds local files).<br />
# Final option: Same directory as the file to be processed<br />
<br />
=== Do I have to do anything else to get ConTeXt to recognise and use it? ===<br />
<br />
You refer to a pretty printer using its name (''e.g.'', the<br />
<tt>xxxx</tt> in <tt>verb-xxxx.tex</tt> or <tt>pret-xxxx.lua</tt>),<br />
which should be in lowercase. Before you can use a pretty printer, you<br />
should let ConTeXt know about it (this has already been done for the<br />
included formatters).<br />
<br />
<texcode><br />
\installprettytype [PHP] [PHP]<br />
</texcode><br />
<br />
This maps the command <code>\starttyping[option=PHP]</code> to the<br />
<tt>php</tt> pretty printer.<br />
<br />
The first argument is the option as passed to \starttyping, the second<br />
argument is an uppercase version of the pretty printer name<br />
(''e.g.'' <tt>xxxx</tt>) (thus allowing ConTeXt to find the file).<br />
<br />
And you probably also want:<br />
<texcode><br />
\definetyping[PHP] [option=PHP]<br />
</texcode><br />
Because that allows <code>\startPHP ... \stopPHP</code> as a shortcut<br />
to <tt>\starttyping[option=PHP] ... \stoptyping</tt>.<br />
<br />
=== How to write the pretty printer? ===<br />
For MkII, there seems to be no real documentation here. You should take<br />
a good look at the existing formatters and base your work off those.<br />
However, if you really need custom pretty printing, you might be better<br />
of to look at MkIV instead, since that allows you to write a pretty<br />
printer in lua, which is a lot less painful than writing them in plain<br />
TeX.<br />
<br />
For MkIV, you should simply write a lua script that processes each line<br />
of input and produces tex output. The details about this are discussed<br />
at [[Custom_pretty_printer]].<br />
<br />
= Tabbing =<br />
<br />
The tab character normally corresponds to one character, as can be seen above. That value can be adjusted, using the following code (available in the 2005.06.01 version and later):<br />
<texcode><br />
\definetyping[C][tab=3]<br />
% for older ConTeXt versions: \chardef\spacespertab=3<br />
\startC<br />
int func(int a){<br />
if(a > 4)<br />
return 0;<br />
else<br />
return 10;<br />
}<br />
\stopC<br />
</texcode><br />
<br />
<context><br />
\definetyping[C][tab=3]<br />
\startC<br />
int func(int a){<br />
if(a > 4)<br />
return 0;<br />
else<br />
return 10;<br />
}<br />
\stopC<br />
</context><br />
<br />
= Syntax highlighting in color =<br />
<br />
<texcode><br />
\setupcolors[state=start]<br />
\setuptyping[option=color]<br />
<br />
\starttext<br />
\startXML<br />
... your XML code ...<br />
\stopXML<br />
\stoptext<br />
</texcode><br />
<br />
:<context><br />
\setupbodyfont[8pt]<br />
\setupcolors[state=start]<br />
\setuptyping[option=color]<br />
<br />
\starttext<br />
\startXML<br />
<?xml version="1.0" encoding="utf-8"?><br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br />
<html><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br />
<title>XML Code Highlighting in ConTeXt</title><br />
<br />
<style type="text/css"><br />
h1 {<br />
text-align: center;<br />
color: blue;<br />
font-family: verdana,sans-serif;<br />
}<br />
</style><br />
</head><br />
<br />
<body><br />
<h1>XML Code Highlighting in ConTeXt</h1><br />
<br />
<!-- To be written ... --><br />
</body><br />
</html><br />
\stopXML<br />
\stoptext<br />
</context><br />
<br />
== Defining your own set of colors ==<br />
<br />
Sometimes you may be not quite satisfied with the default colors used in the built-in syntax highlighting. [[User:Taco|Taco]] posted this solution in the discussion on the [http://archive.contextgarden.net/message/20050825.112308.db696b94.en.html mailing list]:<br />
<br />
<texcode><br />
\setupcolors[state=start]<br />
\setuptyping[option=color]<br />
<br />
% define the colors to fit your document style<br />
\definecolor[MYcolorone] [r=.8,g=.5,b=.5]<br />
\definecolor[MYcolortwo] [r=.8,g=.5,b=.2]<br />
\definecolor[MYcolorthree][r=.8,g=.5,b=.8]<br />
\definecolor[MYcolorfour] [r=.8,g=.2,b=.5]<br />
<br />
% define a palete using these four colors<br />
\definepalet[MYcolors]<br />
[prettyone=MYcolorone,<br />
prettytwo=MYcolortwo,<br />
prettythree=MYcolorthree,<br />
prettyfour=MYcolorfour]<br />
<br />
% XML code will be typeset with the palette you just defined<br />
\definepalet[XMLcolorpretty] [MYcolors] % the name is magic !<br />
<br />
\starttext<br />
\startXML<br />
... your XML code ...<br />
\stopXML<br />
\stoptext<br />
</texcode><br />
<br />
This results in:<br />
<br />
:<context><br />
\setupbodyfont[8pt]<br />
\definecolor[MYcolorone] [r=.8,g=.5,b=.5]<br />
\definecolor[MYcolortwo] [r=.8,g=.5,b=.2]<br />
\definecolor[MYcolorthree][r=.8,g=.5,b=.8]<br />
\definecolor[MYcolorfour] [r=.8,g=.2,b=.5]<br />
<br />
\definepalet[MYcolors]<br />
[prettyone=MYcolorone,<br />
prettytwo=MYcolortwo,<br />
prettythree=MYcolorthree,<br />
prettyfour=MYcolorfour]<br />
<br />
\definepalet[XMLcolorpretty] [MYcolors] % the name is magic !<br />
<br />
\setupcolors[state=start]<br />
\setuptyping[option=color]<br />
<br />
\starttext<br />
\startXML<br />
<?xml version="1.0" encoding="utf-8"?><br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br />
<html><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br />
<title>XML Code Highlighting in ConTeXt</title><br />
<br />
<style type="text/css"><br />
h1 {<br />
text-align: center;<br />
color: blue;<br />
font-family: verdana,sans-serif;<br />
}<br />
</style><br />
</head><br />
<br />
<body><br />
<h1>XML Code Highlighting in ConTeXt</h1><br />
<br />
<!-- To be written ... --><br />
</body><br />
</html><br />
\stopXML<br />
\stoptext<br />
</context><br />
<br />
= Colored background =<br />
<br />
<texcode><br />
\setupcolors[state=start]<br />
<br />
\definetextbackground[verbatim]<br />
[background=color,<br />
backgroundcolor=yellow,<br />
backgroundoffset=0cm,<br />
offset=0.5cm,<br />
frame=on,<br />
framecolor=black,<br />
location=paragraph,<br />
color=black]<br />
<br />
% Setup verbatim<br />
\setuptyping[typing][margin=1cm,bodyfont=8.0pt,<br />
before={\starttextbackground[verbatim]},<br />
after={\stoptextbackground}]<br />
<br />
\starttext<br />
\starttyping<br />
This is the first line.<br />
This is the second line.<br />
\stoptyping<br />
\stoptext<br />
</texcode><br />
<br />
= Line numbering =<br />
<br />
In technical documents it can be required to display some code listings with the line numbers. You can do this with ConTeXt, and even more. All the features shown here are also available when displaying external files with <cmd>typefile</cmd>.<br />
<br />
== Preliminary setting ==<br />
Let's define our own typing style, named "code". The typing is put in a framedtext, to demonstrate the wrapping feature in a next section.<br />
<br />
<texcode><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
</texcode><br />
<br />
== Default line numbering ==<br />
With the defined typing, every line is numbered, and the number goes in the margin. The option to have the line numbers displayed is <tt>numbering=line</tt>.<br />
<br />
<texcode><br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
</texcode><br />
<br />
It is rendered as:<br />
<br />
<context><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
<br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
</context><br />
<br />
== Line numbers in the text ==<br />
To have the line numbers in the text, change the linenumbering setup like this:<br />
<br />
<texcode><br />
\setuplinenumbering[location=intext]<br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
</texcode><br />
<br />
<context><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
<br />
\setuplinenumbering[location=intext]<br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
</context><br />
<br />
== Continuing the numbering ==<br />
Another handy feature is the ability to continue the numbering from one portion of code to another. Use the option <tt>continue</tt> for this.<br />
<br />
<texcode><br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
<br />
Some normal text to explain the first piece of code,<br />
and introduce the following lines.<br />
<br />
\startcode[continue]<br />
This is the first continuing line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</texcode><br />
<br />
<context><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
<br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
<br />
Some normal text to explain the first piece of code, and introduce the following lines.<br />
<br />
\startcode[continue]<br />
This is the first continuing line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</context><br />
<br />
== Arbitrary starting line number ==<br />
You can also decide what the starting line number is. Use the option <tt>start=number</tt> for this.<br />
<br />
<texcode><br />
\startcode[start=200]<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</texcode><br />
<br />
<context><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
<br />
\startcode[start=200]<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</context><br />
<br />
== Line number steps ==<br />
You want to print a number every two lines? Ok, just use the option <tt>step=number</tt> for this.<br />
<br />
<texcode><br />
\startcode[start=200,step=2]<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</texcode><br />
<br />
<context><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
<br />
\startcode[start=200,step=2]<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</context><br />
<br />
<br />
= A different approach to formatting and code colorization =<br />
<br />
Supposing that: <br />
<br />
a) you are much more fluent in another programming language than TeX <br />
<br />
b) you have a large project involving many code snippets to be inserted and colorized<br />
<br />
you can go for another, less elegant, way to format your verbatim text, which can include all the discussed ConTeXt benefits. <br />
<br />
== Writing a parser/formatter ==<br />
<br />
It is fairly simple to write a little parser which takes as its input your source file and gives in output a .tex file containing the code plus the opportune commands for colorization. You can then include the resulting .tex file in the global ConTeXt document file.<br />
As an example, [http://www.fonurgia.unito.it/andrea/sw/sc/scToConTeXt.py this] is a Python script for the SuperCollider language, which has a strict Smalltalk-like syntax.<br />
<br />
Fed with the following source code contained in e.g. example.sc file:<br />
<br />
<br />
<context><br />
\tfx<br />
\starttyping<br />
// an example starting with a comment<br />
"this is a string".postln ;<br />
<br />
\aSymbol ;<br />
<br />
ThisClassDoesNotExist ;<br />
\stoptyping<br />
</context><br />
<br />
<br />
the script outputs this tex code, which is written into a file contained in the same folder of the source file (named example.tex):<br />
<br />
<texcode><br />
\startSC<br />
/BTEX{\color[SCred] //// an example starting with a comment}/ETEX<br />
/BTEX{\color[SCgrey] "this is a string"}/ETEX .postln ;<br />
<br />
/BTEX{\color[SCgreen] \letterbackslash aSymbol}/ETEX ;<br />
<br />
/BTEX{\color[SCblue] ThisClassDoesNotExists}/ETEX ;<br />
\stopSC<br />
</texcode><br />
<br />
Basically, the idea is to envelope each item to be colorized inside a /BTEX /ETEX block. <br />
Note that inside the block the text is no more verbatim, so you have to define some string replacements for special characters (e.g. _, %, $, \, etc). <br />
As an example, the problem of the backslash (\) is solved here by replacing it with \letterbackslash. <br />
<br />
You can then insert example.tex in your ConTeXt file with<br />
<br />
<texcode><br />
\input example<br />
</texcode><br />
<br />
<br />
The example.tex file uses some definitions (explained in the previous sections) which have to be put in the ConTeXt file. <br />
<br />
<texcode><br />
\defineframedtext<br />
[framedSC]<br />
[framecolor=cirmaBlue,<br />
strut=yes,<br />
offset=2mm,<br />
width=local,<br />
align=right]<br />
<br />
\definetyping[SC][option=commands, <br />
tab=2,numbering=line,<br />
before={\startframedSC},<br />
after={\stopframedSC}]<br />
</texcode><br />
<br />
Also, example.tex requires color definitions, which are created following SuperCollider colorization interpreter scheme and have to be inserted in the ConTeXt file too:<br />
<br />
<texcode><br />
%% SC colors %%<br />
\definecolor [SCwhite] [r=1.0, g=1.0, b=1.0] <br />
\definecolor [SCblack] [r=0.0, g=0.0, b=0.0] <br />
\definecolor [SCblue] [r=0.0, g=0.0, b=0.75] <br />
\definecolor [SCred] [r=0.75, g=0.0, b=0.0] <br />
\definecolor [SCgrey] [r=0.376, g=0.376, b=0.376] <br />
\definecolor [SCgreen] [r=0.0, g=0.45, b=0.0]<br />
<br />
\definecolor[cirmaBlue] [r=.0,g=.2,b=.6] % for frame<br />
</texcode><br />
<br />
The previous definitions will be used for all the code files inserted with \input.<br />
After compiling, this is the result of the discussed example:<br />
<br />
<br />
<context><br />
\setupcolors[state=start]<br />
\starttext<br />
%% SC colors %%<br />
\definecolor [SCwhite] [r=1.0, g=1.0, b=1.0] <br />
\definecolor [SCblack] [r=0.0, g=0.0, b=0.0] <br />
\definecolor [SCblue] [r=0.0, g=0.0, b=0.75] <br />
\definecolor [SCred] [r=0.75, g=0.0, b=0.0] <br />
<br />
\definecolor [SCgrey] [r=0.376, g=0.376, b=0.376] <br />
\definecolor [SCgreen] [r=0.0, g=0.45, b=0.0] <br />
\definecolor[cirmaBlue] [r=.0,g=.2,b=.6] <br />
<br />
\defineframedtext<br />
[framedSC]<br />
[framecolor=cirmaBlue,<br />
strut=yes,<br />
offset=2mm,<br />
width=local,<br />
align=right]<br />
<br />
\definetyping[SC][option=commands, <br />
tab=2,numbering=line,<br />
before={\startframedSC},<br />
after={\stopframedSC}]<br />
<br />
\startSC<br />
/BTEX{\color[SCred] //// an example starting with a comment}/ETEX<br />
/BTEX{\color[SCgrey] "this is a string"}/ETEX .postln ;<br />
<br />
/BTEX{\color[SCgreen] \letterbackslash aSymbol}/ETEX ;<br />
<br />
/BTEX{\color[SCblue] ThisClassDoesNotExists}/ETEX ;<br />
\stopSC<br />
<br />
\stoptext<br />
</context><br />
<br />
== Embedding the source code ==<br />
<br />
If your document is inteded to provide code examples to be tested by the readers, the presence of format signs (e.g. line numbers) can create some troubles while copying and pasting the code text from your document to the language environment. More generally, the copy and paste approach, being slow and possibly related to encodings, is not satisfying at all.<br />
You can include source files in the pdf with a couple of ConTeXt commands:<br />
<br />
<texcode><br />
\useattachment[ex][example.sc]<br />
\attachment[ex]<br />
</texcode><br />
<br />
<br />
So that you can have this structure for each code snippet:<br />
<br />
<texcode><br />
\input example<br />
<br />
\useattachment[ex][example.sc]<br />
\attachment[ex]<br />
</texcode><br />
<br />
<br />
The commands embed example.sc in the pdf, so that it is accessible by double-clicking on a generated icon. In this case the icon is placed after the colorized code frame.<br />
If you use Acrobat Reader (Preview.app in MacOSX does not provide support for the behaviour) example.sc will be open in the related application (e.g. SuperCollider.app in the discussed case).<br />
<br />
<br />
The discussed approach has been implemented [http://www.cirma.unito.it/andrea/sw/sc/prd_tSCIRMA.pdf here].<br />
<br />
(-a- --> [[User:Andrea]])</div>Peterhttps://wiki.contextgarden.net/index.php?title=Verbatim_text&diff=11568Verbatim text2010-04-17T11:23:34Z<p>Peter: /* Included Formatters */</p>
<hr />
<div>< [[Visuals]] | [[Verbatim with line breaks]] ><br />
<br />
=Displayed text=<br />
<cmd>starttyping</cmd>,<br />
<cmd>typebuffer</cmd><br />
<br />
Unlike LaTeX's <code>verbatim</code> environment, ConTeXt's <code>typing</code> environments have quite a range of built-in options for formatting the verbatim text, see below.<br />
<br />
=In-line text=<br />
<br />
<code>\startTEX ... \stopTEX</code> only works when typesetting the whole paragraph. If you need to type only a command or two as in-line text, you can use the following [[User:Taco|Taco's]] macro (hopefully this will land in the core once in the future):<br />
<br />
<texcode><br />
\def\typeTEX<br />
{\bgroup<br />
\def\processinlineverbatim##1%<br />
{\processingverbatimtrue<br />
\localcatcodestrue<br />
\def\endofverbatimcommand{\TEXendofcommand##1}%<br />
\bgroup<br />
\aftergroup\endofverbatimcommand<br />
\futurelet\next\doprocessinlineverbatim}%<br />
\initializetyping{TEX}%<br />
\startverbatimcolor<br />
\processinlineverbatim\egroup }<br />
</texcode><br />
<br />
Now you can say:<br />
<br />
<texcode><br />
\typeTEX+\typeTEX{\typeTEX is a wonderful macro}+, isn't it?<br />
</texcode><br />
<context><br />
\setupcolors[state=start]<br />
\def\typeTEX<br />
{\bgroup<br />
\def\processinlineverbatim##1%<br />
{\processingverbatimtrue<br />
\localcatcodestrue<br />
\def\endofverbatimcommand{\TEXendofcommand##1}%<br />
\bgroup<br />
\aftergroup\endofverbatimcommand<br />
\futurelet\next\doprocessinlineverbatim}%<br />
\initializetyping{TEX}%<br />
\startverbatimcolor<br />
\processinlineverbatim\egroup }<br />
<br />
\typeTEX+\typeTEX{\typeTEX is a wonderful macro}+, isn't it?<br />
</context><br />
<br />
Source: [http://archive.contextgarden.net/thread/20050907.093522.baf795f5.en.html]<br />
<br />
= Making a tight vertical fit =<br />
By default, typing environments include some blank space before the first line and after the last line of the verbatim text. This is because the <tt>before</tt> and <tt>after</tt> commands are set to <tt>\blank</tt> by default. For example:<br />
<br />
<context source="yes"><br />
\framed[offset=0mm,strut=no,align=right]{<br />
\starttyping<br />
Foo<br />
\stoptyping<br />
}<br />
</context><br />
<br />
Here, we've added a <tt>\framed</tt> so you can see the extra spacing, but with <tt>offset=0mm</tt> and <tt>strut=no</tt> to prevent framed from introducing spacing, and <tt>align=right</tt> to prevent framed from eating all newlines (not sure why that works like this).<br />
<br />
To prevent this extra vertical space, we must unset the <tt>before</tt> and <tt>after</tt> options:<br />
<context source="yes"><br />
\setuptyping[before=,after=]<br />
\framed[offset=0mm,strut=no,align=right]{<br />
\starttyping<br />
Foo<br />
\stoptyping<br />
}<br />
</context><br />
<br />
= Embedded formatting commands =<br />
<br />
The <tt>option=commands</tt> setting allows the usage of ConTeXt commands inside verbatim text, as in this example:<br />
<texcode><br />
\definetyping[C][option=commands]<br />
\startC<br />
#include &lt;stdio.h&gt;<br />
int main(){<br />
return 0;<br />
/BTEX{\em unreachedCode;}/ETEX<br />
}<br />
\stopC<br />
</texcode><br />
<br />
<context><br />
\definetyping[C][option=commands]<br />
\startC<br />
#include <stdio.h><br />
int main(){<br />
return 0;<br />
/BTEX{\em unreachedCode;}/ETEX<br />
}<br />
\stopC<br />
</context><br />
<br />
In mkiv option-commands is gone and escape no longer is an escape character but a condition (range or start), as in this example:<br />
<br />
<texcode><br />
\setuptyping[TEX][escape=yes]<br />
<br />
\startTEX<br />
/BTEX\em sometex/ETEX<br />
/BTEX\em sometex/ETEX \after<br />
\before /BTEX\em sometex/ETEX<br />
\before /BTEX\em sometex/ETEX \after<br />
\before /BTEX\em sometex/ETEX \inbetween /BTEX\em sometex/ETEX \after<br />
\before \after<br />
\stopTEX<br />
<br />
\setuptyping[TEX][escape={[[,]]}]<br />
<br />
\startTEX<br />
[[\em sometex]]<br />
[[\em sometex]] \after<br />
\before [[\em sometex]]<br />
\before [[\em sometex]] \after<br />
\before [[\em sometex]] \inbetween [[\em sometex]] \after<br />
\before \after<br />
\stopTEX<br />
<br />
\setuptyping[TEX][escape=//]<br />
<br />
\startTEX<br />
//\em sometex<br />
\before //\em sometex<br />
\stopTEX<br />
</texcode><br />
<br />
[[Image:Verbatim-mkiv.png]]<br />
<br />
= Pretty printing =<br />
The context distribution includes a number of formatters (or pretty<br />
printers), that can apply some nice formatting to your verbatim text.<br />
Each formatter knows how to handle a specific file format or programming<br />
language and applies syntax highlighting or other fancy displaying.<br />
<br />
ConTeXt includes a number of predefined formatters, but it is also<br />
possible to define your own. Pretty printing has been completely<br />
redesigned in MkIV, so there are a few differences between MkII and<br />
MkIV. In particular, MkII commonly refers to "formatters", while MkIV<br />
often uses "pretty printers".<br />
<br />
== Included Formatters ==<br />
There are already some formatters for several programming languages in<br />
the ConTeXt distributionr. The following list is for MkII and MkIV.<br />
<br />
{|<br />
! Language !! Code for MkII !! Code for MkII<br />
|-<br />
| C || [[source:verb-c.mkii|C]] || [[modules:pret-c|C]]<br />
|-<br />
| Eiffel || [[source:verb-eif.mkii|EIF]] ||<br />
|-<br />
| JavaScript || [[source:verb-js.mkii|JS]] ||<br />
|-<br />
| Java || [[source:verb-jv.mkii|JV]] ||<br />
|-<br />
| Lua || || [[source:pret-lua.lua|LUA]]<br />
|-<br />
| MetaPost & MetaFont || [[source:verb-mp.mkii|MP]] || [[source:pret-mp.lua|MP]]<br />
|-<br />
| Pascal & Modula || [[source:verb-pas.mkii|PAS]] ||<br />
|-<br />
| Perl 5 || [[source:verb-pl.mkii|PL]] ||<br />
|-<br />
| SQL || [[source:verb-sql.mkii|SQL]] ||<br />
|-<br />
| TeX || [[source:verb-tex.mkii|TEX]] || [[source:pret-tex.lua|TEX]]<br />
|-<br />
| XML || [[source:verb-xml.mkii|XML]] || [[source:pret-xml.lua|XML]]<br />
|-<br />
|}<br />
<br />
== Your own formatter ==<br />
<br />
You should start from the definition that is closest to the language you want to define (especially wrt comment and string syntax) and can probably have a go at making a version of this. Some <br />
questions occur:<br />
<br />
=== How should I name my file? ===<br />
; MkII: <tt>verb-xxxx.tex</tt>, where <tt>xxxx</tt> is the lowercase name of the formatter.<br />
; MkIV: <tt>pret-xxxx.lua</tt>, where <tt>xxxx</tt> is the lowercase name of the pretty printer.<br />
<br />
=== Where should i put my file? ===<br />
<br />
# Possibly the best place is: In the context distribution, but that depends a bit on what language it is, precisely (you can email me the completed file, in that case).<br />
# Second best place: http://modules.contextgarden.net, so it can be included in cont-ext.zip (third-party addons that are distributed by Pragma-Ade alongside the normal distribution).<br />
# Third best: The directory <$HOME/texmf/tex/context/base> (the place where your TeX installation finds local files).<br />
# Final option: Same directory as the file to be processed<br />
<br />
=== Do I have to do anything else to get ConTeXt to recognise and use it? ===<br />
<br />
You refer to a pretty printer using its name (''e.g.'', the<br />
<tt>xxxx</tt> in <tt>verb-xxxx.tex</tt> or <tt>pret-xxxx.lua</tt>),<br />
which should be in lowercase. Before you can use a pretty printer, you<br />
should let ConTeXt know about it (this has already been done for the<br />
included formatters).<br />
<br />
<texcode><br />
\installprettytype [PHP] [PHP]<br />
</texcode><br />
<br />
This maps the command <code>\starttyping[option=PHP]</code> to the<br />
<tt>php</tt> pretty printer.<br />
<br />
The first argument is the option as passed to \starttyping, the second<br />
argument is an uppercase version of the pretty printer name<br />
(''e.g.'' <tt>xxxx</tt>) (thus allowing ConTeXt to find the file).<br />
<br />
And you probably also want:<br />
<texcode><br />
\definetyping[PHP] [option=PHP]<br />
</texcode><br />
Because that allows <code>\startPHP ... \stopPHP</code> as a shortcut<br />
to <tt>\starttyping[option=PHP] ... \stoptyping</tt>.<br />
<br />
=== How to write the pretty printer? ===<br />
For MkII, there seems to be no real documentation here. You should take<br />
a good look at the existing formatters and base your work off those.<br />
However, if you really need custom pretty printing, you might be better<br />
of to look at MkIV instead, since that allows you to write a pretty<br />
printer in lua, which is a lot less painful than writing them in plain<br />
TeX.<br />
<br />
For MkIV, you should simply write a lua script that processes each line<br />
of input and produces tex output. The details about this are discussed<br />
at [[Custom_pretty_printer]].<br />
<br />
= Tabbing =<br />
<br />
The tab character normally corresponds to one character, as can be seen above. That value can be adjusted, using the following code (available in the 2005.06.01 version and later):<br />
<texcode><br />
\definetyping[C][tab=3]<br />
% for older ConTeXt versions: \chardef\spacespertab=3<br />
\startC<br />
int func(int a){<br />
if(a > 4)<br />
return 0;<br />
else<br />
return 10;<br />
}<br />
\stopC<br />
</texcode><br />
<br />
<context><br />
\definetyping[C][tab=3]<br />
\startC<br />
int func(int a){<br />
if(a > 4)<br />
return 0;<br />
else<br />
return 10;<br />
}<br />
\stopC<br />
</context><br />
<br />
= Syntax highlighting in color =<br />
<br />
<texcode><br />
\setupcolors[state=start]<br />
\setuptyping[option=color]<br />
<br />
\starttext<br />
\startXML<br />
... your XML code ...<br />
\stopXML<br />
\stoptext<br />
</texcode><br />
<br />
:<context><br />
\setupbodyfont[8pt]<br />
\setupcolors[state=start]<br />
\setuptyping[option=color]<br />
<br />
\starttext<br />
\startXML<br />
<?xml version="1.0" encoding="utf-8"?><br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br />
<html><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br />
<title>XML Code Highlighting in ConTeXt</title><br />
<br />
<style type="text/css"><br />
h1 {<br />
text-align: center;<br />
color: blue;<br />
font-family: verdana,sans-serif;<br />
}<br />
</style><br />
</head><br />
<br />
<body><br />
<h1>XML Code Highlighting in ConTeXt</h1><br />
<br />
<!-- To be written ... --><br />
</body><br />
</html><br />
\stopXML<br />
\stoptext<br />
</context><br />
<br />
== Defining your own set of colors ==<br />
<br />
Sometimes you may be not quite satisfied with the default colors used in the built-in syntax highlighting. [[User:Taco|Taco]] posted this solution in the discussion on the [http://archive.contextgarden.net/message/20050825.112308.db696b94.en.html mailing list]:<br />
<br />
<texcode><br />
\setupcolors[state=start]<br />
\setuptyping[option=color]<br />
<br />
% define the colors to fit your document style<br />
\definecolor[MYcolorone] [r=.8,g=.5,b=.5]<br />
\definecolor[MYcolortwo] [r=.8,g=.5,b=.2]<br />
\definecolor[MYcolorthree][r=.8,g=.5,b=.8]<br />
\definecolor[MYcolorfour] [r=.8,g=.2,b=.5]<br />
<br />
% define a palete using these four colors<br />
\definepalet[MYcolors]<br />
[prettyone=MYcolorone,<br />
prettytwo=MYcolortwo,<br />
prettythree=MYcolorthree,<br />
prettyfour=MYcolorfour]<br />
<br />
% XML code will be typeset with the palette you just defined<br />
\definepalet[XMLcolorpretty] [MYcolors] % the name is magic !<br />
<br />
\starttext<br />
\startXML<br />
... your XML code ...<br />
\stopXML<br />
\stoptext<br />
</texcode><br />
<br />
This results in:<br />
<br />
:<context><br />
\setupbodyfont[8pt]<br />
\definecolor[MYcolorone] [r=.8,g=.5,b=.5]<br />
\definecolor[MYcolortwo] [r=.8,g=.5,b=.2]<br />
\definecolor[MYcolorthree][r=.8,g=.5,b=.8]<br />
\definecolor[MYcolorfour] [r=.8,g=.2,b=.5]<br />
<br />
\definepalet[MYcolors]<br />
[prettyone=MYcolorone,<br />
prettytwo=MYcolortwo,<br />
prettythree=MYcolorthree,<br />
prettyfour=MYcolorfour]<br />
<br />
\definepalet[XMLcolorpretty] [MYcolors] % the name is magic !<br />
<br />
\setupcolors[state=start]<br />
\setuptyping[option=color]<br />
<br />
\starttext<br />
\startXML<br />
<?xml version="1.0" encoding="utf-8"?><br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br />
<html><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br />
<title>XML Code Highlighting in ConTeXt</title><br />
<br />
<style type="text/css"><br />
h1 {<br />
text-align: center;<br />
color: blue;<br />
font-family: verdana,sans-serif;<br />
}<br />
</style><br />
</head><br />
<br />
<body><br />
<h1>XML Code Highlighting in ConTeXt</h1><br />
<br />
<!-- To be written ... --><br />
</body><br />
</html><br />
\stopXML<br />
\stoptext<br />
</context><br />
<br />
= Colored background =<br />
<br />
<texcode><br />
\setupcolors[state=start]<br />
<br />
\definetextbackground[verbatim]<br />
[background=color,<br />
backgroundcolor=yellow,<br />
backgroundoffset=0cm,<br />
offset=0.5cm,<br />
frame=on,<br />
framecolor=black,<br />
location=paragraph,<br />
color=black]<br />
<br />
% Setup verbatim<br />
\setuptyping[typing][margin=1cm,bodyfont=8.0pt,<br />
before={\starttextbackground[verbatim]},<br />
after={\stoptextbackground}]<br />
<br />
\starttext<br />
\starttyping<br />
This is the first line.<br />
This is the second line.<br />
\stoptyping<br />
\stoptext<br />
</texcode><br />
<br />
= Line numbering =<br />
<br />
In technical documents it can be required to display some code listings with the line numbers. You can do this with ConTeXt, and even more. All the features shown here are also available when displaying external files with <cmd>typefile</cmd>.<br />
<br />
== Preliminary setting ==<br />
Let's define our own typing style, named "code". The typing is put in a framedtext, to demonstrate the wrapping feature in a next section.<br />
<br />
<texcode><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
</texcode><br />
<br />
== Default line numbering ==<br />
With the defined typing, every line is numbered, and the number goes in the margin. The option to have the line numbers displayed is <tt>numbering=line</tt>.<br />
<br />
<texcode><br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
</texcode><br />
<br />
It is rendered as:<br />
<br />
<context><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
<br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
</context><br />
<br />
== Line numbers in the text ==<br />
To have the line numbers in the text, change the linenumbering setup like this:<br />
<br />
<texcode><br />
\setuplinenumbering[location=intext]<br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
</texcode><br />
<br />
<context><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
<br />
\setuplinenumbering[location=intext]<br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
</context><br />
<br />
== Continuing the numbering ==<br />
Another handy feature is the ability to continue the numbering from one portion of code to another. Use the option <tt>continue</tt> for this.<br />
<br />
<texcode><br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
<br />
Some normal text to explain the first piece of code,<br />
and introduce the following lines.<br />
<br />
\startcode[continue]<br />
This is the first continuing line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</texcode><br />
<br />
<context><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
<br />
\startcode<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
<br />
Last line after an empty line<br />
\stopcode<br />
<br />
Some normal text to explain the first piece of code, and introduce the following lines.<br />
<br />
\startcode[continue]<br />
This is the first continuing line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</context><br />
<br />
== Arbitrary starting line number ==<br />
You can also decide what the starting line number is. Use the option <tt>start=number</tt> for this.<br />
<br />
<texcode><br />
\startcode[start=200]<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</texcode><br />
<br />
<context><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
<br />
\startcode[start=200]<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</context><br />
<br />
== Line number steps ==<br />
You want to print a number every two lines? Ok, just use the option <tt>step=number</tt> for this.<br />
<br />
<texcode><br />
\startcode[start=200,step=2]<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</texcode><br />
<br />
<context><br />
\defineframedtext<br />
[framedcode]<br />
[strut=yes,<br />
offset=2mm,<br />
width=7cm,<br />
align=right]<br />
<br />
\definetyping[code][numbering=line,<br />
bodyfont=small,<br />
before={\startframedcode},<br />
after={\stopframedcode}]<br />
<br />
\startcode[start=200,step=2]<br />
This is the first line<br />
This is a rather long line that is wrapped, so look how the line numbering is done<br />
Another line<br />
Last line<br />
\stopcode<br />
</context><br />
<br />
<br />
= A different approach to formatting and code colorization =<br />
<br />
Supposing that: <br />
<br />
a) you are much more fluent in another programming language than TeX <br />
<br />
b) you have a large project involving many code snippets to be inserted and colorized<br />
<br />
you can go for another, less elegant, way to format your verbatim text, which can include all the discussed ConTeXt benefits. <br />
<br />
== Writing a parser/formatter ==<br />
<br />
It is fairly simple to write a little parser which takes as its input your source file and gives in output a .tex file containing the code plus the opportune commands for colorization. You can then include the resulting .tex file in the global ConTeXt document file.<br />
As an example, [http://www.fonurgia.unito.it/andrea/sw/sc/scToConTeXt.py this] is a Python script for the SuperCollider language, which has a strict Smalltalk-like syntax.<br />
<br />
Fed with the following source code contained in e.g. example.sc file:<br />
<br />
<br />
<context><br />
\tfx<br />
\starttyping<br />
// an example starting with a comment<br />
"this is a string".postln ;<br />
<br />
\aSymbol ;<br />
<br />
ThisClassDoesNotExist ;<br />
\stoptyping<br />
</context><br />
<br />
<br />
the script outputs this tex code, which is written into a file contained in the same folder of the source file (named example.tex):<br />
<br />
<texcode><br />
\startSC<br />
/BTEX{\color[SCred] //// an example starting with a comment}/ETEX<br />
/BTEX{\color[SCgrey] "this is a string"}/ETEX .postln ;<br />
<br />
/BTEX{\color[SCgreen] \letterbackslash aSymbol}/ETEX ;<br />
<br />
/BTEX{\color[SCblue] ThisClassDoesNotExists}/ETEX ;<br />
\stopSC<br />
</texcode><br />
<br />
Basically, the idea is to envelope each item to be colorized inside a /BTEX /ETEX block. <br />
Note that inside the block the text is no more verbatim, so you have to define some string replacements for special characters (e.g. _, %, $, \, etc). <br />
As an example, the problem of the backslash (\) is solved here by replacing it with \letterbackslash. <br />
<br />
You can then insert example.tex in your ConTeXt file with<br />
<br />
<texcode><br />
\input example<br />
</texcode><br />
<br />
<br />
The example.tex file uses some definitions (explained in the previous sections) which have to be put in the ConTeXt file. <br />
<br />
<texcode><br />
\defineframedtext<br />
[framedSC]<br />
[framecolor=cirmaBlue,<br />
strut=yes,<br />
offset=2mm,<br />
width=local,<br />
align=right]<br />
<br />
\definetyping[SC][option=commands, <br />
tab=2,numbering=line,<br />
before={\startframedSC},<br />
after={\stopframedSC}]<br />
</texcode><br />
<br />
Also, example.tex requires color definitions, which are created following SuperCollider colorization interpreter scheme and have to be inserted in the ConTeXt file too:<br />
<br />
<texcode><br />
%% SC colors %%<br />
\definecolor [SCwhite] [r=1.0, g=1.0, b=1.0] <br />
\definecolor [SCblack] [r=0.0, g=0.0, b=0.0] <br />
\definecolor [SCblue] [r=0.0, g=0.0, b=0.75] <br />
\definecolor [SCred] [r=0.75, g=0.0, b=0.0] <br />
\definecolor [SCgrey] [r=0.376, g=0.376, b=0.376] <br />
\definecolor [SCgreen] [r=0.0, g=0.45, b=0.0]<br />
<br />
\definecolor[cirmaBlue] [r=.0,g=.2,b=.6] % for frame<br />
</texcode><br />
<br />
The previous definitions will be used for all the code files inserted with \input.<br />
After compiling, this is the result of the discussed example:<br />
<br />
<br />
<context><br />
\setupcolors[state=start]<br />
\starttext<br />
%% SC colors %%<br />
\definecolor [SCwhite] [r=1.0, g=1.0, b=1.0] <br />
\definecolor [SCblack] [r=0.0, g=0.0, b=0.0] <br />
\definecolor [SCblue] [r=0.0, g=0.0, b=0.75] <br />
\definecolor [SCred] [r=0.75, g=0.0, b=0.0] <br />
<br />
\definecolor [SCgrey] [r=0.376, g=0.376, b=0.376] <br />
\definecolor [SCgreen] [r=0.0, g=0.45, b=0.0] <br />
\definecolor[cirmaBlue] [r=.0,g=.2,b=.6] <br />
<br />
\defineframedtext<br />
[framedSC]<br />
[framecolor=cirmaBlue,<br />
strut=yes,<br />
offset=2mm,<br />
width=local,<br />
align=right]<br />
<br />
\definetyping[SC][option=commands, <br />
tab=2,numbering=line,<br />
before={\startframedSC},<br />
after={\stopframedSC}]<br />
<br />
\startSC<br />
/BTEX{\color[SCred] //// an example starting with a comment}/ETEX<br />
/BTEX{\color[SCgrey] "this is a string"}/ETEX .postln ;<br />
<br />
/BTEX{\color[SCgreen] \letterbackslash aSymbol}/ETEX ;<br />
<br />
/BTEX{\color[SCblue] ThisClassDoesNotExists}/ETEX ;<br />
\stopSC<br />
<br />
\stoptext<br />
</context><br />
<br />
== Embedding the source code ==<br />
<br />
If your document is inteded to provide code examples to be tested by the readers, the presence of format signs (e.g. line numbers) can create some troubles while copying and pasting the code text from your document to the language environment. More generally, the copy and paste approach, being slow and possibly related to encodings, is not satisfying at all.<br />
You can include source files in the pdf with a couple of ConTeXt commands:<br />
<br />
<texcode><br />
\useattachment[ex][example.sc]<br />
\attachment[ex]<br />
</texcode><br />
<br />
<br />
So that you can have this structure for each code snippet:<br />
<br />
<texcode><br />
\input example<br />
<br />
\useattachment[ex][example.sc]<br />
\attachment[ex]<br />
</texcode><br />
<br />
<br />
The commands embed example.sc in the pdf, so that it is accessible by double-clicking on a generated icon. In this case the icon is placed after the colorized code frame.<br />
If you use Acrobat Reader (Preview.app in MacOSX does not provide support for the behaviour) example.sc will be open in the related application (e.g. SuperCollider.app in the discussed case).<br />
<br />
<br />
The discussed approach has been implemented [http://www.cirma.unito.it/andrea/sw/sc/prd_tSCIRMA.pdf here].<br />
<br />
(-a- --> [[User:Andrea]])</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/useexternalfile&diff=11567Command/useexternalfile2010-04-17T11:11:44Z<p>Peter: cleanup</p>
<hr />
<div>{{Reference<br />
|name=useexternalfile<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\useexternalfile<span class="first" >[...]</span><span class="second" >[...]</span><span class="third" >[...]</span><span class="first" >[...,...=...,...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[...]</td><br />
<td>name </td><br />
</tr><br />
<tr valign="top" class="second"><br />
<td class="cmd">[...]</td><br />
<td>name </td><br />
</tr><br />
<tr valign="top" class="third"><br />
<td class="cmd">[...]</td><br />
<td>file </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:bodyfont|bodyfont]]</td><br />
<td>5pt ... 12pt [[Reference/en/value:small|small]] [[Reference/en/value:big|big]] </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|useexternalfile]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/typebuffer&diff=11566Command/typebuffer2010-04-17T11:11:27Z<p>Peter: cleanup</p>
<hr />
<div>{{Reference<br />
|name=typebuffer<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\typebuffer<span class="first" >[...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[...]</td><br />
<td>name </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
[[cmd:startbuffer|\startbuffer]]<br />
<br />
[[Category:Reference/en|typebuffer]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/usesymbols&diff=11564Command/usesymbols2010-04-17T11:11:07Z<p>Peter: cleanup</p>
<hr />
<div>{{Reference<br />
|name=usesymbols<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\usesymbols<span class="first" >[...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[...]</td><br />
<td>name </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|usesymbols]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/startinteractionmenu&diff=11426Command/startinteractionmenu2010-04-15T11:41:58Z<p>Peter: cleanup</p>
<hr />
<div>{{Reference<br />
|name=startinteractionmenu<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\startinteractionmenu<span class="first" >[...]</span> ... \stopinteractionmenu</td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[...]</td><br />
<td>name </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|startinteractionmenu]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/startlocal&diff=11265Command/startlocal2010-04-13T13:00:13Z<p>Peter: cleanup</p>
<hr />
<div>{{Reference<br />
|name=startlocal<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table><br />
<tr><br />
<td class="cmd">\startlocal ... \stoplocal</td><br />
</tr><br />
</table><br />
<br />
== Description == <br />
<br />
<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|startlocal]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command_old/startlinecorrection&diff=11262Command old/startlinecorrection2010-04-13T12:59:44Z<p>Peter: cleanup</p>
<hr />
<div>{{Reference<br />
|name=startlinecorrection<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table><br />
<tr><br />
<td class="cmd">\startlinecorrection ... \stoplinecorrection</td><br />
</tr><br />
</table><br />
<br />
== Description == <br />
<br />
<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|startlinecorrection]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/setupcolors&diff=11200Command/setupcolors2010-04-12T06:30:19Z<p>Peter: ok</p>
<hr />
<div>{{Reference<br />
|name=setupcolors<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\setupcolors<span class="first" >[...,...=...,...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:state|state]]</td><br />
<td>[[Reference/en/value:start|start]] [[Reference/en/value:stop|stop]] [[Reference/en/value:global|global]] [[Reference/en/value:local|local]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:conversion|conversion]]</td><br />
<td>[[Reference/en/value:yes|yes]] [[Reference/en/value:no|no]] [[Reference/en/value:always|always]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:reduction|reduction]]</td><br />
<td>[[Reference/en/value:yes|yes]] [[Reference/en/value:no|no]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:rgb|rgb]]</td><br />
<td>[[Reference/en/value:yes|yes]] [[Reference/en/value:no|no]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:cmyk|cmyk]]</td><br />
<td>[[Reference/en/value:yes|yes]] [[Reference/en/value:no|no]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:mpcmyk|mpcmyk]]</td><br />
<td>[[Reference/en/value:yes|yes]] [[Reference/en/value:no|no]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:mpspot|mpspot]]</td><br />
<td>[[Reference/en/value:yes|yes]] [[Reference/en/value:no|no]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:textcolor|textcolor]]</td><br />
<td>[[Reference/en/value:name|name]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:split|split]]</td><br />
<td>[[Reference/en/value:c|c]] [[Reference/en/value:m|m]] [[Reference/en/value:y|y]] [[Reference/en/value:k|k]] [[Reference/en/value:p|p]] [[Reference/en/value:s|s]] [[Reference/en/value:no|no]] [[Reference/en/value:name|name]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:criterium|criterium]]</td><br />
<td>[[Reference/en/value:all|all]] [[Reference/en/value:none|none]] </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|setupcolors]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/setupcolor&diff=11199Command/setupcolor2010-04-12T06:29:21Z<p>Peter: ok</p>
<hr />
<div>{{Reference<br />
|name=setupcolor<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\setupcolor<span class="first" >[...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[...]</td><br />
<td>name </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<pre><br />
load a color preset from file colo-xxx.tex<br />
</pre><br />
== comment ==<br />
<pre><br />
default distributed presets:<br />
rgb: some default color names<br />
xwi: X Windows colors<br />
pra: Pragma company colors<br />
ema: Emacs colors<br />
</pre><br />
<br />
<br />
<br />
== Example ==<br />
<br />
<pre class="example"><br />
\setupcolor[rgb] % is default<br />
\setupcolor[xwi] % load X Windows colors<br />
\showcolor[rgb]<br />
</pre><br />
<br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|setupcolor]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/setupcaptions&diff=11198Command/setupcaptions2010-04-12T06:28:23Z<p>Peter: ok</p>
<hr />
<div>{{Reference<br />
|name=setupcaptions<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\setupcaptions<span class="first" >[...,...=...,...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:location|location]]</td><br />
<td>[[Reference/en/value:top|top]] [[Reference/en/value:bottom|bottom]] [[Reference/en/value:none|none]] [[Reference/en/value:high|high]] [[Reference/en/value:low|low]] [[Reference/en/value:middle|middle]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:width|width]]</td><br />
<td>[[Reference/en/value:fit|fit]] [[Reference/en/value:broad|broad]] [[Reference/en/value:max|max]] [[Reference/en/value:dimension|dimension]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:minwidth|minwidth]]</td><br />
<td>[[Reference/en/value:fit|fit]] [[Reference/en/value:dimension|dimension]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:headstyle|headstyle]]</td><br />
<td>[[Reference/en/value:normal|normal]] [[Reference/en/value:bold|bold]] [[Reference/en/value:slanted|slanted]] [[Reference/en/value:boldslanted|boldslanted]] [[Reference/en/value:type|type]] [[Reference/en/value:cap|cap]] [[Reference/en/value:small|small...]] [[Reference/en/value:command|command]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:style|style]]</td><br />
<td>[[Reference/en/value:normal|normal]] [[Reference/en/value:bold|bold]] [[Reference/en/value:slanted|slanted]] [[Reference/en/value:boldslanted|boldslanted]] [[Reference/en/value:type|type]] [[Reference/en/value:cap|cap]] [[Reference/en/value:small|small...]] [[Reference/en/value:command|command]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:number|number]]</td><br />
<td>[[Reference/en/value:yes|yes]] [[Reference/en/value:no|no]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:inbetween|inbetween]]</td><br />
<td>[[Reference/en/value:command|command]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:align|align]]</td><br />
<td>[[Reference/en/value:left|left]] [[Reference/en/value:middle|middle]] [[Reference/en/value:right|right]] [[Reference/en/value:no|no]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:conversion|conversion]]</td><br />
<td>[[Reference/en/value:numbers|numbers]] [[Reference/en/value:characters|characters]] [[Reference/en/value:Characters|Characters]] [[Reference/en/value:romannumerals|romannumerals]] [[Reference/en/value:Romannumerals|Romannumerals]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:way|way]]</td><br />
<td>[[Reference/en/value:bytext|bytext]] [[Reference/en/value:bysection|bysection]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:separator|separator]]</td><br />
<td>[[Reference/en/value:text|text]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:stopper|stopper]]</td><br />
<td>[[Reference/en/value:text|text]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:command|command]]</td><br />
<td>[[Reference/en/value:command|command]] </td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[[Reference/en/keyword:distance|distance]]</td><br />
<td>[[Reference/en/value:dimension|dimension]] </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|setupcaptions]]</div>Peterhttps://wiki.contextgarden.net/index.php?title=Command/setupcaption&diff=11197Command/setupcaption2010-04-12T06:25:51Z<p>Peter: ok</p>
<hr />
<div>{{Reference<br />
|name=setupcaption<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\setupcaption<span class="first" >[...]</span><span class="second" >[...,...=...,...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[...]</td><br />
<td>name </td><br />
</tr><br />
<tr valign="top" class="second"><br />
<td class="cmd">[...,...=...,...]</td><br />
<td>see [[Reference/en/setupcaptions|\setupcaptions]] </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|setupcaption]]</div>Peter