unnecessary white space in tikz picture after using \tkzInterLC[R]

After looking at the code, I think I can explain why this happens.

During the calculation of the intersections of a line AB and a circle, tkz-euclide, defines a coordinate that lies on a line that is normal to AB and the same distance away from the centre of the circle as the length of AB.

This coordinate is included in the bounding box, causing the problem. If you reduce the length of your line AB, you'll see that the white space above the figure shrinks.

A simple fix, borrowing from the answer Ludovic found, is to add

\makeatletter
\def\tkz@Projection(#1,#2)(#3)#4{%
\begingroup 
  \pgfpointdiff{\pgfpointanchor{#1}{center}}%
               {\pgfpointanchor{#2}{center}}%
  \tkz@ax =\pgf@y%
  \tkz@ay =\pgf@x%
  \begin{pgfinterruptboundingbox}
  \path[coordinate](#3)--++(-\tkz@ax,\tkz@ay) coordinate (tkz@point);
  \end{pgfinterruptboundingbox}
  \tkz@InterLL(#1,#2)(#3,tkz@point){#4}% définit tkzPointResult 
\endgroup
}
\makeatother

to the preamble, after \usepackage{tkz-euclide}. Complete code, and output below:

\documentclass[a4paper]{article}
\usepackage{tkz-euclide}
\makeatletter
\def\tkz@Projection(#1,#2)(#3)#4{%
\begingroup 
  \pgfpointdiff{\pgfpointanchor{#1}{center}}%
               {\pgfpointanchor{#2}{center}}%
  \tkz@ax =\pgf@y%
  \tkz@ay =\pgf@x%
  \begin{pgfinterruptboundingbox}
  \path[coordinate](#3)--++(-\tkz@ax,\tkz@ay) coordinate (tkz@point);
  \end{pgfinterruptboundingbox}
  \tkz@InterLL(#1,#2)(#3,tkz@point){#4}% définit tkzPointResult 
\endgroup
}
\makeatother
\usetkzobj{all}
\begin{document}

some text
\begin{center}
\begin{tikzpicture}
\coordinate (M) at (0,0) ;
\coordinate (B) at (-5,1.3) ;
\coordinate (C) at (5,1.3) ;
\draw (B) -- (C) node[below] {$a$};
\coordinate (A) at (canvas polar cs:angle=10,radius=2cm);
\tkzDrawCircle(M,A)
\draw (A) -- (M) node[midway,sloped,fill=white] {$r$};
\tkzInterLC(B,C)(M,A) \tkzGetPoints{E}{D};  
\tkzDrawPoints(A,D,E,M);  
\tkzLabelPoints(A,D,E,M); 

% the following draws the bounding box of the tikzpicture
\draw (current bounding box.south east) rectangle (current bounding box.north west);
\end{tikzpicture}
\end{center}

\end{document}

enter image description here


I found that several people got this "blank" stuff. Here is a simple solution: put the command

\pgfresetboundingbox

right after \tkzInterLC[R](B,C)(M,2cm) \tkzGetPoints{E}{D}. Thế reason is the command \tkzInterLC[R] make a new bounding box, namely the box surrounding the current picture. PS: pgfresetboundingbox is the most unclear command in TikZ. In some rare cases, it does not work as expected.