7

The following code instructs TikZ to draw an obtuse triangle. Except for the placement of the letter "C" in the diagram, the diagram is drawn correctly. I want to move the letter "C" downwards a little more so that it is not on the triangle.

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

\begin{document}

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

\end{document}
user60254
  • 851

2 Answers2

10

Use the key yshift=:

output

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

\begin{document}

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

\end{document}
Sean Allred
  • 27,421
4

You are giving the key below,left which tikz takes only as left (the latest key). It should be below left without , in the middle. So

node [at start, below left]{$C$}

would give you

enter image description here

You can also use just below (which is better than left). If you want absolute control, you may use

below left=below length and left length

like

below left=0mm and -1mm

Code:

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

\begin{document}

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

\end{document}

enter image description here

  • Using "below left" is fine. Thanks. Why doesn't TikZ compile the optional command "left below"? Is "below below left" an option? – user60254 Aug 31 '14 at 23:15
  • 1
    @user60254 left below and below below left are not defined and hence are not possible. –  Aug 31 '14 at 23:27