1

Here is an excerpt from my code:

\begin{tikzpicture}[scale=5.5]
    \coordinate[label=left:$A$]  (A) at (0,0);
    \coordinate[label=right:$B$]  (B) at (1,0);
    \coordinate[label=:$C$]  (C) at (0.5,0.866);
    \draw[] (A)--(B)--(C)--(A);
    \end{tikzpicture}

I want to denote AB=BC using the tick mark notation. Also, point C isn't exactly where it should be. How can I fix that? I rounded sqrt(3)/2 to 0.866. One last thing: I only want single tick marks.

  • 3
    Welcome to TeX.SE! Please show us -- as usual here --an short compilable code resulting in your issue ... – Mensch Jan 7 at 22:53
  • 3
    It would also be helpful if you could include a sketch of how the output should look like. – user36296 Jan 7 at 22:59
  • TikZ understands polar coordinates such as coordinate[label=:$C$] (C) at (60:1); It also understands coordinate[label=:$C$] (C) at (0.5,{sqrt(3)/2});. – marmot Jan 7 at 23:02
1

Welcome to TeX.SE! You can add these marks with decorations.markings. Since you want two of them, it is shorter to use the .list key for that. Further, TikZ understands polar coordinates, and it also understands (0.5,{sqrt(3)/2}), so there is no need to unbury your calculator. ;-)

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[scale=5.5,equal mark/.style={postaction={decorate,
decoration={markings,mark=at position #1 with {\draw (-2pt,-4pt) -- (-2pt,4pt);
\draw (2pt,-4pt) -- (2pt,4pt);}}}}]
    \coordinate[label=left:$A$]  (A) at (0,0);
    \coordinate[label=right:$B$]  (B) at (1,0);
    \coordinate[label=:$C$]  (C) at (60:1);
    \draw[equal mark/.list={1/6,1/2}] (A)--(B)--(C)--cycle;
\end{tikzpicture}
\end{document}  

enter image description here

As you can see, this code starts with \documentclass and ends with \end{document}, and is compilable.

And you may simplify/shorten the code using a \foreach loop.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[scale=5.5,equal mark/.style={postaction={decorate,
decoration={markings,mark=at position #1 with {\draw (-2pt,-4pt) -- (-2pt,4pt);
\draw (2pt,-4pt) -- (2pt,4pt);}}}}]
    \foreach \X/\Y in {210/A,-30/B,90/C} 
    {\coordinate[label=\X:$\Y$]  (\Y) at (\X:{1/sqrt(3)});}
    \draw[equal mark/.list={1/6,1/2,5/6}] (A)--(B)--(C)--cycle;
\end{tikzpicture}
\end{document}  
3

A PSTricks solution just for fun purposes.

\documentclass[pstricks,12pt,border=1cm]{standalone}
\usepackage{pst-eucl}
\begin{document}
\pspicture[MarkAngle=90](-4,4)
    \pstTriangle(4;150){C}(-4,0){A}(0,0){B}
    \pstSegmentMark{A}{B}
    \pstSegmentMark{B}{C}
\endpspicture
\end{document}

enter image description here

Bonus

\documentclass[pstricks,12pt,border=1cm]{standalone}
\usepackage{pst-eucl}
\begin{document}
\foreach \i in {90,100,...,170}{%
\pspicture[MarkAngle=90](-4,4)
    \pstTriangle(4;\i){C}(-4,0){A}(0,0){B}
    \pstSegmentMark{A}{B}
    \pstSegmentMark{B}{C}
\endpspicture}
\end{document}

enter image description here

2

one more tikz solution. for marks are used math symbol \| in nodes with option sloped placed on lines:

\documentclass[tikz,border=3.141592mm]{standalone}

\begin{document}
    \begin{tikzpicture}[scale=5.5]
\coordinate[label=left:$A$]     (A) at (0,0);
\coordinate[label=right:$B$]    (B) at (1,0);
\coordinate[label=$C$]          (C) at (0.5,0.866);
\draw (A) -- node {$\|$} (B) -- node[sloped] {$\|$} (C) -- (A);
    \end{tikzpicture}
\end{document}

now tikz version 3.1 in miktex works ...

enter image description here

  • The mark on BC is not perpendicular I think ( I compile with my heart). – Gold Digging Programmer Jan 8 at 1:17
  • 1
    @GodMustBeCrazy, of course not, i forgot to add option sloped ... i correct this. – Zarko Jan 8 at 1:21

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.