Thanks Hans!

That works great. I understand it all and it is working in my book, so even 
better. I did not know you could \typsetbuffer[a,b,c]. I will be using that 
again.

In case anyone finds this in the future, trying to solve a similar issue, my 
final version is below, including my \marginTikZ command.

Gavin


\setuppapersize[letter]

\setuplayout[
  backspace=90pt, % Horizontal layout
  leftmargin=36pt, % 1/2 in
  leftmargindistance=9pt, % 3/8 in
  width=306pt, % 4 1/4 in
  rightmargindistance=27pt, % 3/8 in
  rightmargin=144pt,  % 2 in
]

\startbuffer[starttikz]
   \usemodule[tikz]% Lots of setup can go here!
   \startTEXpage
   \starttikzpicture
\stopbuffer

\startbuffer[stoptikz]
   \stoptikzpicture
   \stopTEXpage
\stopbuffer

\define[2]\marginTikZ{
  \startplacefigure[location=margin, reference=fig:#1, title={#2}]
    \typesetbuffer[starttikz,#1,stoptikz]
  \stopplacefigure
}

\starttext

\startbuffer[BlueCircle]
 \draw[thick,blue] (0,0) circle (2cm)node{Ti{\it k}Z!};
\stopbuffer

\marginTikZ{BlueCircle}{Ti{\it k}Z drew this blue circle\dots slowly.}

\startbuffer[RedCircle]
 \draw[thick,red] (0,0) circle (2cm)node{Ti{\it k}Z!};
\stopbuffer

\marginTikZ{RedCircle}{Ti{\it k}Z drew this red circle\dots slowly.}

Take a look at the blue circle in \in{figure}[fig:BlueCircle] and the red 
circle in \in{figure}[fig:RedCircle]

\stoptext

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to