Difference between revisions of "Command/cldcommand"

From Wiki
Jump to navigation Jump to search
(Create entire page)
 
 
(3 intermediate revisions by one other user not shown)
Line 3: Line 3:
 
|attributes=
 
|attributes=
 
}}
 
}}
 +
 +
== [[Help:Reference|Syntax]] (autogenerated) ==
 +
<syntax>cldcommand</syntax>
  
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==
Line 8: Line 11:
 
   <tr>
 
   <tr>
 
     <td colspan="2" class="cmd">\cldcommand<!--
 
     <td colspan="2" class="cmd">\cldcommand<!--
       --><span class="first">[...]</span><!--
+
       --><span class="first">{...}</span><!--
 
  --></td>
 
  --></td>
 
   </tr>
 
   </tr>
 
   <tr valign="top" class="first">
 
   <tr valign="top" class="first">
     <td class="cmd">[...]</td>
+
     <td class="cmd">{...}</td>
     <td>''text''</td>
+
     <td>''a valid way to end `context.` in Lua''</td>
 
   </tr>
 
   </tr>
 
</table>
 
</table>
Line 19: Line 22:
 
== Description ==  
 
== Description ==  
  
Execute a ConTeXt command via the Lua interpreter. Defined as follows:
+
Execute a ConTeXt command via lookup in the {{code|context}} table in LuaTeX. Defined as follows:
  
 
     \def\cldcommand#1{\directlua\zerocount{context.#1}}
 
     \def\cldcommand#1{\directlua\zerocount{context.#1}}
Line 25: Line 28:
  
 
== Example ==
 
== Example ==
<texcode mode=mkiv source=yes>
+
<context mode=mkiv source=yes>
  \cldcommand{blackrule}
+
% Draw a black rule via Lua, passing the [...=...] as a Lua table
</texcode>
+
\cldcommand{
 +
    blackrule({
 +
        width = "2em",
 +
        height = "1em"
 +
    })
 +
}
 +
% Draw a black rule directly
 +
\blackrule[
 +
    width=4em,
 +
    height=1em]
 +
</context>
  
 
== See also ==
 
== See also ==

Latest revision as of 17:26, 12 November 2019

\cldcommand

Syntax (autogenerated)

\cldcommand{...}
{...}command


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: