Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a diagram that needs some modifications. The mark for the right angle and the label of $\theta$ are not in the right places. The arc indicating $\angle ACB$ is not in the place. The lengths $x$ and $y$ for $\overline{PC}$ and $\overline{PB}$, respectively, are not in the right places. The line indicating the length of $\overline{BC}$ is shifted rightward from its correct position.

I would like $a + x$ to be typeset in the same direction as the line.

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}

\begin{tikzpicture}
\path (60:2.5) coordinate (A) (10:6) coordinate (B) (0:0) coordinate (C);
\draw (A)
-- (B) node [at start, above left]{$A$} node [midway, above]{$c$}
-- (C) node [at start, right]{$B$}
-- (A) node [at start, below]{$C$} node [midway, left]{$b$} -- cycle;
\coordinate (P) at ($(B)!(A)!(C)$);
\draw [dashed] (A) -- (P) node [below]{$P$} node [midway, right]{$h$} -- (C);
C -- node [midway, below]{$x$} -- P -- node [midway, below]{$y$} B;
\draw pic[draw, angle radius=2mm,"$\theta$",angle eccentricity=2] {angle = B--C--A};
\tkzMarkRightAngle(A,P,B);
\draw[|<->|] ($(B)!7mm!90:(C)$)--node[fill=white] {$x + y$} ($(C)!7mm!-90:(B)$);
\end{tikzpicture}

\end{document}
share|improve this question
1  
Mistake is in this line C -- node [midway, below]{$x$} -- P -- node [midway, below]{$y$} B;. You missed \draw at the start and all nodes should be (C)` (note parenthesis), (P) and (B). –  Harish Kumar Aug 30 at 22:54

1 Answer 1

up vote 5 down vote accepted

Try this:

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}

\begin{tikzpicture}
\path (60:2.5) coordinate (A) (10:6) coordinate (B) (0:0) coordinate (C);
\draw (A)
-- (B) node [at start, above]{$A$} node [midway, above]{$c$}
-- (C) node [at start, right]{$B$}
-- (A) node [at start, left]{$C$} node [midway, left]{$b$} -- cycle;
\coordinate (P) at ($(B)!(A)!(C)$);
\draw [dashed] (A) --node [midway, right]{$h$}(P)node [below]{$P$}-- (C);
\draw (C) -- node [midway, below]{$x$}(P) -- node [midway, below]{$y$} (B);
\draw pic[draw, angle radius=5mm,"$\theta$",angle eccentricity=1.5] {angle = B--C--A};
\tkzMarkRightAngle(A,P,B);
\draw[|<->|] ($(B)!7mm!90:(C)$)--node[fill=white,sloped] {$x + y$} ($(C)!7mm!-90:(B)$);
\end{tikzpicture}

\end{document}

The output now:

enter image description here

share|improve this answer
    
This is exactly the diagram that I wanted! –  user60254 Aug 31 at 18:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.