ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Problem with MkIV and TikZ picture remembering
Date: Sun, 08 Mar 2015 11:11:43 +0100	[thread overview]
Message-ID: <54FC205F.5060807@wxs.nl> (raw)
In-Reply-To: <34B905CF-9CC0-497D-B6A2-9DAD468983DC@gmail.com>

On 3/7/2015 7:22 PM, Wolfgang Schuster wrote:
>
>> Am 07.03.2015 um 18:30 schrieb Jörg Weger <joerg73.muc@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
> \newwrite\testwrite
>
> \starttext
>
> \immediate\openout\testwrite=\jobname-dummytext.tmp
>
> \def\dummytext{First sample text.}
>
> \immediate\write\testwrite{\noexpand\dummytext}
>
> \def\dummytext{Second sample text.}
>
> \immediate\write\testwrite{\noexpand\dummytext}
>
> \immediate\closeout\testwrite
>
> \stoptext
> %%%% end example

this should help:

\unexpanded\def\writeviatex#1#2%
   {\ifx\normalwrite\relax\else
     % the \detokenize makes sure we don't expand \noexpanded macros
      \normalwrite#1{\detokenize{#2}}%
    \fi}

(in future version i might replace write completely)

Hans

-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2015-03-08 10:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03  7:23 Jörg Weger
2015-03-03  7:25 ` Jörg Weger
2015-03-03  7:54   ` Wolfgang Schuster
2015-03-03 12:38     ` Ulrike Fischer
2015-03-03 13:11       ` Mojca Miklavec
2015-03-03 13:27         ` Ulrike Fischer
2015-03-03 15:29           ` Mojca Miklavec
2015-03-03 13:51         ` Ulrike Fischer
2015-03-03 17:12 ` Aditya Mahajan
2015-03-03 19:04   ` Hans Hagen
2015-03-03 19:28     ` Aditya Mahajan
2015-03-07 12:08       ` Jörg Weger
2015-03-07 14:52         ` Hans Hagen
2015-03-07 17:30           ` Jörg Weger
2015-03-07 18:22             ` Wolfgang Schuster
2015-03-08 10:11               ` Hans Hagen [this message]
2015-03-08 11:26                 ` Wolfgang Schuster
2015-03-08 11:55                   ` Hans Hagen
2015-03-08 12:04                     ` Wolfgang Schuster
2015-03-08 17:39                       ` Hans Hagen
2015-03-08 18:07                         ` Wolfgang Schuster
2015-03-08 19:04                           ` Hans Hagen
2015-03-08 22:17                           ` Hans Hagen
2015-03-13 13:17                             ` Jörg Weger
2015-03-13 13:32                               ` Wolfgang Schuster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54FC205F.5060807@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).