I so on this forum a very nice way to create a cover page with the tikz package, I understand globally what the functions doing but I want to understand every instruction.



\tikzset{page cs/.cd, x/.store in=\px, y/.store in=\py}

    \tikzset{page cs/.cd, #1}
    \pgfpointadd{\pgfpointanchor{current page}{south west}}

\begin{tikzpicture}[remember picture, overlay, font=\sffamily \bfseries \huge, inner sep=0pt, outer sep=0pt, white]
    \node at (current page.center) {\includegraphics[height=\paperheight]{image.jpg}};
    \fill [cyan, opacity=0.5] (page cs:x=0,y=0.075) rectangle (page cs:x=1,y = 0.30);
    \node [scale=2.2, anchor=west] at (page cs:x=0.075, y=0.235) {Games of Thrones};
    \node [anchor=west] at (page cs:x=0.075, y=0.18) {Lorem ipsum dolor sit amet, consectetur adipiscing elit.};
    \node [anchor=west] at (page cs:x=0.075, y=0.12) {By George R. R. Martin};


The part that I don't understand are the tikzset definitions and the tikzdeclarecoordinatesystem. I try to look on internet but I didn't find any good explications of tikzset, what are .store, \px, \py ? What does pgfpointadd and pgfpoint ?

Best regards, Zed13

Ps : sorry for my poor english


These are PGF syntax which is the basic layer behind TikZ. Roughly speaking, TikZ is the front-end, user-convenient parser for the actual graphics format PGF. There is also a system layer but you shouldn't need it unless you have serious intentions and a lot of free time.

Hence when you write for example a calc library notation

\node at ($(2,1) + (0,2)$) {A};

what is assumed is vector addition (x1+x2,y1+y2). That is pretty much what \pgfpointadd does.

\pgfpoint is actually the low-level equivalent of coordinate syntax (1cm,2pt) such that you can write \pgfpoint{1cm}{2pt} It takes two arguments and expects to have two PGF registers to modify \pgf@x,\pgf@y (skipping a million details). But TikZ syntax has the advantage of a limited duck typing. In TikZ you can give a node name, an anchor of a node, an actual dimension, or just number etc. and it is processed and regularized to be used in \pgfpoint and so on. For example (a.north) is understood by TikZ but you need to change the corresponding macro name to \pgfpointanchor{a}{north}. Thus, TikZ is really useful to have shortcuts.

The coordinate system declaration is useful if you require to refer to a certain object frequently or do computations relative to a fixed object.

Here the coordinates are taken and then added to the current page lower left corner such that it acts like you have a TikZ picture with origin is moved to the lower left corner. So when you write (0.3,0.5) it finds the lower left corner then computes the length 0.3 * page width and 0.5 * page height quantities and add to the lower left corner coordinates.

The /.store is a key-handler and there is no way it can be covered here in the answer. You need to read the pgfkeys section of the TikZ/PGF manual. Basically, instead of \defining something you hold it in a key-based database or a dict-like structure in Python lingo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.