# [NTG-context] placing a tikz/pgf figure

Tue Jan 9 23:51:28 CET 2007

On Tue, 9 Jan 2007, M.J. Kallen wrote:

> Hi all,
>
> I'm trying to determine how to best insert a figure/graph created
> using the tikz/pgf module (I'm using v1.10). The attached sample
> file compares the result of just using \placefigure and \placefigure
> with \startcombination[1*1]. In the first case, the result is not
> centered (which should be default in ConTeXt, if I'm correct) but
> flushed left. Only if I place the figure inside a \startcombination
> by using \input, do I get the desired result. If I use
> \externalfigure inside the \startcombination, I again get an
> incorrect result.

This is because (I think) that tikzpicture does not return a box.

> In theory, the first version should work but some special settings
> (using e.g. \useexternalfigure) may be required. I do not know why
> the second version does work. Does anyone have an idea?

Replace

{\externalfigure[tikz.tmp]}

with

{\hbox{\input \jobname-tikz.tmp\relax}}

I have noticed this \placefigure and I do not know if it is a bug or a
feature. \placefigure expects you to give a box as a figure. Compare
the output of

\placefigure
[here]
{Left Fulushed}
{This is a test}

and

\placefigure
[here]
{centered}
{\hbox{This is a test}}

Hans, will adding a \hbox explicitly to \placefigure break anything?

On Tue, 9 Jan 2007, Hans Hagen wrote:

> willy, what do i need to install to get this example running?

You will need to install tikz from
(http://sourceforge.net/projects/pgf/). The directory is not TDS
complaint, so you may need to correct that before installing the tree.