Absolute node positioning acts weirdly

Issue #14 resolved
fkjogu created an issue

I try to position nodes on an overlay by using this code

\begin{scope}[overlay]
  \node at(10,20) {a};
  \node at(20,20) {b};
\end{scope}

I'd expect, that those nodes are on the same heights. However, they are not.
Drawing pathes works just fine. But as soon are present, this weird behavior can be seen.

Comments (9)

  1. fkjogu reporter
    \documentclass{tikzposter}
    
    \begin{document}
        \block{Something}{%
            \begin{scope}[overlay]
                \node at(10,10) {a};
                \node at(20,10) {b};
            \end{scope}
        }
    \end{document}
    
  2. Rick Barnard

    The block body sits inside of a parbox. So the node positioning follows whatever rules are inherited by parbox. I'm having trouble figuring out if it's an issue of rewriting [x]spaceskip or something more subtle from the parbox spacing/positioning rules. If you replace the coordinates with (0,0) for each node you see that the positioning is off. I suspect it's something deep with the parbox positioning rules.

  3. Elena

    In any case, tikz code should be used inside tikzpicture environment or tikz command. I would say that your code is not "syntactically correct".

  4. Pascal Richter

    Elena is right, you need to use \begin{tikzpicture} ... \end{tikzpicture}:

    \documentclass{tikzposter}
    
    \begin{document}
        \block{Something}{%
            \begin{tikzpicture}
                \node at(10,10) {a};
                \node at(20,10) {b};
           \end{tikzpicture}
        }
    \end{document}
    
  5. fkjogu reporter

    Yes sure, this works. But that is not what I want to achieve. I specifically don't want to draw inside a block, but want to draw anywhere on the document without causing a reflow of the content. Thus I specified an overlay scope.

    Just move it out of a block seems not to be working, as you you can check yourself:

    \documentclass{tikzposter}
    
    \begin{document}
        \block{Something}{%
            Some content
        }
    
        \begin{tikzpicture}[overlay]
            \node at(0, 0) {a};
            \node at(2, 0) {b};
       \end{tikzpicture}
    \end{document}
    

    Having it inside a block makes the coordinates relative to that block.

    How would I achieve that?

    Also, I'm not sure about needing a tikzpicture environment, since the \block command itself just uses TIKZ commands.

  6. Log in to comment