I've found the following How can I compute the distance between two coordinates in TikZ?. So, I know how to find the size of a TikZ picture as follows:


  \global\expandafter\edef\csname #3\endcsname{\FPMathLen pt}%%



  \coordinate (A) at (0,0);
  \coordinate (B) at (10,3);
  \draw (A) -- (B);

  \coordinate (PUL) at ($(current bounding box.north west)+(-1ex,1ex)$);
  \coordinate (PLR) at ($(current bounding box.south east)+(1ex,-1ex)$);
  \coordinate (PUR) at (PUL-|PLR);
  \coordinate (PLL) at (PUL|-PLR);
  \draw (PUL) rectangle (PLR);



Here's a rule the width of the picture:


Here's a rule the height of the picture:



What I'm curious about is whether isn't an easier way to go about this since all I'm interested in is the dimensions of the finished picture.

  • Box it and use \ht, \wd fot he box? Mar 23, 2014 at 18:16
  • @GonzaloMedina Well there's that too. But is there anything in TikZ that accomplishes the same?
    – A.Ellett
    Mar 23, 2014 at 18:17
  • 1
    @Jubobs How embarassing! I even commented on that post. Perhaps this should be closed as a duplicate question.
    – A.Ellett
    Mar 23, 2014 at 18:21
  • 1
    @A.Ellett I know :p I even hesitated linking to that question because you had commented on it, but heh, you're not expected to remember every single question or comment on the site. I'll vote to close this one as a duplicate.
    – jub0bs
    Mar 23, 2014 at 18:23
  • 1
    @Jubobs Well I'm glad you did comment because I like the method used in that example better than the method I'm using in this question.
    – A.Ellett
    Mar 23, 2014 at 18:24


Browse other questions tagged or ask your own question.