我有 2 个并排的表格。表 1 是动态的,而表 2 是静态的(固定内容)。我需要调整表 2 的行高,该行高必须等于表 1 的总高度(如多行),但我不想使用多行。
\documentclass{article}
\usepackage{subcaption}
\begin{document}
\begin{minipage}{0.8\linewidth}
\begin{tabular}{ | p{5cm} | p{1cm} | p{2.5cm} | }
\hline
A clear day with lots of sunshine.However, the strong breeze will bring down the temperatures & 2 & 3 \\[2cm]
\hline
A clear day with lots of sunshine. However, the strong breeze will bring down the temperatures & 5 & 6 \\[2cm]
\hline
A clear day with lots of sunshine. However, the strong breeze will bring down the temperatures & 8 & 9 \\[1cm]
\hline
\end{tabular}
\end{minipage}
\begin{minipage}{0.2\linewidth}
\begin{tabular}{ |p{5cm}| }
\hline
For columns that will contain text whose length exceeds the column's width, it is recommended that you use the p attribute and specify the desired width of the column (although it may take some trial-and-error to get the result you want). \\[5cm]
\hline
\end{tabular}
\end{minipage}
\end{document}
我该如何实现这个?
答案1
为了避免这种情况,您可以简单地在另一个中\multirow
使用一个。tabular
tabular
我还缩短了列宽以避免overfull \hbox
。
\documentclass{article}
\usepackage{array}
\renewcommand{\arraystretch}{1.2}
\usepackage{subcaption}
\begin{document}
\begin{table}\centering
\begin{tabular}{|@{}c@{}|m{4cm}|}
\hline
\begin{tabular}{p{4cm} | p{1cm} | p{1.3cm}}
A clear day with lots of sunshine. However, the strong breeze will bring down the temperatures & 2 & 3 \\
\hline
A clear day with lots of sunshine. However, the strong breeze will bring down the temperatures & 5 & 6 \\
\hline
A clear day with lots of sunshine. However, the strong breeze will bring down the temperatures & 8 & 9 \\
\end{tabular}
&
For columns that will contain text whose length exceeds the column's width, it is recommended that you use the p attribute and specify the desired width of the column (although it may take some trial-and-error to get the result you want). \\
\hline
\end{tabular}
\end{table}
\end{document}