Difference between revisions of "Command/cldcommand"

From Wiki
Jump to navigation Jump to search
(show result of example)
(Um. Show the source, too.)
Line 25: Line 25:
  
 
== Example ==
 
== Example ==
<context mode=mkiv>
+
<context mode=mkiv source=yes>
 
% Draw a black rule via Lua, passing the [...=...] as a Lua table
 
% Draw a black rule via Lua, passing the [...=...] as a Lua table
 
\cldcommand{
 
\cldcommand{

Revision as of 21:47, 28 September 2012

\cldcommand

Syntax

\cldcommand{...}
{...} a valid way to end context. in Lua

Description

Execute a ConTeXt command via lookup in the context table in LuaTeX. Defined as follows:

   \def\cldcommand#1{\directlua\zerocount{context.#1}}
   % so \cldcommand{somecommand} --> \directlua{context.somecommand}

Example

% Draw a black rule via Lua, passing the [...=...] as a Lua table
\cldcommand{
    blackrule({
        width = "2em", 
        height = "1em"
    })
}
% Draw a black rule directly
\blackrule[
    width=4em, 
    height=1em]

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: