TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Forgive me for my perhaps naive questions, I am beginning to discover Tikz potentials. To ease certain operations as moving objects or transforming them, I want to know if there is a mechanism in Tikz that I can group certain operations and give a name to this grouping and use that name in doing operations on the whole collection of objects that are grouped. My first guess was perhaps scope will do this. But could not see how I can refer collectively to the scoped operations and/or objects. The best analogy, for give me to mention it, is the grouping operation in Power Point. Thanks for your help. Artimess

share|improve this question

You can apply transformations to a scope, like for example:

        \draw (-1,-1) rectangle (1,1);
        \draw (0,0) circle (1);

Whatever parameters and operations you specify in the [...] at the beginning of the scope environment is applied to every command inside the scope.

share|improve this answer
I do not think that it answers OP's question. The scope is not named - no possibility to reuse it later. – Hans-Peter E. Kristiansen Jun 2 '14 at 7:49

TikZ 3.0 introduced a new concept called pic. It's possible to include complex drawing commands inside a pic and later use it as a whole. A little example with Caramdir's code:

    mycomplexfigure/.pic = {
        \draw (-1,-1) rectangle (1,1);
        \draw (0,0) circle (1);
\path  (1,3) pic{mycomplexfigure};
\path[red,rotate=45,transform shape]  (2,1) pic{mycomplexfigure};

enter image description here

Some more examples with .pic:

share|improve this answer

tikzpicture envionments can be nested. They behave like scope environments and support optional arguments for parameters. For instance, \begin{tikzpicture}[scale=0.5, transform shape] ... \end{tikzpicture} could be used inside a parent tikzpicture environment.

share|improve this answer
I know that this works, but is it meant to work? I ask because in another question (which escapes me now), an answer was to nest tikz pictures but when I experimented then I found that the inner and outer pictures didn't properly know about each other (in particular, node names and co-ordinates couldn't be guaranteed to work). – Loop Space Aug 16 '10 at 19:30
I used it but don't remember problems. But I wished also tikz matrices could be nested. – Stefan Kottwitz Aug 16 '10 at 20:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.