我想重现附图,但是在标签显示方面遇到了一些麻烦。
\documentclass[tikz]{standalone}
\usepackage{color}
\tikzset{
zellige/.pic={
\draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
\begin{document}
\begin{tikzpicture}
\draw[cyan] (0,-14) grid (42,3);
\foreach \i in {0,...,9}
\foreach \j in {0,...,3}{
\pic at (4*\i,-4*\j){zellige};}
\foreach \i in {0,...,9}
\foreach \j in {10,...,19}{
\node[draw,circle,inner sep=15pt,] at (4*\i +2.5,0.1){\LARGE \j};
}
\end{tikzpicture}
\end{document}
答案1
我只需将节点添加到定义中pic
(因为pic
s 可以接受参数)。
\documentclass[tikz]{standalone}
\tikzset{
zellige/.pic={
\draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
\node[draw,circle,inner sep=15pt,font=\LARGE] at (2.75,0.25) {#1};
}
}
\begin{document}
\begin{tikzpicture}
\draw[cyan] (0,-14) grid (42,3);
\foreach \i in {0,...,9}
{\foreach \j [evaluate=\j as \k using {int(10+10*\j+\i)}] in {0,...,3}{
\pic at (4*\i,-4*\j){zellige=\k};}}
\end{tikzpicture}
\end{document}
至于您的评论,我添加了一些向量。 (我不知道您的命令\vv
有什么作用。)如果您想使用every node/.style
并为某些节点提供额外的字体信息,则可以使用font
和node font
。
\documentclass[tikz]{standalone}
\usepackage{amsmath}
\tikzset{
zellige/.pic={
\draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
\node[draw,circle,inner sep=15pt,font=\LARGE] at (2.75,0.25) {#1};
}
}
\begin{document}
\begin{tikzpicture}[scale=0.5, every node/.style={transform
shape,node font=\LARGE}]
\draw[cyan] (0,-14) grid (42,3);
\foreach \i in {0,...,9}
{\foreach \j [evaluate=\j as \k using {int(10+10*\j+\i)}] in {0,...,3}{
\pic at (4*\i,-4*\j){zellige=\k};}}
\draw[color=red,-latex,very thick] (0,0)
node [left,node font=\boldmath\Huge]{{$\vec u$}} -- ++ (12,-8);
\draw[color=red,-latex,very thick] (20,2)
node [left,font=\boldmath\Huge]{{$\vec w$}} -- ++ (12,-8);
\end{tikzpicture}
\end{document}
如您所见,这些向量是粗体,并且\Huge
确实有影响。而且使用时transform shape
您不必添加scale=0.5
两次。
答案2
将标签放置在构建 zelliges 的循环中就足够了。
\documentclass[tikz]{standalone}
\usepackage{color}
\tikzset{
zellige/.pic={
\draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
\begin{document}
\begin{tikzpicture}
\draw[cyan] (0,-14) grid (42,3);
\foreach \i in {0,...,9}{
\foreach \j [evaluate=\j as \lab using int((\j+1)*10+\i)]in {0,...,3}{
\pic at (4*\i,-4*\j){zellige};
\node[draw,circle,inner sep=15pt] at (4*\i+2.5,-4*\j){\LARGE \lab};}
}
\end{tikzpicture}
\end{document}