ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* tikz picture is placed align left-upper corner
@ 2011-05-03 11:48 Gao Ya'nan
  2011-05-03 12:47 ` Aditya Mahajan
  0 siblings, 1 reply; 2+ messages in thread
From: Gao Ya'nan @ 2011-05-03 11:48 UTC (permalink / raw)
  To: ntg-context

I draw a figure by tikz but found it is not in the middle but a little
left of the page, and then I wrote a piece code and impoved my view.

And I tried to add some parameters to put the figure in the middle but failed.

Thanks for any tips and test code is below.

\usemodule[tikz]
\usetikzlibrary[positioning, shapes, shadows, arrows]
\usetikzlibrary[backgrounds]

\starttext

\placefigure[here][fig:pci]{PCI System}{
\framed{
\hbox{
	\tikzstyle{abstract}=[rectangle, draw=black, rounded corners,
fill=blue!40, drop shadow, text=white, font=\small]
	\tikzstyle{cache}=[rectangle, draw=black, rounded corners,
fill=green, drop shadow, text=white, font=\small]

	\starttikzpicture[background rectangle/.style={draw=blue}, framed]
		\draw[help lines] (-5, -4) grid (5, 1);

		\node (Processor) [abstract, rectangle split, rectangle split parts=2]
			{
				{Processor}
				\nodepart{second}Cache
			};

		\node (AuxNode01) [below=of Processor] {};
		\node (Coherency) [cache, left=of AuxNode01]
			{
				{Cache Coherency}
			};
		\node (L2-Cache) [cache, right=of AuxNode01]
			{
				{Cache}
			};
	\stoptikzpicture
	}
	}
}
\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: tikz picture is placed align left-upper corner
  2011-05-03 11:48 tikz picture is placed align left-upper corner Gao Ya'nan
@ 2011-05-03 12:47 ` Aditya Mahajan
  0 siblings, 0 replies; 2+ messages in thread
From: Aditya Mahajan @ 2011-05-03 12:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 3 May 2011, Gao Ya'nan wrote:

> I draw a figure by tikz but found it is not in the middle but a little
> left of the page, and then I wrote a piece code and impoved my view.
>
> And I tried to add some parameters to put the figure in the middle but failed.

Does this 
http://archive.contextgarden.net/message/20090722.010815.d9c051d3.en.html
help.

>
> \placefigure[here][fig:pci]{PCI System}{
> \framed{

Also, in TeX you have to be careful about trailing whitespaces. It is 
better to use

\framed{%

or

\framed
    {....

and the same for \hbox etc.


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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-03 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-03 11:48 tikz picture is placed align left-upper corner Gao Ya'nan
2011-05-03 12:47 ` 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).