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.

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.

share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

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 scope environment. 

share|improve this answer
    
Thanks exactly what I needed. –  Marcel Apr 12 '11 at 23:44
add comment

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.