2

On this new machine (OSX 10.11.5, freshly installed MacTex 2016) absolute positioning does not work as intended.

I have tested and re-tested with examples from the TikZ manual, and the output gives the same positioning errors, for example:

\begin{tikzpicture}[remember picture,overlay]
\node [xshift=1cm,yshift=1cm] at (current page.south west)
[text width=7cm,fill=red!20,rounded corners,above right]
{
This is an absolutely positioned text in the
lower left corner. No shipout-hackery is used.
}; 
\end{tikzpicture} 

This should produce a box at the absolute lower left corner of the page, but the output I get places the box exactly at the start of the first paragraph on the page, as if overlay was ignored completely. What is causing this behavior?

  • 5
    did you run twice ? – percusse Aug 13 '16 at 16:40
  • 2
    Also, make sure your installation is updated. A fresh install won't be. – cfr Aug 13 '16 at 18:46
  • I get the box at the bottom left corner as expected with just one run. Make sure you update your Tex distribution! – Alenanno Aug 13 '16 at 18:56
  • 2
    @Alenanno Are you sure? Try deleting the .aux file and running once (unless you're using a build script like latexmk, in which case it's not really one run.) – Alan Munn Aug 13 '16 at 19:24
  • There didn't seem to be any pgf or tikz packages to update, but just to be sure, I updated everything. I did run it twice, and the correct behavior was displayed. I had neglected to set the editor to automatically run it twice for output; that is the correct solution. – SteelAngel Aug 13 '16 at 22:23
5

The remember picture and overlay functions of TiKZ require two compilations of your document because the position on the page is first written to the .aux file and then read back in the second run.

If you want the runs to be done automatically you will need to tell your editor to use some sort of build script like latexmk or arara.

  • Arara won't compile twice automatically. It isn't a build script in that sense. At least, not by default. Or, at least, not for me. – cfr Aug 14 '16 at 1:15
  • @cfr Sure it's not totally automatic but it's still a simple way to automate on a per document basis. (I could also argue about scope of the disjunction... :) ) – Alan Munn Aug 14 '16 at 1:45
  • Do you mean that you can get it to compile twice? I use Arara but I would need to run arara twice if I wanted to compile a document twice. – cfr Aug 14 '16 at 2:03
  • @cfr You can add as many arara lines to your document as you like, so if you've got 2 then in will compile twice. What it won't do (which latexmk will) is figure out whether or not the second run is needed. – Alan Munn Aug 14 '16 at 4:33
  • When I tried that, it ignored all but the first line. – cfr Aug 14 '16 at 16:39

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.