答案1
欢迎来到 TeX.SE!!由于您的图像非常重复,您可以使用\foreach
命令绘制它。类似这样(我为您留下了标签)。
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\definecolor{mygreen}{rgb}{0,0.4,0}
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid [step=0.5] (10,11);
\draw[thin,gray] (0,0) grid (10,11);
\foreach\i in {1,...,10} \foreach\j in {1,...,11}
{%
\pgfmathtruncatemacro\ii{Mod(\i,2)}
\pgfmathtruncatemacro\jj{Mod(\j+1,2)}
\node at (\i-0.5,\j-0.5) {$\ii\jj$};
}
\draw[mygreen] (0,1) -- (10,11);
\draw (0,0.5) -- (10,10.5);
\draw[red] (0,0) -- (10,10);
\foreach\i in {1,...,10}
{%
\fill[mygreen,opacity=0.3] (\i-1,\i-0.5) |- (\i-0.5,\i) -- cycle;
\fill[red ,opacity=0.3] (\i-0.5,\i) -| (\i,\i+0.5) -- cycle;
}
\foreach\i in {1,3,...,11} \foreach\j in {1,...,4}
{%
\ifnum\i < 11
\draw (\i-0.125+0.1*\j+0.25,5.875) --++ (0.25,0.25);
\fi
\draw (4.875,\i-0.125+0.1*\j-0.75) --++ (0.25,0.25);
}
\node at (10,6) [right] {$X_1$};
\node at (5,11) [above] {$X_2$};
\end{tikzpicture}
\end{document}
答案2
欢迎使用 TeX SE。这里有一些可供您入门的内容:
\documentclass{article}
\usepackage{nicematrix}
\setcounter{MaxMatrixCols}{20}
\begin{document}
\[
\begin{NiceMatrix}[light-syntax,hvlines]
10 00 10 00 10 00 10 00 10 00 10 ;
11 01 11 01 11 01 11 01 11 01 11 ;
10 00 10 00 10 00 10 00 10 00 10 ;
\vdots ;
10 00 10 00 10 00 10 00 10 00 10 ;
\end{NiceMatrix}
\]
\end{document}
答案3
这是一个起点。
\documentclass{article}
\usepackage{nicematrix}
\ExplSyntaxOn
\NewDocumentCommand{ \cell } { mm } {
\int_mod:nn{ #2 }{ 2 } \int_mod:nn{ \int_eval:n { #1 + 1 } }{ 2 }
}
\ExplSyntaxOff
\begin{document}
$\AutoNiceMatrix[hvlines]{11-11}{\cell{\arabic{iRow}}{\arabic{jCol}}}$
\end{document}
得出的结果为:
剩下要添加装饰品。