[NTG-context] Tikz figures not centred

2010-11-11 Thread Michael Murphy
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.

-- 
Michael Murphy michael.mur...@uni-ulm.de
University of Ulm
\usemodule[tikz]

\starttext

\startbuffer[tikz-picture]
  \starttikzpicture
\fill[red] (0,0) circle (2);
  \stoptikzpicture
\stopbuffer

\placefigure{A tikz figure}{\getbuffer[tikz-picture]}

\placefigure{Another tikz figure}{
  \starttikzpicture
\fill[red] (0,0) circle (2);
  \stoptikzpicture
}

\placefigure{An external tikz figure}{
  \externalfigure[tikzfig.pdf]
}

\stoptext


tikzfig.pdf
Description: Adobe PDF document
___
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
___


Re: [NTG-context] Tikz figures not centred

2010-11-11 Thread Vedran Miletić
2010/11/11 Michael Murphy michael.mur...@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ć
___
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
___


Re: [NTG-context] Tikz figures not centred

2010-11-11 Thread Michael Murphy
On Thu, 2010-11-11 at 12:14 +0100, Vedran Miletić wrote:
 2010/11/11 Michael Murphy michael.mur...@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ć

Hmm, why didn't I think of that... Thanks!

-- 
Michael Murphy michael.mur...@uni-ulm.de
University of Ulm

___
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
___


Re: [NTG-context] Tikz figures not centred

2010-11-11 Thread Aditya Mahajan

On Thu, 11 Nov 2010, Michael Murphy wrote:


On Thu, 2010-11-11 at 12:14 +0100, Vedran Miletić wrote:

2010/11/11 Michael Murphy michael.mur...@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ć


Hmm, why didn't I think of that... Thanks!


See 
http://archive.contextgarden.net/thread/20090722.010815.d9c051d3.en.html 
for an old discussion on this.


Aditya___
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
___