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.

I wonder why my callout pointer is pointing at the wrong direction. It should point towards the coordinate (-2,1). What am I doing wrong here?

\documentclass[tikz]{standalone}

\usepackage{kpfonts}
\usepackage{tkz-fct}
\usetkzobj{all}
\usetikzlibrary{shapes.callouts} 


\begin{document}

\begin{tikzpicture}[>=stealth', remember picture, note/.style={rectangle callout, fill=#1}]
\tkzInit[xmin=-2.5,xmax=1.75,ymin=-0.5,ymax=2.7,xstep=1,ystep=1]
\tkzAxeXY
\tkzFct [<-,style={draw},domain=-2.3:-1,thick,outer sep=0pt] {(x+1)**2}
\tkzFct [domain=-1:0,thick] {2*x+2}
\tkzFct [domain=0:1,thick,outer sep=0pt] {2-x}
\tkzFct [->,domain=1:1.6,thick,outer sep=0pt] {x**2}
\tkzDefPoint(-1,0){A}
\tkzDefPoint(0,2){B}
\tkzDefPoint(1,1){C}
\tkzDrawPoints[size=3](A,B,C)
\tkzDefPoint(-2,1){D}
\tkzDefPoint(1.5,2.25){E}
\tkzDefPoint(-1.5,2){F}
\tkzDefPoint(0.75,2.3){G}
\tkzDrawSegments[very thin](D,F E,G)
%\tkzDrawPoint[size=3](C)
\node [above] at (G) {\scriptsize $y=x^2$};
\node [above, callout relative pointer={(-2,1)},rounded corners,note=green!50, opacity=.5, overlay] at (F) {\scriptsize $y=(x+1)^2$};
\end{tikzpicture}

\end{document}

enter image description here

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

There is a bug in the implementation that is patched by Daniel in his answer here callout and beamer

In the meantime you can fake it via

\documentclass[tikz]{standalone}

\usepackage{kpfonts}
\usepackage{tkz-fct}
\usetkzobj{all}
\usetikzlibrary{shapes.callouts,calc} 


\begin{document}

\begin{tikzpicture}[>=stealth', remember picture, note/.style={rectangle callout, fill=#1}]
\tkzInit[xmin=-2.5,xmax=1.75,ymin=-0.5,ymax=2.7,xstep=1,ystep=1]
\tkzAxeXY
\tkzFct [<-,style={draw},domain=-2.3:-1,thick,outer sep=0pt] {(x+1)**2}
\tkzFct [domain=-1:0,thick] {2*x+2}
\tkzFct [domain=0:1,thick,outer sep=0pt] {2-x}
\tkzFct [->,domain=1:1.6,thick,outer sep=0pt] {x**2}
\tkzDefPoint(-1,0){A}
\tkzDefPoint(0,2){B}
\tkzDefPoint(1,1){C}
\tkzDrawPoints[size=3](A,B,C)
\tkzDefPoint(-2,1){D}
\tkzDefPoint(1.5,2.25){E}
\tkzDefPoint(-1.5,2){F}
\tkzDefPoint(0.75,2.3){G}
\tkzDrawSegments[very thin](D,F E,G)
%\tkzDrawPoint[size=3](C)
\node [above] at (G) {\scriptsize $y=x^2$};
\node [above,rectangle callout, callout relative pointer={($(-2,1)-(F)$)},
rounded corners,note=green!50, opacity=.5, overlay] at (F) {\scriptsize $y=(x+1)^2$};
\end{tikzpicture}

\end{document}
share|improve this answer
    
BTW, just seen that the bug was already fixed with pgf 2.10-cvs. –  hpesoj626 Nov 6 '12 at 3:23
    
@hpesoj626 Oh, they've fixed many many peculiarities and added a lot of new goodies :) –  percusse Nov 6 '12 at 10:41
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.