Commit ed946b88 authored by Alexander Povel's avatar Alexander Povel


parent 9e4a81d9
......@@ -479,7 +479,7 @@ Now, we only need to get the contents of that variable into the LaTeX source,
and finally the compiled PDF.
The LaTeX package `hyperref` can modify PDF metadata.
In the LaTeX preamble, we can then use
In the LaTeX preamble, we can then use, for example,
\usepackage[pdfusetitle]{hyperref}% pdfusetitle reads from \author and \title
......@@ -495,23 +495,22 @@ Note that in LaTeX, you likely used `\author{<author's name>}` and `\title{<docu
somewhere in the preamble to generate a title page.
`hyperref`'s `pdfusetitle` option will use those values for the PDF metadata.
Lastly, `pdfcreator` will fill the `Application` field we see above.
However, `\GitRefName{}` and `\GitShortSHA{}}` need to be defined.
These are defined earlier in the preamble:
However, `\GitRefName{}` and `\GitShortSHA{}}` need to be defined first.
This happens earlier in the preamble:
(Side note: use the [starred variant of `newcommand`](,
unless you need paragraph breaks, which is mostly not the case).
Using the above definition, the fields will just show up as *not available* if for example
compiling locally ("at home").
The server has a script employing `sed` (since we're using GNU/Linux there),
specified in [.gitlab-ci.yml](.gitlab-ci.yml), that seeks `GitRefName` and `GitShortSHA`
and replaces whatever comes in the curly braces of those commands.
See the `script` of the `replace_git_metadata` job in that file.
This runs, with the help of LuaTeX's [Lua]( integration,
some [Lua code](lib/lua/envvar_newcommands.lua) directly in LaTeX.
Within Lua, `os.getenv(<string> name)` lets us retrieve environment variables, which are
then turned into macros/control sequences (`\newcommand`) of a given name using
`token.set_macro(<string> csname, <string> content)`, see the [LuaTeX reference](
on all the included Lua functionality provided by LuaTeX, on top of regular Lua.
### Add PDF Download Button
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment