# tikz/pgf: Absolute Positioning of a Path

I fail to adopt an answer to absolute position a path on a beamer frame. The path in my actual code project is generated in an external software and very complex - I cannot change the coordinates.

\documentclass{beamer}
\usepackage{tikz}
\begin{document}

\begin{frame}

% Taken from https://tex.stackexchange.com/questions/348392/
\begin{tikzpicture}[remember picture,overlay]
\useasboundingbox (current page.north west) rectangle (current page.south east);
% Position the center of the following drawing at (.5\paperwidth,.5\paperheight)
\path[
draw = blue,
line width = 2pt
] (0,0) -- (1,2) -- (2,2) -- cycle;
\end{tikzpicture}
% Indicate the actual center
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {Center};
\end{tikzpicture}

\end{frame}

\end{document}


• Can you modify the software that produces your path, or post-process it with some tool, so that it uses as origin (0,0) the center of the path? – JLDiaz Jan 13 '17 at 16:48
• @JLDiaz It's an export from Inkscape and I am happy that I got so far :) – Dr. Manuel Kuehner Jan 13 '17 at 17:05

Probably not too correct but it seems to work if you accept that the center of the path is the center of its bounding box.

\documentclass{beamer}
\usepackage{tikz}
\begin{document}

\begin{frame}
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {Center};
\node[anchor=center, draw] at (current page.center) {%
\begin{tikzpicture}[baseline=(current bounding box.center)]
\path[
draw = blue,
line width = 2pt
] (0,0) -- (1,2) -- (2,2) -- cycle;
\end{tikzpicture}%
};
\end{tikzpicture}
\end{frame}

\end{document}


If you don't want to nest tikzpictures, the complex path could be drawn as a standalone document which can be inserted inside a node with \includegraphics:

%ComplexPath.tex
\documentclass[tikz, border=2mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\path[
draw = blue,
line width = 2pt
] (0,0) -- (1,2) -- (2,2) -- cycle;
\end{tikzpicture}
\end{document}


produces (with a transparent background):

which can be included into the main document:

%Main document
\documentclass{beamer}
\usepackage{tikz}
\begin{document}

\begin{frame}
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {Center};
\node at (current page.center) {\includegraphics{ComplexPath}};
\end{tikzpicture}
\end{frame}

\end{document}

• I'll try it tomorrow. Thanks. Later there will be a command in the actual code. The command will change on every frame. So I can't use the standalone approach. – Dr. Manuel Kuehner Jan 13 '17 at 16:46
• Is there a disadvantage when I nest tikzpiktures? – Dr. Manuel Kuehner Jan 13 '17 at 16:48
• @Dr.ManuelKuehner It's not recommended, probably due to dependences between them. In any case if you better explain what do you want to do and what's this command in the actual code we could better understand the problem and provide (or not) better solutions. – Ignasi Jan 13 '17 at 16:51
• Understood. I want to have this animation (tex.stackexchange.com/questions/347612) on this path (tex.stackexchange.com/questions/347336). But I need time to provide a high quality MWE. If your solution doesn't work on my specific combination of circumstances then I will have work out a good MWE. – Dr. Manuel Kuehner Jan 13 '17 at 16:57
• May be this can help. I think you can still produce a multipage standalone file and as all your pages will have similar size, you can crop and include as suggested there with page=... option in includegraphics. – Ignasi Jan 13 '17 at 18:21