* placing a tikz/pgf figure
@ 2007-01-09 16:42 M.J. Kallen
2007-01-09 18:15 ` Willi Egger
2007-01-10 0:21 ` Mojca Miklavec
0 siblings, 2 replies; 8+ messages in thread
From: M.J. Kallen @ 2007-01-09 16:42 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 926 bytes --]
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.
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?
Thanks,
Maarten-Jan
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: test-pgf.tex --]
[-- Type: text/x-tex; name="test-pgf.tex", Size: 836 bytes --]
\usemodule[tikz]
\setupfloat[figure][location=middle,frame=on]
\starttext
\startbuffer[tikz]
\starttikzpicture
\draw[red,thick] (0,0) -- (1,1)
{[rounded corners] -- (2,0) -- (3,1)}
-- (3,0) -- (2,1);
\stoptikzpicture
\stopbuffer
\placefigure
[here]
[fig:test1]
{The figure is flushed left, whereas it should be centered.}
{\externalfigure[tikz.tmp]}
\placefigure
[here]
[fig:test2]
{Using \type{\startcombination[1*1]} together with \type{\input}, the result looks as expected.}
{\startcombination[1*1]
{\input test-pgf-tikz.tmp } {}
\stopcombination
}
\placefigure
[here]
[fig:test3]
{Using \type{\startcombination[1*1]} together with \type{\externalfigure}, the result looks again as in the first figure.}
{\startcombination[1*1]
{\externalfigure[tikz.tmp]} {}
\stopcombination
}
\stoptext
[-- Attachment #3: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: placing a tikz/pgf figure
2007-01-09 16:42 placing a tikz/pgf figure M.J. Kallen
@ 2007-01-09 18:15 ` Willi Egger
2007-01-09 19:26 ` Hans Hagen
2007-01-10 0:21 ` Mojca Miklavec
1 sibling, 1 reply; 8+ messages in thread
From: Willi Egger @ 2007-01-09 18:15 UTC (permalink / raw)
Indeed I also get the results as you describe them. When looking at the
file *.tmp then you see, that the figure is generated on the fly. When
external figure is issued, then the textwidth is the base and therefore
the figure ends up leftaligned. -- In such cases I prefer to have the
figures prepared in a separate pdf-file by means of
\startTEXpage -- \stopTEXpage. Afterwards I include the TEXpages
with \externalfigure referencing the page in the file obtained. -- In my
experience this makes the runs faster.
Kind regards
Willi
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.
>
> 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?
>
> Thanks,
>
> Maarten-Jan
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> ------------------------------------------------------------------------
>
> \usemodule[tikz]
> \setupfloat[figure][location=middle,frame=on]
>
> \starttext
>
> \startbuffer[tikz]
> \starttikzpicture
> \draw[red,thick] (0,0) -- (1,1)
> {[rounded corners] -- (2,0) -- (3,1)}
> -- (3,0) -- (2,1);
> \stoptikzpicture
> \stopbuffer
>
> \placefigure
> [here]
> [fig:test1]
> {The figure is flushed left, whereas it should be centered.}
> {\externalfigure[tikz.tmp]}
>
> \placefigure
> [here]
> [fig:test2]
> {Using \type{\startcombination[1*1]} together with \type{\input}, the result looks as expected.}
> {\startcombination[1*1]
> {\input test-pgf-tikz.tmp } {}
> \stopcombination
> }
>
> \placefigure
> [here]
> [fig:test3]
> {Using \type{\startcombination[1*1]} together with \type{\externalfigure}, the result looks again as in the first figure.}
> {\startcombination[1*1]
> {\externalfigure[tikz.tmp]} {}
> \stopcombination
> }
>
>
> \stoptext
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: placing a tikz/pgf figure
2007-01-09 18:15 ` Willi Egger
@ 2007-01-09 19:26 ` Hans Hagen
2007-01-09 22:51 ` Aditya Mahajan
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Hans Hagen @ 2007-01-09 19:26 UTC (permalink / raw)
Willi Egger wrote:
> Indeed I also get the results as you describe them. When looking at the
> file *.tmp then you see, that the figure is generated on the fly. When
> external figure is issued, then the textwidth is the base and therefore
> the figure ends up leftaligned. -- In such cases I prefer to have the
> figures prepared in a separate pdf-file by means of
> \startTEXpage -- \stopTEXpage. Afterwards I include the TEXpages
> with \externalfigure referencing the page in the file obtained. -- In my
> experience this makes the runs faster.
>
willy, what do i need to install to get this example running?
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: placing a tikz/pgf figure
2007-01-09 19:26 ` Hans Hagen
@ 2007-01-09 22:51 ` Aditya Mahajan
2007-01-09 23:26 ` Mojca Miklavec
2007-01-10 20:08 ` Willi Egger
2 siblings, 0 replies; 8+ messages in thread
From: Aditya Mahajan @ 2007-01-09 22:51 UTC (permalink / raw)
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.
And of course, ignore Till Tantau's comments about ConTeXt on page
67-68 of the manual. He was working with stone age ConTeXt and still
manged to get the whole thing working :-)
And whenever you decide to overhaul the input mechanism for metapost,
tikz has some nice ideas.
Aditya
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: placing a tikz/pgf figure
2007-01-09 19:26 ` Hans Hagen
2007-01-09 22:51 ` Aditya Mahajan
@ 2007-01-09 23:26 ` Mojca Miklavec
2007-01-10 20:08 ` Willi Egger
2 siblings, 0 replies; 8+ messages in thread
From: Mojca Miklavec @ 2007-01-09 23:26 UTC (permalink / raw)
On 1/9/07, Hans Hagen wrote:
> Willi Egger wrote:
> > Indeed I also get the results as you describe them. When looking at the
> > file *.tmp then you see, that the figure is generated on the fly. When
> > external figure is issued, then the textwidth is the base and therefore
> > the figure ends up leftaligned. -- In such cases I prefer to have the
> > figures prepared in a separate pdf-file by means of
> > \startTEXpage -- \stopTEXpage. Afterwards I include the TEXpages
> > with \externalfigure referencing the page in the file obtained. -- In my
> > experience this makes the runs faster.
> >
> willy, what do i need to install to get this example running?
I guess that copying these files (at least generic and context) into
texmf tree should be enough:
ftp://cam.ctan.org/tex-archive/graphics/pgf
Mojca
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: placing a tikz/pgf figure
2007-01-09 19:26 ` Hans Hagen
2007-01-09 22:51 ` Aditya Mahajan
2007-01-09 23:26 ` Mojca Miklavec
@ 2007-01-10 20:08 ` Willi Egger
2 siblings, 0 replies; 8+ messages in thread
From: Willi Egger @ 2007-01-10 20:08 UTC (permalink / raw)
Hi Hasn,
In order to make sure, that the cooperation between tikz and Context
works okay, you should install pgf 1.10
http://sourceforge.net/project/showfiles.php?group_id=142562
Further you need to install the Latex package xkeyval.
I hope that will do!
Willi
Hans Hagen wrote:
> Willi Egger wrote:
>
>> Indeed I also get the results as you describe them. When looking at the
>> file *.tmp then you see, that the figure is generated on the fly. When
>> external figure is issued, then the textwidth is the base and therefore
>> the figure ends up leftaligned. -- In such cases I prefer to have the
>> figures prepared in a separate pdf-file by means of
>> \startTEXpage -- \stopTEXpage. Afterwards I include the TEXpages
>> with \externalfigure referencing the page in the file obtained. -- In my
>> experience this makes the runs faster.
>>
>>
> willy, what do i need to install to get this example running?
>
> Hans
>
>
> -----------------------------------------------------------------
> Hans Hagen | PRAGMA ADE
> Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
> | www.pragma-pod.nl
> -----------------------------------------------------------------
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: placing a tikz/pgf figure
2007-01-09 16:42 placing a tikz/pgf figure M.J. Kallen
2007-01-09 18:15 ` Willi Egger
@ 2007-01-10 0:21 ` Mojca Miklavec
2007-01-10 1:08 ` Aditya Mahajan
1 sibling, 1 reply; 8+ messages in thread
From: Mojca Miklavec @ 2007-01-10 0:21 UTC (permalink / raw)
Cc: Till Tantau
(abstract of Maarten-Jan's sample)
> \usemodule[tikz]
>
> \starttext
>
> \startbuffer[tikz]
> \starttikzpicture
> \draw[red,thick] (0,0) -- (1,1)
> {[rounded corners] -- (2,0) -- (3,1)}
> -- (3,0) -- (2,1);
> \stoptikzpicture
> \stopbuffer
>
> \placefigure
> {The figure is flushed left, whereas it should be centered.}
> {\externalfigure[tikz.tmp]}
>
> \stoptext
Hello,
I've been playing a bit with the most simple tikz examples so far, but
after I saw this example I got an impression that ConTeXt users might
also want to see syntax like
\starttikzpicture[optional options]{name}
...
\stoptikzpicture
\usetikzpicture{name}
in addition to the existing one, which would then be equivalent to
syntax of including metapost graphics. There are dozens of other
\start[whatever] commands defined in the module, but I have no idea
what all of them do. Perhaps \startpgfpicture might be another command
worth considering, but I have no idea about the rest.
Mojca
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: placing a tikz/pgf figure
2007-01-10 0:21 ` Mojca Miklavec
@ 2007-01-10 1:08 ` Aditya Mahajan
0 siblings, 0 replies; 8+ messages in thread
From: Aditya Mahajan @ 2007-01-10 1:08 UTC (permalink / raw)
On Wed, 10 Jan 2007, Mojca Miklavec wrote:
> (abstract of Maarten-Jan's sample)
>
> > \usemodule[tikz]
> >
> > \starttext
> >
> > \startbuffer[tikz]
> > \starttikzpicture
> > \draw[red,thick] (0,0) -- (1,1)
> > {[rounded corners] -- (2,0) -- (3,1)}
> > -- (3,0) -- (2,1);
> > \stoptikzpicture
> > \stopbuffer
> >
> > \placefigure
> > {The figure is flushed left, whereas it should be centered.}
> > {\externalfigure[tikz.tmp]}
> >
> > \stoptext
>
> Hello,
>
> I've been playing a bit with the most simple tikz examples so far, but
> after I saw this example I got an impression that ConTeXt users might
> also want to see syntax like
>
> \starttikzpicture[optional options]{name}
> ...
> \stoptikzpicture
>
> \usetikzpicture{name}
>
> in addition to the existing one, which would then be equivalent to
> syntax of including metapost graphics. There are dozens of other
> \start[whatever] commands defined in the module, but I have no idea
> what all of them do. Perhaps \startpgfpicture might be another command
> worth considering, but I have no idea about the rest.
Maybe commands along the line of metapost (so that everything is
easier to remeber)
\startreusablePGFgraphic
\startusablePGFgraphic
\startPGFcode
\startstaticPGFfigure ;)
and
\usePGFgraphic, \reusePGFgraphic, etc.
For proper integration, there should also be a mechanism to pass
\overlayheight and \overlaywidth to the pgfpicture, so that the
pgfpicture can use it.
I am just curious, does everyone use pgf for standalone graphic or has
someone also tried to use it with \framed[background=...], which works
for the most simple cases.
Aditya
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-01-10 20:08 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-09 16:42 placing a tikz/pgf figure M.J. Kallen
2007-01-09 18:15 ` Willi Egger
2007-01-09 19:26 ` Hans Hagen
2007-01-09 22:51 ` Aditya Mahajan
2007-01-09 23:26 ` Mojca Miklavec
2007-01-10 20:08 ` Willi Egger
2007-01-10 0:21 ` Mojca Miklavec
2007-01-10 1:08 ` Aditya Mahajan
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).