稍微移动节点

稍微移动节点

以下代码指示 TikZ 绘制一个钝角三角形。除了图中字母“C”的位置外,该图绘制正确。我想将字母“C”向下移动一点,使其不在三角形上。

\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}

答案1

使用密钥yshift=

输出

\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}

答案2

below,left你给出的密钥tikz只接受 as (最新密钥)。中间left应该below left没有。所以,

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

会给你

在此处输入图片描述

你也可以使用 just below(这比 更好left)。如果你想要绝对控制,你可以使用

below left=below length and left length

喜欢

below left=0mm and -1mm

代码:

\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}

在此处输入图片描述

相关内容