我有一张表格,代码如下:
\begin{table}[]
\begin{tabular}{cc|cccccc|}
\cline{3-8}
\multicolumn{1}{l}{}
& & \multicolumn{6}{c|}{\textbf{Time-period (t)}}
\\ \cline{3-8}
\multicolumn{1}{l}{}
& \textbf{} & \multicolumn{1}{c|}{\textbf{0}} &
\multicolumn{1}{c|}{\textbf{1}} & \multicolumn{1}{c|}
{\textbf{2}} & \multicolumn{1}{c|}{\textbf{3}}
& \multicolumn{1}{c|}{\textbf{4}} & \textbf{5}
\\ \hline
\multicolumn{1}{|c|}{}
& \textbf{1} & \multicolumn{1}{c|}{{\color[HTML]{32CB00} 3}} &
\multicolumn{1}{c|}{{\color[HTML]{000000} 3}} & \multicolumn{1}{c|}
{{\color[HTML]{000000} 3}} & \multicolumn{1}{c|}{{\color[HTML]
{000000} 3}} & \multicolumn{1}{c|}{{\color[HTML]{FF0000} -3}+
{\color[HTML]{32CB00}3}+3} & {\color[HTML]{000000} 3} \\ \cline{2-
8}
\multicolumn{1}{|c|}{}
& \textbf{2} & \multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{{\color[HTML]{32CB00} 3}} & \multicolumn{1}{c|}
{3} & \multicolumn{1}{c|}{3}
& \multicolumn{1}{c|}{3} & 3
\\ \cline{2-8}
\multicolumn{1}{|c|}{}
& \textbf{3} & \multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} & \multicolumn{1}{c|}
{{\color[HTML]{32CB00} 3}} & \multicolumn{1}{c|}{3}
& \multicolumn{1}{c|}{3} & 3
\\ \cline{2-8}
\multicolumn{1}{|c|}{\multirow{-4}{*}{{\rotatebox[origin=c]{90}
{\textbf{Sensor node $i \in V$}}}}} & \textbf{4} & \multicolumn{1}
{c|}{} & \multicolumn{1}{c|}{}
& \multicolumn{1}{c|}{} & \multicolumn{1}
{c|}{{\color[HTML]{32CB00} 3}} & \multicolumn{1}{c|}{3}
& 3 \\ \hline
\end{tabular}
\end{table}
第一列中的文本超出了表格范围。我该如何修复此问题?
答案1
以下附加代码确实满足了换行多行旋转文本的要求
\begin{turn}{90}
{
\tabular{@{}c@{}}
\textbf{Sensor} \\\textbf{node} \\\textbf{$i \in V$}
\endtabular
}
\end{turn}
平均能量损失
\documentclass{article}
\usepackage{array}
\usepackage{multirow}
\usepackage{rotating,booktabs,xcolor}
\begin{document}
\begin{table}[]
\begin{tabular}{cc|cccccc|}
\cline{3-8}
\multicolumn{1}{l}{}
& & \multicolumn{6}{c|}{\textbf{Time-period (t)}}
\\ \cline{3-8}
\multicolumn{1}{l}{}
& \textbf{} & \multicolumn{1}{c|}{\textbf{0}} &
\multicolumn{1}{c|}{\textbf{1}} & \multicolumn{1}{c|}
{\textbf{2}} & \multicolumn{1}{c|}{\textbf{3}}
& \multicolumn{1}{c|}{\textbf{4}} & \textbf{5}
\\ \hline
\multicolumn{1}{|c|}{}
& \textbf{1} & \multicolumn{1}{c|}{{\color[HTML]{32CB00} 3}} &
\multicolumn{1}{c|}{{\color[HTML]{000000} 3}} & \multicolumn{1}{c|}
{{\color[HTML]{000000} 3}} & \multicolumn{1}{c|}{{\color[HTML]
{000000} 3}} & \multicolumn{1}{c|}{{\color[HTML]{FF0000} -3}+
{\color[HTML]{32CB00}3}+3} & {\color[HTML]{000000} 3} \\ \cline{2-
8}
\multicolumn{1}{|c|}{}
& \textbf{2} & \multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{{\color[HTML]{32CB00} 3}} & \multicolumn{1}{c|}
{3} & \multicolumn{1}{c|}{3}
& \multicolumn{1}{c|}{3} & 3
\\ \cline{2-8}
\multicolumn{1}{|c|}{}
& \textbf{3} & \multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} & \multicolumn{1}{c|}
{{\color[HTML]{32CB00} 3}} & \multicolumn{1}{c|}{3}
& \multicolumn{1}{c|}{3} & 3
\\ \cline{2-8}
\multicolumn{1}{|c|}
{
\multirow{-4}{*}
{
\begin{turn}{90}
{
\tabular{@{}c@{}}
\textbf{Sensor} \\\textbf{node} \\ \textbf{$i \in V$}
\endtabular
}
\end{turn}
}
}
& \textbf{4} & \multicolumn{1}
{c|}{} & \multicolumn{1}{c|}{}
& \multicolumn{1}{c|}{} & \multicolumn{1}
{c|}{{\color[HTML]{32CB00} 3}} & \multicolumn{1}{c|}{3}
& 3 \\ \hline
\end{tabular}
\end{table}
\end{document}