This requires changing format of \Keywords.
all: thesis.pdf abstract.pdf
# LaTeX must be run multiple times to get references right
-thesis.pdf: thesis.tex $(wildcard *.tex) bibliography.bib thesis.xmpdata
+thesis.pdf: thesis.tex $(wildcard *.tex) bibliography.bib
pdflatex $<
bibtex thesis
pdflatex $<
pdflatex $<
clean:
- rm -f *.log *.dvi *.aux *.toc *.lof *.lot *.out *.bbl *.blg *.xmpi
+ rm -f *.log *.dvi *.aux *.toc *.lof *.lot *.out *.bbl *.blg *.xmpi *.xmpdata
rm -f thesis.pdf abstract.pdf
\X{This is not a~copy of your thesis assignment!}
}
-% 3 to 5 keywords (recommended), each enclosed in curly braces.
+% 3 to 5 keywords (recommended) separated by \sep
% Keywords are useful for indexing and searching for the theses by topic.
-\def\Keywords{%
-\xxx{{key} {words}}
+\def\ThesisKeywords{%
+\xxx{keyword\sep key phrase}
\X{usually 3 to~5 key words or phrases}
}
+% If any of your metadata strings contains TeX macros, you need to provide
+% a plain-text version for use in XMP metadata embedded in the output PDF file.
+% If you are not sure, check the generated thesis.xmpdata file.
+\def\ThesisAuthorXMP{\ThesisAuthor}
+\def\ThesisTitleXMP{\ThesisTitle}
+\def\ThesisKeywordsXMP{\ThesisKeywords}
+\def\AbstractXMP{\Abstract}
+
% If your abstracts are long and do not fit in the infopage, you can make the
% fonts a bit smaller by this setting. (Also, you should try to compress your abstract more.)
\def\InfoPageFont{}
\def\SupervisorsDepartmentCS{\xxx{katedra vedoucího}}
\def\StudyProgrammeCS{\xxx{studijní program}}
-\def\KeywordsCS{%
-\xxx{{klíčová} {slova}}
+\def\ThesisKeywordsCS{%
+\xxx{klíčová slova\sep klíčové fráze}
}
\def\AbstractCS{%
%%% The main file. It contains definitions of basic parameters and includes all other parts.
+% Meta-data of your thesis (please edit)
+\input metadata.tex
+
+% Generate metadata in XMP format for use by the pdfx package
+\input xmp.tex
+
%% Settings for single-side (simplex) printing
% Margins: left 40mm, right 25mm, top and bottom 25mm
% (but beware, LaTeX adds 1in implicitly)
\hypersetup{unicode}
\hypersetup{breaklinks=true}
-% Meta-data of your thesis (please edit)
-\include{metadata.tex}
-
% Definitions of macros (see description inside)
\include{macros}
+++ /dev/null
-% Metadata to be stored in PDF, see documentation of the pdfx package for more details.
-
-\Author{Name Surname}
-\Title{Thesis title}
-\Keywords{keywords\sep more such\sep yet another}
-\Subject{Abstract of thesis}
-\Publisher{Charles University}
\Abstract
Keywords:
-\Keywords
-
-\XXX{This information must be stored as PDF meta-data, too. Please refer to the {\tt README} file.}
-\vss}
+{\def\sep{\unskip, }\ThesisKeywords}
% In Czech study programmes, it is mandatory to include Czech meta-data:
\AbstractCS
Klíčová slova:
-\KeywordsCS
+{\def\sep{\unskip, }\ThesisKeywordsCS}
}
\fi
--- /dev/null
+% Generate XMP metadata file (*.xmpdata) from thesis metadata
+% The format of the xmpdata file is described in the documentation
+% of the "pdfx" LaTeX package.
+
+{
+% Define \percenthack macro that expands to a literal "%" character.
+% (We can use neither \char\`% nor \% as they are interpreted by TeX's
+% main processor which is too late for our purposes.)
+\catcode`\%=12
+\global\edef\percenthack{%}
+}
+
+{
+% Override some macros
+\def\xxx#1{#1}
+\def\X#1{}
+\def\sep{\string\sep\space}
+\let~=\space
+
+% Generate *.xmpdata
+% It is tempting to use LaTeX's filecontents environment, but it does not
+% expand macros. We need to dive deeper...
+\newwrite\xmp
+\immediate\openout\xmp=\jobname.xmpdata
+\immediate\write\xmp{\percenthack\space Generated automatically from metadata.tex, please don't edit here.}
+\def\xmpitem#1#2{\immediate\write\xmp{\string#1{#2}}}
+\xmpitem\Author\ThesisAuthorXMP
+\xmpitem\Title\ThesisTitleXMP
+\xmpitem\Keywords\ThesisKeywordsXMP
+\xmpitem\Subject\AbstractXMP
+\xmpitem\Publisher{Charles University}
+\immediate\closeout\xmp
+}