Unlike LaTeX's core, CONTEXT core macros have quite readable code and, specially in the lack of up-to-date documentation for certain commands, one can learn a lot by just reading the code itself and the documentation provided therein. That's also a good source of learning how to write CONTEXT macros.

In fact, there is a way to generate documentation right from the code itself, which adds the provided annotations to the PDF output along with the actual code. According to Garden, this is done via the following command line.

context --ctx=s-mod core-con.mkiv

This generates a core-con.mkiv.prep file and also compiles it into a nice PDF output.

How does the same functionality work for Lua files? The same page on Garden suggests the following.

context --ctx=x-ldx core-con.lua

This generates a core-con.lua.prep and then a core-con.lua.prep.prep file but not the desired supposedly HTML documentation. Question: What am I doing wrong here?

Question: What tags beside the \module definition at the top and the index mechanism \macros can we use inside the %D comments (in MkIV sources)? (I know we can use any TeX code; I'm asking what special macros are available.) I also notice a special %C tag for the copyright statement but don't know what effect it has. Are there any other special comment codes?

Question: What about the tags in the Lua file? Those are more mysterious and scarcer. Why are these HTML tags, anyway, instead of TeX macros?

1 Answer 1


It should be fixed in beta, see CONTEXT distribution - beta version

  • I just updated my CONTEXT to the latest beta (2016.05.08 17:30) but the Lua documentation code still does not work. This time it complains that \scitepacked is not defined. I couldn't find it anywhere outside x-ldx.mkiv. It seems to be a misspelling of \stoppacked.
    – MHB
    May 9, 2016 at 23:39
  • what about removing the old .prep file and replacing \scitepacked by \stoppacked ? May 10, 2016 at 9:21
  • Thanks! I actually patched x-ldx.mkiv and it worked.
    – MHB
    May 10, 2016 at 22:42
  • Could you address the other parts of the question as well?
    – MHB
    May 10, 2016 at 22:43

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.