# How to mark a Segment with an arrow in Tkz euclid with the \tkzMarkSegment

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{tikz}
\usepackage{tikz,tkz-base}
\usepackage{pgf,tikz, tkz-euclide}
\usetikzlibrary{arrows, calc,intersections, decorations.pathmorphing}
\usetkzobj{all}
\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}


• Do you mean that you just want an arrow pointing in the direction of the light beam into the prism? So just an arrow head on what's already there? – Christopher Mar 23 '15 at 19:11
• No I want an arrow in the middle of the line, on the place of the ||| – Arne Timperman Mar 23 '15 at 19:17
• Right, then see this answer which suggests that you can't do it just by writing [mark=>>] (which would be nice) but you have to create a custom style. – Thruston Mar 23 '15 at 19:18
• Thanks for this link, so it is not possible to adapt the option of the mark with the \tkzMarkSegment? – Arne Timperman Mar 23 '15 at 19:23
• You could create a dummy point in the middle and draw the line there which would work as a hack but the answer linked by @Thruston is the more elegant. – Christopher Mar 23 '15 at 19:25

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:

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-base, tkz-euclide}
\usetikzlibrary{arrows, calc,intersections, decorations.pathmorphing, decorations.markings}
\usetkzobj{all}
\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:

I've combined the advice of the others and put all together. (I'm not sure if this is the good way of doing this in this forum?)

\documentclass[a4paper]{article}
\usepackage{tikz,tkz-base,pgf,tkz-euclide}
\usetikzlibrary{arrows, calc,intersections, decorations.pathmorphing}
\usetkzobj{all}
\usepackage{pgfplots}

\tikzset{
arrowMe/.style={postaction=decorate,
decoration={markings, mark=at position .5 with {\arrow[thick]{#1}}
} }}

\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[fill=red!30](A,B,C);
\tkzInterLL(D,E)(A,C)  \tkzGetPoint{S};
\tkzDrawSegments(D,S);
\tkzDrawSegments[arrowMe=stealth](D,S);
\end{tikzpicture}
\end{center}
\end{document}