TeX markup in \setupinteraction for PDF metadata fields
![](https://secure.gravatar.com/avatar/4a9ad756d92bdf75252b9296e27fc8ad.jpg?s=120&d=mm&r=g)
Hi, Is it possible to have TeX markup executed in the text fields for \setupinteraction? I would like to do something like: \definemarking[xyz] \marking[xyz]{Hello} \setupinteraction[state=start] \setupinteraction[title={\getmarking[xyz][current]}] \setupinteraction[author={\getmarking[xyz][current]}] \starttext xyz=\getmarking[xyz][current] \stoptext But my generated PDF has literally "\getmarking[xyz][current]}" for the title and author. Thanks, -- Kate
![](https://secure.gravatar.com/avatar/b79687264c3e06cba13b54d05b12a9f5.jpg?s=120&d=mm&r=g)
Kate F mailto:kate@elide.org 17. Januar 2016 um 17:56 Hi,
Is it possible to have TeX markup executed in the text fields for \setupinteraction? I would like to do something like:
\definemarking[xyz] \marking[xyz]{Hello} \setupinteraction[state=start] \setupinteraction[title={\getmarking[xyz][current]}] \setupinteraction[author={\getmarking[xyz][current]}] \starttext xyz=\getmarking[xyz][current] \stoptext
But my generated PDF has literally "\getmarking[xyz][current]}" for the title and author. Are you sure you want to use marks to store text because the mechanism works only in headers and footers.
Wolfgang
![](https://secure.gravatar.com/avatar/4a9ad756d92bdf75252b9296e27fc8ad.jpg?s=120&d=mm&r=g)
On 17 January 2016 at 17:00, Wolfgang Schuster
Kate F 17. Januar 2016 um 17:56 Hi,
Is it possible to have TeX markup executed in the text fields for \setupinteraction? I would like to do something like:
\definemarking[xyz] \marking[xyz]{Hello} \setupinteraction[state=start] \setupinteraction[title={\getmarking[xyz][current]}] \setupinteraction[author={\getmarking[xyz][current]}] \starttext xyz=\getmarking[xyz][current] \stoptext
But my generated PDF has literally "\getmarking[xyz][current]}" for the title and author.
Are you sure you want to use marks to store text because the mechanism works only in headers and footers.
I don't know, actually. In this case these are values which remain constant throughout the document. So all I'm after here is a mechanism for storing variables by name. Is there something more appropriate to use for those kind of variables? I didn't know markings only exist in headers and footers! Thanks. -- Kate
![](https://secure.gravatar.com/avatar/b79687264c3e06cba13b54d05b12a9f5.jpg?s=120&d=mm&r=g)
Kate F mailto:kate@elide.org 17. Januar 2016 um 18:53 On 17 January 2016 at 17:00, Wolfgang Schuster
I don't know, actually. In this case these are values which remain constant throughout the document. So all I'm after here is a mechanism for storing variables by name. Is there something more appropriate to use for those kind of variables? You can use the \setvariables command the set the values and access them with \getvariables:
\setvariables [information] [title=Document title, author=Author name] \setupinteraction [ state=start, title=\getvariable{information}{title}, author=\getvariable{information}{title}] \starttext \unknown \stoptext There is also the \setupdocument command (a simple wrapper for the \setvariables command) which uses predefined keywords to set fields in the pdf file. You can access the values from \setupdocument command in your document with \documentvariable{<KEY>}. \setupdocument [ metadata:title=Document title, metadata:author=Author name] \setupinteraction[state=start] \starttext \unknown \stoptext Wolfgang
![](https://secure.gravatar.com/avatar/ac3fbaf0a287c4cffbc9f18fa931586c.jpg?s=120&d=mm&r=g)
On Sun, 17 Jan 2016 19:27:31 +0100
Wolfgang Schuster
Kate F mailto:kate@elide.org 17. Januar 2016 um 18:53 On 17 January 2016 at 17:00, Wolfgang Schuster
I don't know, actually. In this case these are values which remain constant throughout the document. So all I'm after here is a mechanism for storing variables by name. Is there something more appropriate to use for those kind of variables? You can use the \setvariables command the set the values and access them with \getvariables:
\setvariables [information] [title=Document title, author=Author name]
\setupinteraction [ state=start, title=\getvariable{information}{title}, author=\getvariable{information}{title}]
\starttext \unknown \stoptext
There is also the \setupdocument command (a simple wrapper for the \setvariables command) which uses predefined keywords to set fields in the pdf file. You can access the values from \setupdocument command in your document with \documentvariable{<KEY>}.
\setupdocument [ metadata:title=Document title, metadata:author=Author name]
\setupinteraction[state=start]
\starttext \unknown \stoptext
Wolfgang
How does this play with \startdocument [title=Document title, author=Me] Here, I learn about metadata:title= which suggests that I could do without \setupinteraction [state=start, title={\getvariable{document}{title}}, author={\getvariable{document}{author}}] But, if I want to use the title etc. in the title page, should I do something like: \starttitlepagemakeup \getvariable{document}{metadata:title} \stoptitlepagemakeup Thanks Alan
![](https://secure.gravatar.com/avatar/b79687264c3e06cba13b54d05b12a9f5.jpg?s=120&d=mm&r=g)
Alan BRASLAU mailto:alan.braslau@cea.fr 17. Januar 2016 um 19:55 On Sun, 17 Jan 2016 19:27:31 +0100
How does this play with \startdocument [title=Document title, author=Me] It doesn’t matter if you set the values with \setupdocument or \startdocument. Here, I learn about metadata:title= which suggests that I could do without \setupinteraction [state=start, title={\getvariable{document}{title}}, author={\getvariable{document}{author}}] You can use \documentvariable{...} to access the values. But, if I want to use the title etc. in the title page, should I do something like:
\starttitlepagemakeup \getvariable{document}{metadata:title} \stoptitlepagemakeup It depends, when you want the title in the pdf without a manual setting with \setupinteraction you can use the value of “metadata:title” in your document.
Wolfgang
![](https://secure.gravatar.com/avatar/ac3fbaf0a287c4cffbc9f18fa931586c.jpg?s=120&d=mm&r=g)
On Sun, 17 Jan 2016 20:09:56 +0100
Wolfgang Schuster
But, if I want to use the title etc. in the title page, should I do something like:
\starttitlepagemakeup \getvariable{document}{metadata:title} \stoptitlepagemakeup It depends, when you want the title in the pdf without a manual setting with \setupinteraction you can use the value of “metadata:title” in your document.
Thanks, again, these are useful pointers. In conclusion, good practice could be (but would this work?): \startdocument [title=My title, metadata:title=\documentvariable{title}, author=Me, metadata:author=\documentvariable{author}] ... \stopdocument Alan
![](https://secure.gravatar.com/avatar/b79687264c3e06cba13b54d05b12a9f5.jpg?s=120&d=mm&r=g)
Alan BRASLAU mailto:alan.braslau@cea.fr 17. Januar 2016 um 23:39 On Sun, 17 Jan 2016 20:09:56 +0100
Thanks, again, these are useful pointers. In conclusion, good practice could be (but would this work?):
\startdocument [title=My title, metadata:title=\documentvariable{title}, author=Me, metadata:author=\documentvariable{author}] ... \stopdocument I would separate both settings and put \setupdocument somewhere in the preamble.
\setupdocument [metadata:title=\documentvariable{title}, metadata:author=\documentvariable{author}] \startdocument [title=My title, author=Me] ... \stopdocument Wolfgang
![](https://secure.gravatar.com/avatar/4a9ad756d92bdf75252b9296e27fc8ad.jpg?s=120&d=mm&r=g)
On 17 January 2016 at 18:27, Wolfgang Schuster
Kate F 17. Januar 2016 um 18:53 On 17 January 2016 at 17:00, Wolfgang Schuster
I don't know, actually. In this case these are values which remain constant throughout the document. So all I'm after here is a mechanism for storing variables by name. Is there something more appropriate to use for those kind of variables?
You can use the \setvariables command the set the values and access them with \getvariables:
\setvariables [information] [title=Document title, author=Author name]
\setupinteraction [ state=start, title=\getvariable{information}{title}, author=\getvariable{information}{title}]
\starttext \unknown \stoptext
There is also the \setupdocument command (a simple wrapper for the \setvariables command) which uses predefined keywords to set fields in the pdf file. You can access the values from \setupdocument command in your document with \documentvariable{<KEY>}.
\setupdocument [ metadata:title=Document title, metadata:author=Author name]
\setupinteraction[state=start]
\starttext \unknown \stoptext
Wolfgang
Thanks! I remembered about \setvariables just after asking. I think that suits my situation more than \setupdocument, since I'm doing this from handling various different kinds of XML, and this way I can keep the call to \setupinteraction shared between all of them. -- Kate
participants (3)
-
Alan BRASLAU
-
Kate F
-
Wolfgang Schuster