Macros are autogenerated for a book's title and author name. The title can sometimes include TeX-specific tokens, such as ~ and ldots{}.


When setting the document properties, the title includes the verbatim values in the book title macro.



\def\BookTitle{The Strange Case of Dr.~Jekyll and Mr.~Hyde}
\starttext \input knuth \stoptext




How do you replace the tilde (and other possible entities) such that the typeset value (e.g., a non-breaking space) is passed to the title option of the setupdocument command?

The \expandafter macro doesn't seem to be the correct approach (also, there's no way to know how many items would need expanding). The \detokenize macro didn't seem to interpret the ~ token. Using \the and \relax broke the build.


1 Answer 1


There is a builtin option for this. Simply enable the directive interaction.identity.preroll. The same preroll functionality is available for bookmarks with references.bookmarks.preroll, see also PDF bookmarks don't get proper formatting

\def\BookTitle{The Strange Case of Dr.~Jekyll and Mr.~Hyde}
\starttext \input knuth \stoptext
$ pdfinfo test.pdf | grep Title
Title:          The Strange Case of Dr. Jekyll and Mr. Hyde
  • @DaveJarvis There is a command line option to list all available directives and in principle their names should be self-documenting. Apart from that I don't think there is any docs. Commented Apr 25, 2020 at 22:35

You must log in to answer this question.

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