当我写很多的时候我该如何解决这个问题?

当我写很多的时候我该如何解决这个问题?

在@percusse 的这篇精彩文章中: https://tex.stackexchange.com/a/67736/159009

当我写太多单词时,我会遇到问题,例如:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{PTSansNarrow}
\usepackage[T1]{fontenc}

\usetikzlibrary{matrix}

\begin{document}
\begin{tikzpicture}
\clip node (m) [matrix,matrix of nodes,
fill=black!20,inner sep=0pt,
nodes in empty cells,
nodes={minimum height=1cm,minimum width=2.6cm,anchor=center,outer sep=0,font=\sffamily},
row 1/.style={nodes={fill=black,text=white}},
column 1/.style={nodes={fill=gray,text=white,align=right,text width=2.5cm,text depth=0.5ex}},
column 2/.style={text width=4cm,align=center,every even row/.style={nodes={fill=white}}},
column 3/.style={text width=3cm,align=center,every even row/.style={nodes={fill=white}},},
row 1 column 1/.style={nodes={fill=gray}},
prefix after command={[rounded corners=4mm] (m.north east) rectangle (m.south west)}
] {
    & Enterprise SAN                     & ioDrive \\
    Problems when I writte a lot in this row&
    Problems when I writte a lot in this row, problems problems problems&
     Low Profile PCIe \\
    Interface       & FC-4                               & PCIe x4 \\
    Drive Units     & 150$\times$15 RPM disks            & 2$\times$80gig\\
    Data Protection & Mirroring                          & Mirroring\\
    Power           & 33.372 kWh/yr                      & 114 kWh/yr\\
    SPC-1 I0PS      & 24.998                             & 86.127\\
};
\end{tikzpicture}
\end{document}

产生此问题(结构破坏):

在此处输入图片描述

我该如何解决?

(我没有在评论中写这个,因为在评论中解释这个非常困难)。

答案1

您可以通过添加样式来调整第二行的高度row 2/.style={nodes={minimum height=2cm}}。我还在第一列中用text depth=0.5ex替换了 。inner sep=.35em

\documentclass[border=7mm]{standalone}
\usepackage{tikz}
\usepackage{PTSansNarrow}
\usepackage[T1]{fontenc}

\usetikzlibrary{matrix}

\begin{document}
\begin{tikzpicture}
\clip node (m) [matrix,matrix of nodes,
fill=black!20,inner sep=0pt,
nodes in empty cells,
nodes={minimum height=1cm,minimum width=2.6cm,anchor=center,outer sep=0,font=\sffamily},
row 1/.style={nodes={fill=black,text=white}},
row 2/.style={nodes={minimum height=2cm}}, % <-- added to adjust the height of row 2
column 1/.style={nodes={fill=gray,text=white,align=right,text width=2.5cm,inner sep=.35em}},
column 2/.style={text width=4cm,align=center,every even row/.style={nodes={fill=white}}},
column 3/.style={text width=3cm,align=center,every even row/.style={nodes={fill=white}}},
row 1 column 1/.style={nodes={fill=gray}},
deeper/.style={text=red},
prefix after command={[rounded corners=4mm] (m.north east) rectangle (m.south west)}
] {
               & Enterprise SAN                     & ioDrive \\
    Problems when I writte a lot in this row
                    & Problems when I writte a lot in this row, problems problems problems
                                                         & Low Profile PCIe \\
    Interface       & FC-4                               & PCIe x4 \\
    Drive Units     & 150$\times$15 RPM disks            & 2$\times$80gig\\
    Data Protection & Mirroring                          & Mirroring\\
    Power           & 33.372 kWh/yr                      & 114 kWh/yr\\
    SPC-1 I0PS      & 24.998                             & 86.127\\
};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容