在 tikz 中添加倾斜标签

在 tikz 中添加倾斜标签

我在 Tikz 中绘制了以下内容。

在此处输入图片描述

使用以下代码

\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\coordinate[label= above left:$O$] (O) at (0,0);
\draw (O) circle (3);
\coordinate[label = below left:$P$] (P) at (-90:3);
\coordinate (Q) at (-25:3);
\node at ([shift = {(-30:3.3)}]O.-35) {$Q$};
\draw (O)-- (P)-- (Q) -- cycle;
\coordinate[label = right:$R$] (R) at (6.5,-3);
\draw (R)--(P)--(Q)--cycle;
\draw (O) -- ($(P)!(O)!(Q)$) node[draw,pos=1,sloped, anchor = north east]{}node[pos=1.08]{$T$};
\end{tikzpicture}
\end{document}

我现在想在线 QR 上方添加一个倾斜的标签,上面写着“24 厘米”,并为线 OT 添加一个倾斜的标签,上面写着“12 厘米”。

我想要这样的东西

在此处输入图片描述

编辑:我设法获得了倾斜的标签,但是如何才能获得如(糟糕的手绘)图像中的箭头呢?

我使用以下内容作为文本

\draw (Q) -- (R) node[sloped, anchor = south east, pos =0.5]{$24 cm$};

我怎样才能做到这一点?

答案1

无括号:

\documentclass{article}
\usepackage{tikz}
\usepackage{siunitx}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\coordinate[label= above left:$O$] (O) at (0,0);
\draw (O) circle (3);
\coordinate[label = below left:$P$] (P) at (-90:3);
\coordinate (Q) at (-25:3);
\node at ([shift = {(-30:3.3)}]O.-35) {$Q$};
\draw (O)-- (P)-- (Q) -- cycle;
\coordinate[label = right:$R$] (R) at (6.5,-3);
\draw (R)--(P)--(Q)-- node[above,sloped] {\SI{24}{\cm}}cycle;
\draw (O) -- ($(P)!(O)!(Q)$) node[draw,pos=1,sloped, anchor = north east]{}node[pos=1.08]{$T$} node[midway,above,sloped] {\SI{12}{\cm}};
\end{tikzpicture}
\end{document}

在此处输入图片描述

带牙套:

\documentclass{article}
\usepackage{tikz}
\usepackage{siunitx}
\usepackage{tkz-euclide}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\coordinate[label= above left:$O$] (O) at (0,0);
\draw (O) circle (3);
\coordinate[label = below left:$P$] (P) at (-90:3);
\coordinate (Q) at (-25:3);
\node at ([shift = {(-30:3.3)}]O.-35) {$Q$};
\draw (O)-- (P)-- (Q) -- cycle;
\coordinate[label = right:$R$] (R) at (6.5,-3);
\draw (R)--(P)--(Q)-- cycle;
\draw (O) -- ($(P)!(O)!(Q)$) coordinate (T) node[draw,pos=1,sloped, anchor = north east]{}node[pos=1.08]{$T$};
\draw[decorate,decoration={brace,raise=3pt}]
  (Q)  -- node[above=6pt,sloped] {\SI{24}{\cm}} (R);
\draw[decorate,decoration={brace,raise=3pt}]
  (O)  -- node[above=6pt,sloped] {\SI{12}{\cm}} (T);
\end{tikzpicture}
\end{document}

在此处输入图片描述

带有尺寸箭头:

\documentclass{article}
\usepackage{tikz}
\usepackage{siunitx}
\usepackage{tkz-euclide}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\coordinate[label= above left:$O$] (O) at (0,0);
\draw (O) circle (3);
\coordinate[label = below left:$P$] (P) at (-90:3);
\coordinate (Q) at (-25:3);
\node at ([shift = {(-30:3.3)}]O.-35) {$Q$};
\draw (O)-- (P)-- (Q) -- cycle;
\coordinate[label = right:$R$] (R) at (6.5,-3);
\draw (R)--(P)--(Q)-- cycle;
\draw (O) -- ($(P)!(O)!(Q)$) coordinate (T) node[draw,pos=1,sloped, anchor = north east]{}node[pos=1.08]{$T$};

\coordinate (aux1) at ( $ (Q)!7pt!90:(R) $ );
\coordinate (aux2) at ( $ (R)!7pt!-90:(Q) $ );

\coordinate (aux3) at ( $ (O)!7pt!90:(T) $ );
\coordinate (aux4) at ( $ (T)!7pt!-90:(O) $ );

\draw[|<->|,>=latex]
  (aux1)  -- node[fill=white,sloped] {\SI{24}{\cm}} (aux2);
\draw[|<->|,>=latex]
  (aux3)  -- node[fill=white,sloped] {\SI{12}{\cm}} (aux4);
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容