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
  • 1
    Why not use a module instead of a component. You can pass parameters to modules.
    – Aditya
    Commented Apr 1, 2015 at 16:43

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .