1

I want to use \usetikzlibrary{intersections}

enter image description here

\documentclass[a4paper]{article}
    \usepackage{amsmath,amsfonts,amssymb}
    \usetikzlibrary{intersections,shapes}
    \usepackage{esvect}
    \usepackage{tikz}
    \begin{document}
\begin{tikzpicture}[scale=1]
%\draw [color=gray,help lines, step=.5] (-1.3,-1.3) grid (5.3,5.3);

\draw[-stealth ] (-1.3,0) -- (5.3,0) node[below] {\footnotesize $x$};
\draw[-stealth ](0,-1.3) -- (0,5.3) node[left] {\footnotesize $y$};
\draw (0pt,-10pt) node[left] {\footnotesize $0$};
\draw[ dashed] (0,1.9 )node[ left]{\footnotesize $f(b)$} -| (1.144,0)
node[below]{\footnotesize $b$} ;
\draw[ dashed] (0,3.1928)node[ left]{\footnotesize $f(a)$} -| (3.2 ,0)
node[ below]{\footnotesize $a$} ;
\pgfsetstrokecolor{rgb,1:red,1;green,0;blue,0}
\pgfsetlinewidth{1pt} 
\pgfsetroundjoin \pgfpathmoveto{\pgfxy(0.582,0.7937)}
\pgfpathcurveto{\pgfxy(0.863,1.4009)}{\pgfxy(1.144,2.0082)}{\pgfxy(1.5608,2.328)}
\pgfpathcurveto{\pgfxy(1.9777,2.6479)}{\pgfxy(2.5303,2.6802)}{\pgfxy(2.9365,2.9365)}
\pgfpathcurveto{\pgfxy(3.3427,3.1928)}{\pgfxy(3.6026,3.6731)}{\pgfxy(3.8624,4.1534)}
\pgfstroke
\end{tikzpicture}%
\end{document}
  • Please forgive if I have missed your question... but what is your question? – darthbith Sep 26 '15 at 12:08
  • how do use commande intersections – HB khaled Sep 26 '15 at 12:15
  • 1
    @khaledhariz, your image is drawn with pure pgfs. As far as know, library intersection work with TikZ macros. Draw your curve and lines which intersect it with draw macro, give the names to curve and line and then look for intersection. – Zarko Sep 26 '15 at 12:32
  • So we can not use intersection, except in the case of function name . the curve drawing using texgraph – HB khaled Sep 26 '15 at 12:39
2

Hi Khaled you can name your paths with name path=patha, name path=pathb. then to find coordinate for intersection of patha and pathb with name intersections={of=patha and pathb}. where intersections are named intersection-1, intersection-2,... and so on.

Code

\documentclass[a4paper]{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{esvect}
\usepackage{tikz}
\usetikzlibrary{intersections}

\begin{document}
\begin{tikzpicture}[>=stealth]
\draw[->](-1.3,0) -- (5.3,0) node[below] {\footnotesize $x$};
\draw[->](0,-1.3) -- (0,5.3) node[left] {\footnotesize $y$};
\node[below left]at(0,0) {\footnotesize $0$};
\draw[red,line width=1pt,name path=plot](0.5,0.5)..controls(1,3)and(3,2)..(4,4.5);
\node[below](a)at(1.2,0){$a$};
\node[below](b)at(3,0){$b$};
\path[name path=froma](a)--+(0,4);
\path[name path=fromb](b)--+(0,4);
\draw[dashed,name intersections={of=froma and plot}](a)--(intersection-1)--(0,0|-intersection-1)node[left]{f(a)};
\draw[dashed,name intersections={of=fromb and plot}](b)--(intersection-1)--(0,0|-intersection-1)node[left]{f(b)};
\end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.