3

I draw this triangle with tikz,

\begin{tikzpicture}[scale=3]
    \draw (0.6,0.8) coordinate(A) node[above]{z} -- (-0.87,-0.5) coordinate(B) node[below]{x}--(0.87,-0.5) coordinate(C) node[below]{y}--(0.6,0.8) coordinate(A) node[above]{z};
    \draw (0,-0.5) coordinate(D) node[below]{m};
   \draw (D)--(A);
  \end{tikzpicture}

but I want to added the signe // on [m,y] and [x,m]

How to do please thank you.

1

2 Answers 2

2

There are dedicated packages for that like tkz-euclide but it is very easy to build your own.

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[scale=3,pics/par/.style={code={
  \draw (-0.2,-0.3) -- ++ (0.2,0.6) (0,-0.3) -- ++ (0.2,0.6);}}]
    \draw (0.6,0.8) coordinate(A) node[above]{z} -- (-0.87,-0.5) coordinate(B)
     node[below]{x}--(0.87,-0.5) coordinate(C) node[below]{y}--(0.6,0.8)
     coordinate(A) node[above]{z};
    \draw (0,-0.5) coordinate(D) node[below]{m};
    \path (B) -- pic {par} (D) --  pic {par}(C);
   \draw (D)--(A);
  \end{tikzpicture}
\end{document}

enter image description here

You may shorten the code to

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[scale=3,pics/par/.style={code={
  \draw (-0.2,-0.3) -- ++ (0.2,0.6) (0,-0.3) -- ++ (0.2,0.6);}}]
    \draw (0.87,-0.5) coordinate[label=below:$y$](y)
    -- (0.6,0.8) coordinate[label=above:$z$](z)
    -- (-0.87,-0.5) coordinate[label=below:$x$](x)
     -- coordinate[label=below:$m$] (m) cycle pic[pos=0.25]{par} pic[pos=0.75]{par} 
     (m) -- (z);
\end{tikzpicture}
\end{document}

enter image description here

where the coordinates have the names indicated by their labels.

Needless to say that there are tons of alternatives beyond the above-mentioned tkz-euclide such as decorations.markings and so on. The point of this post is that you do not necessarily need stuff beyond plain TikZ, and the pic a very simple option that can be easily customized. You can also slope is using the sloped key, but here it is not needed.

1
  • thank you very much
    – user201899
    Dec 30, 2019 at 19:16
5

Schrödinger's cat is right. tkz-euclide is a dedicated package for geometry euclidean drawing. Update : I created several different marks and s|| gives the good result.

\documentclass[border=.25cm]{standalone}
\usepackage{tkz-euclide}

\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/A,6/0/B,2/5/C}
\tkzDrawPolygon(A,B,C)
\tkzDefMidPoint(A,B)\tkzGetPoint{M}
\tkzDrawSegment(C,M)
\tkzMarkSegments[mark=s||](A,M M,B)
\tkzLabelPoints(A,B,M)
\tkzLabelPoints[above](C)
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.