Difference between revisions of "Command/cldcommand"
< Command
Jump to navigation
Jump to search
(Create entire page) |
(Tweaking) |
||
Line 8: | Line 8: | ||
<tr> | <tr> | ||
<td colspan="2" class="cmd">\cldcommand<!-- | <td colspan="2" class="cmd">\cldcommand<!-- | ||
− | --><span class="first"> | + | --><span class="first">{...}</span><!-- |
--></td> | --></td> | ||
</tr> | </tr> | ||
<tr valign="top" class="first"> | <tr valign="top" class="first"> | ||
− | <td class="cmd"> | + | <td class="cmd">{...}</td> |
− | <td>'' | + | <td>''a valid way to end `context.` in Lua''</td> |
</tr> | </tr> | ||
</table> | </table> | ||
Line 19: | Line 19: | ||
== Description == | == Description == | ||
− | Execute a ConTeXt command via the | + | 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 25: | ||
== Example == | == Example == | ||
− | <texcode | + | <texcode> |
− | + | % 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] | ||
</texcode> | </texcode> | ||
Revision as of 20:46, 25 July 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: