Changes

Jump to navigation Jump to search
58 bytes removed ,  07:39, 25 January 2017
m
typo correction
=== ConTeXt Features ===
* [[Modes]]: Document options that can be selected when the document is processed.Conditional processing of text* [[Setups]]: An alternative to macros for storing chunks of code
=== Commands and Arguments ===
* [[System Macros]] (''Recommended reading''. Topics: temporary variables, expansion control, argument grabbing and handling, definitions and assignments, branches and decisions, cases, comma separated lists, assignments and parameters, user interaction.)* [[Programming in LuaTeX]] (Topic: alleviating the more cumbersome sides of TeX programming.)* [[Commands with KeyVal arguments|Commands with Key=Value arguments]]: For (Topic: things like <code>\command[thiskey=thatvalue]</code>. ) * [[Commands with optional arguments]]: One (Topic: one or more optional arguments within brackets.) === Module Parameters ===* [[Module Parameters]]: Passing parameters to modules.
=== Programming Techniques ===
* [[Processing Lists]]: Processing lists of values* [[Counters]]: Manipulating counters in context* [[Expressions]]: Evaluating expressions of type number, dimen, glue or muglue* [[executesystemcommand]]: process contents of an environment by another program* Loops and expansion [http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ (blog post)]
=== Debugging ===
\getvariable{namespace}{key}
</texcode>
 
To avoid problems, also pay attention to the following:
On the other hand you can only process one variable at the same time, so
<tt>\getvariable</tt> uses the '''singular''' form and works with '''braces'''.
 
 
OK, here comes a simple example. Let's say, that we want to have variable
And don't forget:
'''Just ensure, Ensure that all variables are set, before you use them!''' 
== Defining new commands ==
== Passing verbatim text as macro parameter ==
== Passing (For passing text to LuaTex verbatim text as macro parameter ==, see the [[Programming_in_LuaTeX#Manipulating_verbatim_text_for_dummies|Programming in LuaTeX]] article on this wiki.)
In case you want to write macros that should handle verbatim text,
\TextWithSpaces{A gap from here to there!}
</context>
 
 
 
== Setups ==
In ConTeXt it is easy to create local variables and grouping. Local variables can be simulated as in:
 
<texcode>
\startsetups whatever
% some useful definitions here
\stopsetups
 
\definestartstop[whatever][commands=\setups{whatever}]
 
\startwhatever
Using definitions here.
\stopwhatever
</texcode>
 
But you can place setups almost everywhere and environment will not be affected by their execution. It is useful to wrap overlay definitions and such in setups as in (copied from [[Colorful_CD_Inlay]] page):
 
<texcode>
\defineoverlay [origin] [\setups{origin}]
 
\startsetups origin
\vbox to \overlayheight {
\vfill\tfxx\setstrut
\hsize\overlaywidth
\hfill Fiona Apple\enspace EM\enspace2005\quad\strut\endgraf
\kern1ex
}
\stopsetups
</texcode>
 
You can even do things like:
 
<texcode>
\starttext
\startsetups settest
\def\command{do something with}
I want to \command{} command.
\stopsetups
 
\start
\setups{settest}
\stop
 
\command aaa % will give "undefined control sequence" error
 
\stoptext
</texcode>
[[Category:Inside ConTeXt]]
[[Category:ConTeXt programming]]
19

edits

Navigation menu