![tikzpicture 中 dim 的颜色](https://linux22.com/image/432883/tikzpicture%20%E4%B8%AD%20dim%20%E7%9A%84%E9%A2%9C%E8%89%B2.png)
我想做各种关于泰勒斯的练习。改变字母 ABCDEF 和距离可以做新的练习。
\documentclass[border=5pt]{standalone}
\standaloneenv{my}
\usepackage{tkz-euclide}
\usepackage{pgf,tikz,tkz-tab,pgfplots,tkz-fct,tikz-3dplot,rotating}
\usetikzlibrary{angles,arrows,arrows.meta,backgrounds,calc,decorations, decorations.markings,decorations.pathmorphing, decorations.text,fit,intersections, patterns,positioning,shapes,shapes.misc,through,tikzmark}
\usepackage[locale=FR,exponent-product = \cdot,per-mode=fraction,round-mode=places,round-precision=1]{siunitx}
\begin{document}
%%% THALES OEF 1
\begin{my}
\begin{tikzpicture}
\tkzInit[xmax=15,ymax=9]
%\tkzClip
%\tkzGrid
\newcommand\puntA{A}
\newcommand\puntB{B}
\newcommand\puntC{C}
\newcommand\puntD{D}
\newcommand\puntE{E}
\newcommand\puntF{F}
\newcommand\hoekEvenwijdigen{0}
%onderste lijn
\tkzDefPoints{1/1/L1}
\tkzDefShiftPoint[L1](\hoekEvenwijdigen:14){LL1}
\tkzDefBarycentricPoint(L1=6,LL1=1) \tkzGetPoint{\puntA}
\tkzDefBarycentricPoint(L1=1,LL1=7) \tkzGetPoint{\puntD}
%bovenste lijn
\tkzDefShiftPoint[L1](90:5){L3}
\tkzDefLine[parallel=through L3](L1,LL1) \tkzGetPoint{LL3}
\tkzDefBarycentricPoint(L3=6,LL3=4) \tkzGetPoint{\puntC}
\tkzDefBarycentricPoint(L3=6,LL3=7) \tkzGetPoint{\puntF}
%middelste lijn
\tkzDefShiftPoint[L1](90:3){L2}
\tkzDefLine[parallel=through L2](L1,LL1) \tkzGetPoint{LL2}
%bepalen snijpunten
\tkzInterLL(\puntA,\puntC)(L2,LL2) \tkzGetPoint{\puntB}
\tkzInterLL(\puntD,\puntF)(L2,LL2) \tkzGetPoint{\puntE}
%tekenen van de evenwijdigen
\tkzDrawLines(L1,LL1 L3,LL3 L2,LL2)
%snijlijnen tekenen
\tkzDrawLines(\puntA,\puntC)
\tkzDrawLines(\puntD,\puntF)
%% Benoemen van de punten
\tkzDrawPoints(\puntA,\puntB,\puntC,\puntD,\puntE,\puntF)
\tkzLabelPoints(\puntA,\puntB,\puntC,\puntD,\puntE,\puntF)
%BEPALEN VAN DE LENGTEN
\tkzCalcLength[cm](\puntA,\puntB)\tkzGetLength{AB}
\tkzCalcLength[cm](\puntB,\puntC)\tkzGetLength{BC}
\tkzCalcLength[cm](\puntA,\puntC)\tkzGetLength{AC}
\tkzCalcLength[cm](\puntD,\puntE)\tkzGetLength{DE}
\tkzCalcLength[cm](\puntE,\puntF)\tkzGetLength{EF}
\tkzCalcLength[cm](\puntD,\puntF)\tkzGetLength{DF}
\tkzLabelSegment(\puntA,\puntB){\small \num{\AB}}
\tkzLabelSegment(\puntB,\puntC){\small \num{\BC}}
\tkzLabelSegment(\puntD,\puntE){\small \num{\DE}}
\tkzLabelSegment(\puntE,\puntF){\small \num{\EF}}
\tkzDrawSegment[dim={\num{\AC},30pt,transform shape}](\puntA,\puntC)
\tkzDrawSegment[dim={\num{\DF},30pt,transform shape}](\puntF,\puntD)
\end{tikzpicture}
\end{my}
\end{document}
但是,我想更改 AC 和 DF 附近的线条和文本的颜色。我不知道该怎么做。
答案1
两个变化
*标签 DEF 未正确对齐——代码编辑如下
\tkzLabelPoints[below left](\puntD,\puntE,\puntF)
*用于调暗空调
选择 A 上方与 A 成直角的点 A1
\tkzDefPointWith[orthogonal normed](\puntA,\puntC) \tkzGetPoint{A1}
从 A 到 A1 画一条细的红色垂直线
\draw[thin,red,densely dashed](\puntA) -- (A1);
选择 C 上方与 C 成直角的点 C1
\tkzDefPointWith[orthogonal normed, K=-1](\puntC,\puntA) \tkzGetPoint{C1}
从 C 到 C1 画一条细红色垂直线
\draw[thin,red,densely dashed](\puntC) -- (C1);
定义一个点 x,它位于 A 和 A1 之间 70% 的位置
\tkzDefBarycentricPoint(\puntA=3,A1=7)\tkzGetPoint{x}
定义一个点 y,它位于距离 C 70% 处,朝向 C1
\tkzDefBarycentricPoint(\puntC=3,C1=7)\tkzGetPoint{y}
从点 x 到点 y 绘制一条绿色尺寸线,尺寸位于中间
\draw[green!50!red!70,thin,Stealth-Stealth](x) -- node[midway, fill=white,sloped]{$\puntA,\puntC$}(y);
结果
完成 MWE
\documentclass[border=5pt]{standalone}
\standaloneenv{my}
\usepackage{tkz-euclide}
\usepackage{pgf,tikz,tkz-tab,pgfplots,tkz-fct,tikz-3dplot,rotating}
\usetikzlibrary{angles,arrows,arrows.meta,backgrounds,calc,decorations, decorations.markings,decorations.pathmorphing, decorations.text,fit,intersections, patterns,positioning,shapes,shapes.misc,through,tikzmark}
\usepackage[locale=FR,exponent-product = \cdot,per-mode=fraction,round-mode=places,round-precision=1]{siunitx}
\begin{document}
%%% THALES OEF 1
\begin{my}
\begin{tikzpicture}
\tkzInit[xmax=15,ymax=9]
%\tkzClip
%\tkzGrid
\newcommand\puntA{A}
\newcommand\puntB{B}
\newcommand\puntC{C}
\newcommand\puntD{D}
\newcommand\puntE{E}
\newcommand\puntF{F}
\newcommand\hoekEvenwijdigen{0}
%onderste lijn
\tkzDefPoints{1/1/L1}
\tkzDefShiftPoint[L1](\hoekEvenwijdigen:14){LL1}
\tkzDefBarycentricPoint(L1=6,LL1=1) \tkzGetPoint{\puntA}
\tkzDefBarycentricPoint(L1=1,LL1=7) \tkzGetPoint{\puntD}
%bovenste lijn
\tkzDefShiftPoint[L1](90+\hoekEvenwijdigen:5){L3}
\tkzDefLine[parallel=through L3](L1,LL1) \tkzGetPoint{LL3}
\tkzDefBarycentricPoint(L3=6,LL3=4) \tkzGetPoint{\puntC}
\tkzDefBarycentricPoint(L3=6,LL3=7) \tkzGetPoint{\puntF}
%middelste lijn
\tkzDefShiftPoint[L1](90+\hoekEvenwijdigen:3){L2}
\tkzDefLine[parallel=through L2](L1,LL1) \tkzGetPoint{LL2}
%bepalen snijpunten
\tkzInterLL(\puntA,\puntC)(L2,LL2) \tkzGetPoint{\puntB}
\tkzInterLL(\puntD,\puntF)(L2,LL2) \tkzGetPoint{\puntE}
%tekenen van de evenwijdigen
\tkzDrawLines(L1,LL1 L3,LL3 L2,LL2)
%snijlijnen tekenen
\tkzDrawLines(\puntA,\puntC)
\tkzDrawLines(\puntD,\puntF)
%% Benoemen van de punten
\tkzDrawPoints(\puntA,\puntB,\puntC,\puntD,\puntE,\puntF)
\tkzLabelPoints(\puntA,\puntB,\puntC)
\tkzLabelPoints[below left](\puntD,\puntE,\puntF)
%BEPALEN VAN DE LENGTEN
\tkzCalcLength[cm](\puntA,\puntB)\tkzGetLength{AB}
\tkzCalcLength[cm](\puntB,\puntC)\tkzGetLength{BC}
\tkzCalcLength[cm](\puntA,\puntC)\tkzGetLength{AC}
\tkzCalcLength[cm](\puntD,\puntE)\tkzGetLength{DE}
\tkzCalcLength[cm](\puntE,\puntF)\tkzGetLength{EF}
\tkzCalcLength[cm](\puntD,\puntF)\tkzGetLength{DF}
\tkzLabelSegment(\puntA,\puntB){\small \num{\AB}}
\tkzLabelSegment(\puntB,\puntC){\small \num{\BC}}
\tkzLabelSegment(\puntD,\puntE){\small \num{\DE}}
\tkzLabelSegment(\puntE,\puntF){\small \num{\EF}}
\tkzDefPointWith[orthogonal normed](\puntA,\puntC) \tkzGetPoint{A1}
\draw[thin,red,densely dashed](\puntA) -- (A1);
\tkzDefPointWith[orthogonal normed, K=-1](\puntC,\puntA) \tkzGetPoint{C1}
\draw[thin,red,densely dashed](\puntC) -- (C1);
\tkzDefBarycentricPoint(\puntA=3,A1=7)\tkzGetPoint{x}
\tkzDefBarycentricPoint(\puntC=3,C1=7)\tkzGetPoint{y}
\draw[green!50!red!70,thin,Stealth-Stealth](x) -- node[midway, fill=white,sloped]{\small \num{\AC}}(y);
\tkzDefPointWith[orthogonal normed,K=-1](\puntD,\puntF) \tkzGetPoint{D1}
\draw[thin,red,densely dashed,](\puntD) -- (D1);
\tkzDefPointWith[orthogonal normed, ](\puntF,\puntD) \tkzGetPoint{F1}
\draw[thin,red,densely dashed](\puntF) -- (F1);
\tkzDefBarycentricPoint(\puntD=3,D1=7)\tkzGetPoint{d}
\tkzDefBarycentricPoint(\puntF=3,F1=7)\tkzGetPoint{f}
\draw[green!50!red!70,thin,Stealth-Stealth](d) -- node[midway, fill=white,sloped]{\small \num{\DF}}(f);
%\tkzDrawSegment[dim={\num{\AC},30pt,transform shape}](\puntA,\puntC)
%\tkzDrawSegment[dim={\num{\DF},30pt,transform shape}](\puntF,\puntD)
\end{tikzpicture}
\end{my}
\end{document}