1

I would like to use, and it appears suited, the \component and related commands in ConTeXt. However, I would like to have multiple parameters to a given component e.g.

\startcomponent X
  \sometexcommand{name} % where name is a parameter that varies the component
\stopcomponent

One way to accomplish this might be to set Lua variables as side-effects, but I was wondering if there was a way to directly pass arguments to components e.g.

\component[X][name=123]

Then use something like \structureuservariable{name}

If a component is not suited for this, is there a sensible alternative one might suggest?

  • 1
    Why not use a module instead of a component. You can pass parameters to modules. – Aditya Apr 1 '15 at 16:43
3

Components do not take parameters but modules do.

Save this as t-X.tex (t- stands for third-party)

\startmodule X

\sometexcommand{\currentmoduleparameter{name}} % where name is a parameter that varies the component

\stopmodule

And use the module in your main document.

\starttext

\usemodule[X][name=123]

\stoptext

This will of course not compile because \sometexcommand is undefined.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.