이미지와 같은 따옴표(BA 및 CA)를 추가하는 방법은 무엇입니까?
내 코드:
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[scale=.28]
%Definindo os vertices
\tkzDefPoint (0,0){B}
\tkzDefPoint (9,0){C}
\tkzDefPoint (14.5,10.66){A}
\tkzDefPoint (4.83,3.55){E}
\tkzDefPoint (10.83,3.55){D}
%Desenhando as retas
\draw (B) -- node[below] {$9$} (C) -- node[right] {$12$} (A) --
node[above left] {$18$} cycle;
\draw (E) -- node[below] {$6$} (D);
%Labels
\node (1) [label=above:{A}] at (A) {};
\node (2) [label=left:{B}] at (B) {};
\node (3) [label=right:{C}] at (C) {};
\node (4) [label=left:{E}] at (E) {};
\node (5) [label=right:{D}] at (D) {};
\end{tikzpicture}
\end{document}
내 결과:
답변1
순수한 tikz
솔루션. 가장자리 라벨의 경우 라이브러리가 사용됩니다 quotes
.
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, calc, quotes}
\begin{document}
\begin{tikzpicture}[scale=0.5,
auto = right,
measure/.style = {very thin,
{Bar[width=2.2mm]Straight Barb[]}-%
{Straight Barb[]Bar[width=2.2mm]},
},
every label/.append style = {font=\footnotesize}
]
%Definindo os vertices
\coordinate[label=left:$B$] (b) at (0,0);
\coordinate[label=right:$C$] (c) at (9,0);
\coordinate[label=$A$] (a) at (14.5,10.66);
\coordinate[label=left:$E$] (e) at (4.83,3.55);
\coordinate[label=right:$D$] (d) at (10.83,3.55);
%Desenhando as retas
\draw[blue] (a) -- (b) -- (c) -- cycle;
\draw[blue] (b) to ["$9$"] (c)
(e) to ["$6$"] (d);
\draw[measure] ($(a)!10mm!-90:(b)$) to [sloped,"$18$"] ($(b)!10mm! 90:(a)$);
\draw[measure] ($(a)!10mm! 90:(c)$) to [sloped,"$12$"] ($(c)!10mm!-90:(a)$);
\end{tikzpicture}
\end{document}