我知道有很多帖子的标题相似,但不知何故我找不到任何看似相关的内容。这是一个 MWE,我期望所有行都有均匀的距离。但显然第一行和第二行比第二行和第三行更接近:
\documentclass[]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\matrix[
matrix of nodes,
anchor=north,
column 1/.style={nodes={anchor=base west,align=center}},
column 2/.style={nodes={anchor=base west,align=center}},
column 3/.style={nodes={anchor=base west,align=center}},
column 4/.style={nodes={anchor=base west,align=center}}
]
{ Some text& \\
Some text& Some longer text\\
Some text&
Some text\\};
\end{tikzpicture} %
\caption{test test}
\end{figure}
\end{document}
答案1
因为第二行包含g
具有降部字母而第一行没有。您可以将一些添加text depth
到所有节点或\strut
在所有单元格内使用。
\documentclass[]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\matrix[
matrix of nodes,
anchor=north,
nodes={text depth=0.55ex}, %% <----------------------here
column 1/.style={nodes={anchor=base west,align=center}},
column 2/.style={nodes={anchor=base west,align=center}},
column 3/.style={nodes={anchor=base west,align=center}},
column 4/.style={nodes={anchor=base west,align=center}}
]
{ Some text& \\
Some text& Some longer text\\
Some text& Some text\\};
\end{tikzpicture} %
\caption{test test}
\end{figure}
\end{document}