[NTG-context] Problem with MkIV and TikZ picture remembering

Wolfgang Schuster schuster.wolfgang at gmail.com
Sat Mar 7 19:22:33 CET 2015

> Am 07.03.2015 um 18:30 schrieb Jörg Weger <joerg73.muc at googlemail.com>:
> > Is that really an mkiv issue? If I understood well tikz has its own way
> > of keeping track of positions independent of context.
> Normally yes.
> But there is TikZ’ “remember picture” mode. You can produce several independent TikZ pictures on a ConTeXt/LaTeX/plain text page. TikZ tells ConTeXt (or LaTeX or plain TeX) to give back the coordinates of those pictures on the page after the page has been typeset. TikZ can then draw interconnections between those images which are rendered in an extra run.

Tikz uses the pdftex commands \pdfsavepos, \pdflastxpos and \pdflastypos to save the position
of the graphics on the page. ConTeXt isn’t involved in this process which provides its own
interface for this mechanism but Tikz doesn’t use it.

> In my example the rounded rectangles with the words inside are TikZ images which are put inline into the ConteXt text by the command
> \tikz[baseline] \node[<form of node>, draw, anchor=text] {<text content>}
> When I use
> \tikz[baseline, remember picture] …
> instead I activate the mode explained above and the arrows can be drawn according to the “remembered” coordinates after ConTeXt’s first typesetting run.
> According to Wolfgang Schuster in the first reply in this thread when using ConTeXt mkiv – other than mkii – file the coordinates given back after the first typesetting run look strange in TikZ’ auxiliary so there seems to be a mistake somnewhere between ConTeXt and TikZ in this regard.

The problem is the \write command which differs in MkII and MkIV and Tikz
way to prevent the expansion of a command which is written to the auxiliary file.

The following example demonstrates the difference between MkII and MkIV.

In MkII the \noexpand prevents the expansion of \dummytext when writes
content is written to the external file but in MkIV \write is redefined and this
doesn’t work anymore.

%%%% begin example



\def\dummytext{First sample text.}


\def\dummytext{Second sample text.}



%%%% end example


More information about the ntg-context mailing list