So I am trying to wrap my head around how modules are written for ConTeXt. I'm trying to create a module for a title page based on just minor changes to the t-title.mkvi module. I have copied and renamed the file and placed it in my tree.

My problem is that I am struggling to understand how to add an element. If I add \titleelement\c!place to the module in the appropriate place and then have this in document:

  [title={Some Title},
   author={John Grasty},
   date={July 26, 2005},
   place={Some Place}]

it works as I would expect.

If I substitute pubplacefor place, then I get an "Undefined control sequence error". Where are the parameters/variables defined, that the module will accept?

Source for original module


Your question is pretty unclear but I highly suspect that you are using \c!pubplace in your code which is a so called interface constant. In ConTeXt modules you usually call \unprotect to be able to use internal names with underscores. One effect of this is to also make ! a letter which makes \c!pubplace a control sequence. Of course, this control sequence has to be defined before use, which is done using


A related post with the same problem but much clearer question statement is Using ConTeXt BNF module. In the second part of my answer I show how one could port the BNF module to MKIV. This could serve as a blueprint for your own modules.

  • Hi Henri, thanks for some direction. I can clarify my question later, but this is essentially what I’m asking: When I look at Wolfgang’s code for the title module, I can’t figure out where he defines author, title, and date as control sequences. The latest link to his source code is above, plus it’s an included module, so it’s likely you already have it. Any ideas? – John Grasty Mar 21 '18 at 7:54
  • Is this related to the title.xmlinterface file? – John Grasty Mar 21 '18 at 8:31
  • @JohnGrasty The interface constants \c!title, \c!author, etc. are already defined by the core. It's basically a matter of trial and error. Just don't define the constant and see if it works, if not, define it in your module. – Henri Menke Mar 21 '18 at 8:32
  • Henri, brilliant! Thanks. I will update my question later, so that it will be easier for people searching with similar problems. I simply added \setinterfaceconstant{pubplace}{pubplace}and everything worked as expected. – John Grasty Mar 21 '18 at 8:38

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.