# [NTG-context] Tikz figures not centred

Vedran Miletić rivanvx at gmail.com
Thu Nov 11 12:14:21 CET 2010

2010/11/11 Michael Murphy <michael.murphy at uni-ulm.de>

> Hi,
>
> I've been having some problems with tikz figures. When I define a new
> tikz figure, I normally put it in a buffer:
>
> \startbuffer[mypic]
>        \starttikzfigure
>                ...
>        \stoptikzfigure
> \stopbuffer
>
> which I use later when I place the figure
>
> \placefigure{My picture}{\getbuffer[mypic]}
>
> The problem is that the figure is not centred: it is always aligned with
> the left side of the document. I guess this has something to do with
> Context not being able to get the image bounds, since it works fine for
> tikz images that are already precompiled into PDFs:
>
> \placefigure{My picture}{\externalimage[mypic.pdf]}
>
> Minimal example is attached.
>
> Michael.
>
>
You have to wrap up the picture inside of a \hbox, e.g.

\hbox{\starttikzfigure
...
\stoptikzfigure}

Regards,

--
Vedran Miletić
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20101111/c446c9e7/attachment.html>