Command/ctxcommand

Unofficial ConTeXt Wiki mirror

Last modified: 2024-09-15

Summary

The command \ctxcommand is used to quickly access Lua commands in the command table.

Settings

\ctxcommand{...}
{...} command

Option Explanation
command lua command from in the command table

Description

Defined as:

\def\ctxcommand #1{\directlua{commands.#1}} % saves tokens

You can write e.g.

\ctxcommand{doifelse(\userpage < 10)}{early page}{later page}

instead of

\ctxlua{commands.doifelse(\userpage < 10)}{early page}{later page}

.

Examples

Example 1

  • \ctxcommand{doifelse(\userpage < 10)}{early page}{later page}
    

\ctxcommand vs. \cldcommand

  •   A
      \ctxlua{commands.doif(true)}{one}
      B
      \cldcommand{doif("a","a","two")}
      C
      \ctxcommand{doif(true)}{three}
      D
    

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: