Is there a way to crop everything outside the bounding box?
I made some periodic pattern in TikZ but I wanna crop it outside some box. Just making a bounding box helps for the alignment but the pattern still repeats outside the box.
Simply use the
\clip macro or
\path [clip] and draw your bounding box, e.g. using
\clip (lower left coordinate) rectangle (upper right coordinate). You can access the bounding box of everything drawn so far using the
current bounding box shape:
\clip (current bounding box.south west) rectangle (current bounding box.north east);. You need to do so before you apply the pattern, I think.
If you already use
\useasboundingbox or the equivalent
\path [use as bounding box] then you can simply add the
clip option to it.
If you only want to clip some drawing commands place them with the
\clip into a