我想标记显示 AD=CE=BF、AC=DE 和 CB=EF。我在网站上搜索过但没能找到。这是我的代码;
\begin{tikzpicture}[line width=1.2pt]
\draw (0,0) rectangle (5,-5);
\draw (2,0)--(2,-5);
\fill[pattern = north east lines,pattern color=green] (0,0) rectangle (2,-5);
\fill[pattern = north east lines,pattern color=red] (2,0) rectangle (5,-5);
\node at (0,0) [circle,fill,inner sep=1pt]{};
\node at (5,0) [circle,fill,inner sep=1pt]{};
\node at (2,0) [circle,fill,inner sep=1pt]{};
\node at (0,-5) [circle,fill,inner sep=1pt]{};
\node at (2,-5) [circle,fill,inner sep=1pt]{};
\node at (5,-5) [circle,fill,inner sep=1pt]{};
\node[above] at (0,0){A};
\node[above] at (5,0){B};
\node[above] at (2,0){C};
\node[below] at (0,-5){D};
\node[below] at (2,-5){E};
\node[below] at (5,-5){F};
\end{tikzpicture}
提前感谢任何帮助和指导。
答案1
\documentclass[tikz, border=3pt]{standalone}
\usetikzlibrary{patterns}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}[line width=1.2pt]
\draw (0,0) rectangle (5,-5);
\draw (2,0)--(2,-5);
\fill[pattern = north east lines,pattern color=green] (0,0) rectangle (2,-5);
\fill[pattern = north east lines,pattern color=red] (2,0) rectangle (5,-5);
\node (A) at (0,0) [circle,fill,inner sep=1pt]{};
\node (B) at (5,0) [circle,fill,inner sep=1pt]{};
\node (C) at (2,0) [circle,fill,inner sep=1pt]{};
\node (D) at (0,-5) [circle,fill,inner sep=1pt]{};
\node (E) at (2,-5) [circle,fill,inner sep=1pt]{};
\node (F) at (5,-5) [circle,fill,inner sep=1pt]{};
\node[above] at (A) {A};
\node[above] at (B) {B};
\node[above] at (C) {C};
\node[below] at (D) {D};
\node[below] at (E) {E};
\node[below] at (F) {F};
\tkzMarkSegment[color=red,pos=.5,mark=|](A,D)
\tkzMarkSegment[color=red,pos=.5,mark=|](C,E)
\tkzMarkSegment[color=red,pos=.5,mark=|](B,F)
\tkzMarkSegment[color=orange,pos=.5,mark=||](A,C)
\tkzMarkSegment[color=orange,pos=.5,mark=||](D,E)
\end{tikzpicture}
\end{document}
答案2
以防万一您想要超过 2 行的标记。(我还清理了一下您的代码,您不需要创建额外的节点来标记现有节点。)
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[line width=1.2pt]
\draw (0,0) rectangle (5,-5);
\draw[decoration = {markings,mark=at position 0.5 with
{\draw(0,-3pt)--(0,3pt);}},postaction={decorate}] (0,0)--(0,-5);
\draw[decoration = {markings,mark=at position 0.5 with
{\draw(0,-3pt)--(0,3pt);}},postaction={decorate}] (2,0)--(2,-5);
\draw[decoration = {markings,mark=at position 0.5 with
{\draw(0,-3pt)--(0,3pt);}},postaction={decorate}] (5,0)--(5,-5);
\draw[decoration = {markings,mark=at position 0.5 with
{\draw(-2pt,-3pt)--(-2pt,3pt);\draw(2pt,-3pt)--(2pt,3pt);}},postaction={decorate}]
(0,0)--(2,0);
\draw[decoration = {markings,mark=at position 0.5 with
{\draw(-2pt,-3pt)--(-2pt,3pt);\draw(2pt,-3pt)--(2pt,3pt);}},postaction={decorate}]
(0,-5)--(2,-5);
\draw[decoration = {markings,mark=at position 0.5 with
{\draw(-4pt,-3pt)--(-4pt,3pt);\draw(0,-3pt)--(0,3pt);\draw(4pt,-3pt)--(4pt,3pt);}},postaction={decorate}]
(2,0)--(5,0);
\draw[decoration = {markings,mark=at position 0.5 with
{\draw(-4pt,-3pt)--(-4pt,3pt);\draw(0,-3pt)--(0,3pt);\draw(4pt,-3pt)--(4pt,3pt);}},postaction={decorate}]
(2,-5)--(5,-5);
\fill[pattern = north east lines,pattern color=green] (0,0) rectangle (2,-5);
\fill[pattern = north east lines,pattern color=red] (2,0) rectangle (5,-5);
\node[label=above:A] at (0,0) [circle,fill,inner sep=1pt]{};
\node[label=above:B] at (5,0) [circle,fill,inner sep=1pt]{};
\node[label=above:C] at (2,0) [circle,fill,inner sep=1pt]{};
\node[label=below:D] at (0,-5) [circle,fill,inner sep=1pt]{};
\node[label=below:E] at (2,-5) [circle,fill,inner sep=1pt]{};
\node[label=below:F] at (5,-5) [circle,fill,inner sep=1pt]{};
\end{tikzpicture}
\end{document}