I have the following code
\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
bla bla bla
\begin{tikzpicture}
\def\r{1}; % radius
\def\a{80}; % 1st angle
\def\b{170} % 2nd angle
\pgfmathsetmacro\px{\r/cos(\a)}
\pgfmathsetmacro\qy{\r/cos(\b-90)}
\coordinate (p) at (\px,0);
\coordinate (p1) at (2*\a:\px);
\coordinate (p2) at (-2*\a:\px);
\coordinate (q1) at (0,\qy);
\coordinate (q2) at (2*\b-90:\qy);
\path[name path=lineup] (p)-- (p1);
\path[name path=linedown] (p)-- (p2);
\path[name path=lineleft] (q1)-- (q2);
\draw[name intersections={of=lineup and lineleft,by={r1}}];
\draw[name intersections={of=linedown and lineleft,by={r2}}];
\draw (0,0) circle [radius=\r];
\draw (0,0) -- (\a:\r);
\draw (0,0) -- (-\a:\r);
\draw (0,0) -- (\b:\r);
\draw (p) -- (r1) -- (r2) -- cycle;
\end{tikzpicture}
bla bla bla
\end{document}
which gives me the following picture.
As you can see there is a lot of empty space above and below the triangle. This comes from the fact that the left corners (r1 and r2 in the code) of the triangle are intersection of virtual line segments (lineup, linedown and lineleft in the code).
Question: How can I ask Tikz to ignore these virtual line segments when computing the size of the window? I tried to do something with \clip, but I was not successful.
Note that my picture depends on three parameters \r, \a and \b, which I define at the beginning of the tikzpicture. I don't want to have a clip with some arbitrary value which would correspond only to a specific choice of parameters.
overlay
and other options related to "bounding box".use as bounding box
: tex.stackexchange.com/q/43621/1952\pgfresetboundingbox
placed before\draw (p) -- (r1) -- (r2) -- cycle;
makes it. You might want to post it as an answer in order to get the credit. Otherwise I'll write the answer myself later to not let an unanswered question.\clip
ping only clips what comes after it (in the current scope/group).