tikzpicture ends up way outside the limits of the page

In my document which is defined as A4, I want to place our logo in the upper left corner of the first page. The code I'm using for this is:

\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north west,inner sep=1cm] at (current page.north west){\includegraphics[width=3cm]{Logo}};
\end{tikzpicture}


If I compile my document with xelatex document.tex no logo can be seen. When opening the PDF file in a graphic program, I find out that the logo has been included in the file, but positioned outside of the visible area of the page (way above the page and on the right side).

However if I compile my document with latexmk -xelatex document.tex, the logo appears exactly where I expect it to be. Just this method gives me the following warning: The following rules & subrules became out-of-date: 'xelatex'.

For now this compilation method still works, but I would assume that the rule will stop working sometime in the future, so I'd like to find out why the other way of compiling breaks my document.

I'd be glad for any explanation, idea or tip on how to fix this.

Here a complete example document which demonstrates the same behaviour:

\documentclass[12pt]{article}
\geometry{a4paper}
\usepackage{tikz}

\begin{document}
\graphicspath{{images/}}
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north west,inner sep=1cm] at (current page.north west){\includegraphics[width=3cm]{UniLogo}};
\end{tikzpicture}
\center
\vspace{2cm}
\large Lorem ipsum dolor sit amet
\pagebreak[4]
\end{document}


P.S.: Just to be clear, the logo file does exist in the indicated path, and it is also correctly read and included, just the position is off.

New contributor
Eric J. Francois is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Jun 22 at 11:35
• @hpekristiansen Thanks for the suggestion, I've added a full example to my post. Jun 22 at 12:31
• Do you have the same behaviour/problem when replacing "UniLogo" with "example-image-a" ? If you do that, then others will be able to compile your code directly. In TexShop, I get the correct placement of the logo both with LaTeX and XeLaTeX. I also tried zsh compile with xelatex - ( This is XeTeX, Version 3.141592653-2.6-0.999994 )without any problem. Is you system up to date? Jun 22 at 12:43
• It work fine, however for final result you need due to used remember picture, overlay compile at least twice. Jun 22 at 15:58
• @hpekristiansen Yes, I get the same result with "example-image-a" and the same happens when using TexShop with both LaTeX and XeLaTeX. However the comment by Zarko seems to hit the nail on the head: when typesetting twice in a row, the logo appears. Jun 23 at 18:23