Graphics, Figures & TablesPGF and TikZ

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

PGF and TikZ

Post by ghostanime2001 »

How can I put a \draw command inside the curly braces of a circular node? I want to draw a shape with the \draw command inside the node so How can I do that?

Code: Select all

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri}
\begin{document}
\begin{tikzpicture}
\path (0,0) node [shape=circle,draw] {}
\end{tikzpicture}
\end{document}
Last edited by ghostanime2001 on Mon Jul 04, 2011 2:39 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: PGF and TikZ

Post by localghost »

If you give a visual example of what you are after, it would be much more helpful. Add a sketch if necessary.


Thorsten
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

PGF and TikZ

Post by ghostanime2001 »

By curly braces i mean this line
\path (0,0) node [shape=circle,draw] {}
.

I want to make a shape inside the circle but the curly braces
{}
only allow text or is there some way of modifying to allow shape drawing too?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

PGF and TikZ

Post by localghost »

I know what curly braces are. You shall give a visual example of the resulting output you have in mind. Something that we can look at to reproduce it.
frederic
Posts: 9
Joined: Mon Jun 27, 2011 7:25 pm

PGF and TikZ

Post by frederic »

I think this is what you are looking for: You want to insert tikz code inside the braces that define the node content. To do this, create a tikzpicture (with begin{tikzpicture} and \end{tikzpicture} within the braces. Another way, shorter, is to use the \tikz command (as in my example). Keep in mind that the coordinates defined within this embedded picture are not linked to the initial tikzpicture, they are local.

The example is

Code: Select all

\begin{tikzpicture}

\node[rectangle,draw,inner sep=5pt,fill=blue] (example) {\tikz{\draw[fill=red] (0,0) circle[radius=1cm];}};

\end{tikzpicture}
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: PGF and TikZ

Post by ghostanime2001 »

that's exactly what I was looking for. Sometimes the manual explicitly say that its for text but don't say that it can also embed a graphic inside a graphic -_-'
Post Reply