答案1
欢迎来到 TeX.SE!!!
我会将此作为条件和循环的练习。借助该ifthen
包,您可以执行如下操作:
\documentclass[tikz,border=2mm]{standalone}
\usepackage{ifthen}
\begin{document}
\begin{tikzpicture}
\foreach\i in {0,...,4} \foreach\j in {-1,...,5}
{
\ifthenelse{\i=0 \OR \i=4}{\def\l{C}}{\def\l{u}} % letter
\ifthenelse{\i=0 \OR \i=4 \OR \j=-1 \OR \j=5}{\def\s{*}}{\def\s{\circ}} % symbol
\pgfmathparse{int(\i*\i*(\i-4)*(\i-4)+(\j+1)*(\j+1)*(\j-5)*(\j-5))}
\ifthenelse{\pgfmathresult>0}
{%
\node at (\i,\j) {$\l_{\i,\j}$};
\node at (\i,\j-0.5) {$\s$};
}{}
}
\end{tikzpicture}
\end{document}
答案2
该表不需要特殊包。
\documentclass{article}
\begin{document}
\[\begin{array}{ccccc}
& u_{1,5} & u_{2,5} & u_{3,5} & \\
& \ast & \ast & \ast & \\
C_{0,4} & u_{1,4} & u_{2,4} & u_{3,4} & C_{4,4} \\
\ast & \circ & \circ & \circ & \ast \\
C_{0,3} & u_{1,3} & u_{2,3} & u_{3,3} & C_{4,3} \\
\ast & \circ & \circ & \circ & \ast \\
C_{0,2} & u_{1,2} & u_{2,2} & u_{3,2} & C_{4,2} \\
\ast & \circ & \circ & \circ & \ast \\
C_{0,1} & u_{1,1} & u_{2,1} & u_{3,1} & C_{4,1} \\
\ast & \circ & \circ & \circ & \ast \\
C_{0,0} & u_{1,0} & u_{2,0} & u_{3,0} & C_{4,0} \\
\ast & \circ & \circ & \circ & \ast \\
& u_{1,-1} & u_{2,-1} & u_{3,-1} & \\
& \ast & \ast & \ast & \\
\end{array}\]
\end{document}
使用 plain 进行编译pdflatex
会产生如下结果:
答案3
您可以使用matrix of nodes
(我仅将前两行作为示例):
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix[matrix of math nodes] {
& u_{1,5} & u_{2,5} & u_{3,5} & \\
& \ast & \ast & \ast & \\
C_{0,4} & u_{1,4} & u_{2,4} & u_{3,4} & C_{4,4} \\
\ast & \circ & \circ & \circ & \ast \\
};
\end{tikzpicture}
\end{document}
但是,正如评论中指出的那样,这实际上只是一个表格,您可能不一定需要使用 Ti 来执行此操作钾Z:
\documentclass{article}
\usepackage{array}
\newcolumntype{C}{>{$}c<{$}} % for simpler typing: create a column type that prepends and appends dollar signs for math mode
\begin{document}
\begin{tabular}{CCCCC}
& u_{1,5} & u_{2,5} & u_{3,5} & \\
& \ast & \ast & \ast & \\
C_{0,4} & u_{1,4} & u_{2,4} & u_{3,4} & C_{4,4} \\
\ast & \circ & \circ & \circ & \ast
\end{tabular}
\end{document}