]> mj.ucw.cz Git - diplomky.git/blob - xmp.tex
d1a6daa477cfc827400235e2c51790d402850149
[diplomky.git] / xmp.tex
1 % Generate XMP metadata file (*.xmpdata) from thesis metadata
2 % The format of the xmpdata file is described in the documentation
3 % of the "pdfx" LaTeX package.
4
5 {
6 % Define \percenthack macro that expands to a literal "%" character.
7 % (We can use neither \char\`% nor \% as they are interpreted by TeX's
8 % main processor which is too late for our purposes.)
9 \catcode`\%=12
10 \global\edef\percenthack{%}
11 }
12
13 {
14 % Override some macros
15 \def\xxx#1{#1}
16 \def\X#1{}
17 \def\sep{\string\sep\space}
18 \let~=\space
19
20 % Generate *.xmpdata
21 % It is tempting to use LaTeX's filecontents environment, but it does not
22 % expand macros. We need to dive deeper...
23 \newwrite\xmp
24 \immediate\openout\xmp=\jobname.xmpdata
25 \immediate\write\xmp{\percenthack\space Generated automatically from metadata.tex, please don't edit here.}
26 \def\xmpitem#1#2{\immediate\write\xmp{\string#1{#2}}}
27 \xmpitem\Author\ThesisAuthorXMP
28 \xmpitem\Title\ThesisTitleXMP
29 \xmpitem\Keywords\ThesisKeywordsXMP
30 \xmpitem\Subject\AbstractXMP
31 \xmpitem\Publisher{Charles University}
32 \immediate\closeout\xmp
33 }