I am trying to position a TikZ picture on a beamer
slide but some nodes (well, not all?) get pushed to the right.
I have tried to add %
wherever it seemed fitting as mentioned in Tikz figure in Beamer shifting way to the right of the frame, but that doesn't help.
I have tried the adjustbox
which only resize the nodes but doesn't move them to the right. My head hurts so maybe you could help since I probably have missed something.
I can make things more or less work with the textblock
environment but I think it's
Here is my MnotWE:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzstyle{block1} =[draw=black, fill=blue!40, rectangle, minimum height=0.25cm, minimum width=0.25cm, inner xsep=0.25cm, font=\bf\normalsize]
\tikzstyle{link} =[draw=blue, ultra thick]
\tikzstyle{box1} =[draw=blue, fill=white, ultra thick, rectangle, inner ysep=0.25cm, inner xsep=0.25cm, minimum height=0.25cm]
\tikzstyle{fancytitle1} =[fill=black, rounded corners, text=white]
\begin{document}
\begin{frame}
\begin{tikzpicture}%
\node (preop) [block1] {blabla};
\node (op) [block1, right=.25cm of preop] {blabla};
\node (postop) [block1, right=.25cm of op] {blabla};
\node (posthp) [block1, right=.25cm of postop] {blabla};
\draw (preop) -- (op);
\draw (op) -- (postop);
\draw (postop) -- (posthp);
\node[box1, above= 2cm of preop] (box1) {%
\begin{minipage}{1\textwidth}%
\vspace{.5cm}%
\begin{itemize}%
\item tutu
\item tete
\end{itemize}%
\end{minipage}};
\node[fancytitle1, right=10pt] at (box1.north west) {Operation};
\draw[link] (op.north) -- (op|-box1.south);
\end{tikzpicture}%
\end{frame}
\end{document}
Additionally:
-
I would like to have the
minipage
flush with the most left blabla node(preop)
; and both somewhere close to the left hand side of my slide. -
Can we position a node relatively by giving separate measures for vertical and horizontal distance? I know there is such a thing as
above left= 2 cm of XXX
but what if I want 1cm above and 2cm left?
Best Answer
This is because of the left margin on the slide. If you wrap your
tikzpicture
in a\makebox[\textwidth][c]{...}
, as explained in Martin Scharrer's answer to Center figure that is wider than \textwidth, it will be centered properly.For your first additional question: Using
above = 2cm of preop.west, anchor=west
will align the Operation box with the left edge of the firstblabla
node.For your second additional question: You can use
above left = 1cm and 2cm of <node>
.