Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I asked a lot of questions about nested tikzpicture environments and if I agree with Andrew and Martin that nesting TikZ pictures isn't a good idea, it's interesting to know why. I gave some examples where it looks possible to nest TikZ Pictures.

With this examples I discovered or created some useful macros like

  1. \begin{pgfinterruptboundingbox} \end{pgfinterruptboundingbox} here
  2. \useasboundingbox here
  3. \pgfinterruptpicture \endpgfinterruptpicture
  4. \ensuretikz by Martin here
  5. \restorefont created by Martin here
  6. \savecurrentboundingbox \restorecurrentboundingbox created by me here
  7. \tikzifinpicture here
  8. other

7) it's interesting because the definition is \pgfutil@ifundefined{filldraw}{#2}{#1}%.

These macros are useful to manage the bounding box and the font but perhaps other values are interesting to save and restore.

It's possible to look at the sources but it's not very easy for a lot of us. The aim of my question is to build reference answers to describe what are the variables set when tikz picture begins and what are the differences with a scope?

share|improve this question
    
My english is .. my english so it's not very fine. I think that It would be interesting if someone could correct and reformat my question. –  Alain Matthes Mar 4 '12 at 23:15
    
Could you please link some of the questions you refer to? –  Tobi Mar 5 '12 at 1:15
    
yes you are right I forgot the links –  Alain Matthes Mar 5 '12 at 4:52
1  
I'm glad you posted this question! (to whom it may concern) Although this is nominally asking for a "big list" and might not have a single correct answer, I'd like to argue strongly against the question being made CW as giving an answer will probably involve a fair bit of testing and work. It would be appropriate to have a single CW-answer that summarised the others for ease of reference. –  Loop Space Mar 5 '12 at 8:16
    
@AndrewStacey I've some difficulties to understand exactly your comment but I think I know what you suggest and I agree with you. how to do this? –  Alain Matthes Mar 5 '12 at 8:48

1 Answer 1

Differences between scopes and tikzpictures

  1. Mode of usage.

    A scope can be used only if already in "TikZ mode". A tikzpicture starts the "TikZ mode".

    The contents of a node is in text mode. How to typeset a picture inside a node?

  2. Preservation of bounding box.

    Summary: Scopes work hard to ensure that the bounding box of the scope is passed on correctly to the surrounding tikzpicture. A tikzpicture environment does not expect to be contained in another tikzpicture environment and so does not take sufficient care to ensure that the bounding box of the external environment is unaffected by the internal one.

    More information: See this answer to Problem with overlay when a tikzpicture is inside another tikzpicture

  3. Inheritance of baseline.

    Summary: The vertical position of a tikzpicture can be adjusted by setting the baseline option. This is done at the end of the picture and is done by setting a macro that is examined at the end (the delay is so that it can use a coordinate defined during the picture). This macro is not reset at the start of a picture so nested pictures inherit the setting from the outer picture.

    More Information: See TikZ: [baseline] interferes with blur shadow on background layer


Note about this answer: this answer is intended to be a summary of information about this matter. Please do not post detailed information here but link to it. However, please ensure that the information is on this site somewhere. So if it is in an existing answer, summarise it in this answer and link to the more detailed answer. If not, add a new answer to this question (not Community Wiki) with the details and add a summary here. This answer is Community Wiki to make it easy to add to. Other answers to this question need not be so.

share|improve this answer

Your Answer

 
discard

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.