4

Background

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

Problem

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

Code

Consider:

\def\BookTitle{The Strange Case of Dr.~Jekyll and Mr.~Hyde}
\setupinteraction[title=\BookTitle,]
\starttext \input knuth \stoptext

Produces:

Output

Question

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.

0

1 Answer 1

9

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

\enabledirectives[interaction.identity.preroll]
\def\BookTitle{The Strange Case of Dr.~Jekyll and Mr.~Hyde}
\setupinteraction[title=\BookTitle,]
\starttext \input knuth \stoptext
$ pdfinfo test.pdf | grep Title
Title:          The Strange Case of Dr. Jekyll and Mr. Hyde
1
  • @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 .