带有 tikz 的引文

带有 tikz 的引文

如何像图片一样添加引号(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} 

相关内容