我注意到,每个块中的文本越多,块本身的大小就越大,这可以从block
与其他块相关的 n-1 标签中看到。
我想要的是
我想要相同大小的块,无论文本长度如何。
我希望每个块中刻写的文字占据每个
block
尺寸的 80%,而块尺寸不会增加。我想要更大的,
2, 3, 4, ..., n-1
同时我希望块大小与前三个块相同。
。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
block/.style={
rectangle,
rounded corners,
inner sep=1em
}
]
\path node[block,black,fill=yellow] (1st) {2\strut};
\path (1st.east) ++(2pt,0) node[block,anchor=west,black,fill=green]
(2nd) {3\strut};
\path (2nd.east) ++(2pt,0) node[block,anchor=west,black,fill=red]
(3rd) {4\strut};
\path (3rd.east) ++(2pt,0) node[block,anchor=west,black,fill=white]
(4th) {...\strut};
\path (4th.east) ++(2pt,0) node[block,anchor=west,black,fill=yellow]
(5th) {n-1\strut};
\end{tikzpicture}
\结束{文档}
答案1
正如我上面的评论所述:
没有font=\huge
:
和font=\huge
:
\documentclass{article}
%https://tex.stackexchange.com/q/631402/204164
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
block/.style={
rectangle,
rounded corners,
inner sep=0pt,
minimum width=1cm,
minimum height=1cm ,
font=\huge
}
]
\path node[block,black,fill=yellow] (1st) {2\strut};
\path (1st.east) ++(2pt,0) node[block,anchor=west,black,fill=green]
(2nd) {3\strut};
\path (2nd.east) ++(2pt,0) node[block,anchor=west,black,fill=red]
(3rd) {4\strut};
\path (3rd.east) ++(2pt,0) node[block,anchor=west,black,fill=white]
(4th) {...\strut};
\path (4th.east) ++(2pt,0) node[block,anchor=west,black,fill=yellow]
(5th) {n-1\strut};
\end{tikzpicture}
\end{document}