答案1
以后请发布您尝试编写的代码并解释您遇到的具体问题。话虽如此,这里有一个使用纯 TikZ 的(详细)解决方案。
\documentclass[tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{3d}
\begin{document}
\begin{tikzpicture}
\tikzset{%
end node/.style = {%
draw,
minimum size = 5pt,
inner sep = 0pt,
fill = black,
},
star end/.style = {%
star,
end node,
star point ratio = 2.25,
},
diamond end/.style = {%
diamond,
end node,
},
circle end/.style = {%
circle,
end node,
},
triangle end/.style = {%
regular polygon,
regular polygon sides = 3,
shape border rotate = 180,
end node,
},
}
\draw (0, 0) coordinate (A)
-- ++(0, 2) coordinate (B)
node[midway, left] {$1$}
-- ++(2, 0) coordinate (C)
-- ++(0, -2) coordinate (D)
-- cycle
node[midway, above] {$1$};
\node[below] at (A) {$00$};
\node[diamond end] at (A) {};
\node[above] at (B) {$10$};
\node[star end] at (B) {};
\node[above] at (C) {$11$};
\node[diamond end] at (C) {};
\node[below] at (D) {$01$};
\node[star end] at (D) {};
\draw (4, 0, 1) coordinate (E)
-- ++(0, 2, 0) coordinate (F)
node[midway, left] {$1$}
-- ++(2, 0, 0) coordinate (G)
-- ++(0, -2, 0) coordinate (H)
-- cycle
node[midway, above] {$1$};
\draw (F) -- (G)
-- ++(0, 0, -2) coordinate (K)
-- ++(-2, 0, 0) coordinate (J)
-- cycle;
\coordinate (L) at (K -| H);
\coordinate (I) at (J -| L);
\draw (K)
-- ++(0, -2, 0) coordinate (L)
-- (H);
\draw[dashed] (E)
-- ++(0, 0, -2) coordinate (I)
-- (J);
\draw[dashed] (E) -- (I) -- (L);
\draw (F) -- (I) -- (H) -- cycle;
\draw (J) -- (L) -- (G) -- cycle;
\node[below left] at (E) {$000$};
\node[diamond end] at (E) {};
\node[above left] at (F) {$100$};
\node[circle end] at (F) {};
\node[right] at (G) {$110$};
\node[triangle end] at (G) {};
\node[below right] at (H) {$010$};
\node[circle end] at (H) {};
\node[above right] at (I) {$001$};
\node[circle end] at (I) {};
\node[above left] at (J) {$101$};
\node[triangle end] at (J) {};
\node[above right] at (K) {$111$};
\node[diamond end] at (K) {};
\node[right] at (L) {$011$};
\node[triangle end] at (L) {};
\end{tikzpicture}
\end{document}
这使:
答案2
这是您必须完成的部分答案:
\documentclass[10pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx,tikz,fdsymbol}
\begin{document}
\begin{tikzpicture}[scale=4]
\node (00) at (0,0) {\large $\medblackdiamond$} node[below] at (00) {\Large $00$};
\node (01) at (1,0) {\huge$\star$} node[below] at (01) {\Large $01$};
\node (11) at (1,1) {\large$\medblackdiamond$} node[above] at (11) {\Large $11$};
\node (10) at (0,1) {\huge$\star$} node[above] at (10) {\Large $10$};
\draw (0,0) rectangle (1,1);
\node[above] (1) at (.5,0) {\Large $1$};
\node[left] (2) at (0,.5) {\Large $1$};
\end{tikzpicture}
\end{document}