# A mistake in the code for drawing a line segment in a triangle

I think that this post should be discarded quickly. I have been reluctant to post it. (The code for this post is similar to the code that I posted about labels for nodes not being at the same distance from points.) I draw triangle ABC. I put point S halfway from A to B. I want to put a point T on BC so that the line through S and T is 30 degrees below the horizontal line through S. In the code, I issue the command \path[name path=ST] (S) --++ (-30:5); to do this. I get a line through S and C. If I replace -30 with -90, I get the same picture! What is wrong with the code?

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,intersections}

\begin{document}

\begin{tikzpicture}

\coordinate[label=225:$A$] (A) at (0,0);
\coordinate[label=90:$B$] (B) at (60:6);

%These commands position vertex C, label it C, and positions the label southeast of the vertex.
\path[overlay,name path=horizontal] (A) -- ++(10,0);
\path[overlay,name path=BC] (B) -- ($(B)!2!75:(A)$);
\path[name intersections={of= horizontal and BC, by=C}];
\coordinate[label={[blue]-45:$C$}] (blah-blah) at (C);

%This command draws the triangle.
\draw (A) -- (B) -- (C) -- cycle;

%This command draws the line segment from the midpoint S on AB to a point T on BC.
\coordinate (S) at ($(A)!0.5!(B)$);
\path[name path=ST] (S) --++ (-30:5);
\path[name intersections={of= ST and BC, by=T}];
\draw[dashed] (S) -- (T);

\end{tikzpicture}

\end{document}

• Try adding draw to your \path commands so you can see what is or is not happening. – cfr May 8 '15 at 1:59
• Do you want T to be on the line BC or on AC? From your picture I think you probably mean AC but in your code you ask for BC. The problem when you use -90 is that the line ST does not intersect the line BC. – Andrew May 8 '15 at 2:41

It's easy to see what happens if you use \draw[blue, name path=ST] (S) --++ (-30:5); instead of \path[name path=ST] (S) --++ (-30:5);

The line is too short and doesn't intersect BC. Just make it longer:

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,intersections}

\begin{document}

\begin{tikzpicture}

\coordinate[label=225:$A$] (A) at (0,0);
\coordinate[label=90:$B$] (B) at (60:6);

%These commands position vertex C, label it C, and positions the label southeast of the vertex.
\draw[green,overlay,name path=horizontal] (A) -- ++(10,0);
\draw[red, overlay,name path=BC] (B) -- ($(B)!2!75:(A)$);
\path[name intersections={of= horizontal and BC, by=C}];
\coordinate[label={[blue]-45:$C$}] (blah-blah) at (C);

%This command draws the triangle.
\draw (A) -- (B) -- (C) -- cycle;

%This command draws the line segment from the midpoint S on AB to a point T on BC.
\coordinate[label=above left:S] (S) at ($(A)!0.5!(B)$);
\draw[blue, name path=ST] (S) --++ (-30:15);
\path[name intersections={of= ST and BC, by=T}];
\draw[dashed] (S)  -- (T) node [above right]{$T$};

\end{tikzpicture}
\end{document}


• I had supposed that the line through S and T would intersect BC. Oops! Maybe, to my chagrin, I should keep the post. The common-sense advice to use \draw instead of \pat to see what is going on may be helpful to others. – Adelyn May 8 '15 at 14:43