[NTG-context] \documentvariable (used in environment)

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Sat Jul 25 10:20:24 CEST 2020

Alan Braslau schrieb am 25.07.2020 um 00:21:
> On 22/07/20 22:36, Wolfgang Schuster wrote:
>> What exactly doesn't work and do you get the same problems when you 
>> set the values in the following minimal example (everything has to be 
>> in the same file).
>> %%%% begin example
>> \setupdocument
>>    [metadata:title={\documentvariable{title}},
>>     metadata:subtitle={\documentvariable{subtitle}},
>>     metadata:author={\documentvariable{author}},
>>     metadata:keywords={\documentvariable{keywords}}]
>> \startdocument [title={My title}]
>> \input knuth
>> \stopdocument
>> %%%% end example
>> Wolfgang
> Thank you, Wolfgang.
> The above example does work. It fails to set the metadata if one moves 
> the \setupdocument to an environment file. As you write, "everything 
> has to be in the same file".
The requirement was only necessary for the example to check if the 
metadata end up in the PDF file. You could have a environment file for 
\setupdocument but the goal here was to check the resulting metadata in 
the PDF.
> This is my question, how to set these using an environment file, thus 
> NOT the same file as the \startdocument in a project structure.
The problem is something in your environment/style file which causes a 
problem with the \setupdocument setup. What you should do to find the 
sulprit is:

1. Make a copy of your document
2. Remove all text between \startdocument and \stopdocument and add some 
dummy text (like in my example) to ensure ConTeXt produces a PDF
3. Remove setups from your environment (but keep the \setupdocument 
setup) file until the metadata appears in the PDF


More information about the ntg-context mailing list