2008/08/15

[TeX] 複雜表格

Credits goes to http://www.latex-community.org/forum/
\documentclass {minimal}
\usepackage {tikz}
\usetikzlibrary {decorations.pathreplacing}

\pagestyle {empty}

\begin {document}
\begin {tikzpicture}[thick,decoration=brace]
\draw(0,0) grid (4,4);
\draw(0,4) node[anchor=base east] {$AB$};
\draw(0.5,4.6) node {$CD$};
\foreach \x/\xtext in {0.5/00,1.5/01,2.5/10,3.5/11}
\draw (\x,4.2) node {\xtext};
\foreach \y/\ytext in {0.5/11,1.5/10,2.5/01,3.5/00}
\draw (-0.3,\y) node {\ytext};
\foreach \x/\y in {0/0,1/0,3/0,1/2,0/3,1/3,3/3}
\draw (\x.5,\y.5) node {1};
\foreach \x/\y in {2/0,0/1,1/1,2/1,3/1,0/2,2/2,3/2,2/3}
\draw (\x.5,\y.5) node {0};
\draw[very thin] (0.2,1.2) rectangle (3.8,1.8);
\draw[very thin] (2.2,0.2) rectangle (2.8,3.8);
\draw[very thin] (0.15,1.15)--(0.85,1.15)--(0.85,2.85)--(0.15,2.85);
\draw[very thin] (3.85,1.15)--(3.15,1.15)--(3.15,2.85)--(3.85,2.85);
\draw[thin,decorate] (-0.5,0)--(-0.5,2) node[midway,left] {$A$};
\draw[thin,decorate] (4.1,3)--(4.1,1) node[midway,right] {$B$};
\draw[thin,decorate] (2,4.4)--(4,4.4) node[midway,above] {$C$};
\draw[thin,decorate] (3,-0.1)--(1,-0.1) node[midway,below] {$D$};
\end {tikzpicture}
\end {document}

沒有留言: