[Tex/LaTex] How to mark a Segment with an arrow in Tkz euclid with the \tkzMarkSegment

tkz-euclide

I want to draw a light beam on a prism. I've looked and I found that their are a couple of options, but none with an arrow. Any suggestions for doing this in tkz-euclide environment?

\documentclass[a4paper]{article} 
\usepackage{tkz-euclide}
\usetikzlibrary{arrows, calc,intersections, decorations.pathmorphing}
%\usetkzobj{all} no need with tkz-euclide v >3
\usepackage{pgfplots}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=0.7]
\tkzInit[ymin=0,ymax=7.5,xmin=0,xmax=14]
\tkzClip
%\tkzGrid
\tkzDefPoints{2/1/A, 12/1/B, 7/7/C, 1/4.5/D, 12/6.5/E}
\tkzDrawPolygon(A,B,C)
\tkzDrawPoints[size=2pt](A,B,C)
\tkzInterLL(D,E)(A,C)  \tkzGetPoint{S}
\tkzDrawSegments(D,S)
\tkzMarkSegments[mark=||](D,S)
\end{tikzpicture}
\end{center}    
\end{document}

enter image description here

Best Answer

Maybe it's not quite you want (you didn't tell us where the arrow must be placed), but if you replace

\tkzDrawSegments(D,S)

by

\tkzDrawSegments[arrows=->](D,S)

you get an arrow at the end of the segment:

enter image description here

Edit As said in the comments, here is a way to put the arrow in the middle of the segment. (Using the decorations.markings marking library.)

\documentclass[a4paper]{article} 
\usepackage{tkz-euclide} %euclide loads base
\usetikzlibrary{arrows, calc,intersections, decorations.pathmorphing, decorations.markings}
%\usetkzobj{all} % inutile avec une version >= 3.01
\usepackage{pgfplots}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=0.7]
\tkzInit[ymin=0,ymax=7.5,xmin=0,xmax=14]
\tkzClip
%\tkzGrid
\tkzDefPoints{2/1/A, 12/1/B, 7/7/C, 1/4.5/D, 12/6.5/E}
\tkzDrawPolygon(A,B,C)
\tkzDrawPoints[size=2pt](A,B,C);
\tkzInterLL(D,E)(A,C)  \tkzGetPoint{S}
\begin{scope}[decoration={
    markings,
    mark=at position 0.5 with {\arrow{>}}}
    ] 
    \tkzDrawSegments[postaction={decorate}](D,S)
\end{scope}
\end{tikzpicture}
\end{center}    
\end{document}

Output:

enter image description here

Related Question