多行问题:文本超出单元格范围

多行问题:文本超出单元格范围

桌子

如附图所示,文本超出了单元格范围。如果有人能帮助我解决这个问题,我将不胜感激。

\begin{table}[!htbp]
\centering
\caption{Experiment outline}
\label{tab:exp_process}
\begin{tabular}{|l|l|l|m{6cm}|}
    \hline
    Sessions & Objectives & Groups & Activities
    \\
    \hline\hline
    \multirow{2}{*}{$1$st session} & 
    \multirow{2}{4cm}{Learning the basics of thermal conduction} & 
    Control & 
    \multirow{1}{6cm}{Solve a thermal system design problem using a real-time high-fidelity simulation with the CPU heat sink system}
    \\
                                  &                            & Experimental & 
    \\
    \hline
\end{tabular}
\end{table}

答案1

只需添加两条线来补偿超出单元格的长度。并调整数量,multirow{x}{width}{content}使它们在顶部对齐。

在此处输入图片描述

\documentclass[]{article}%
\usepackage[margin=1cm]{geometry}
\usepackage{multirow,array}
\begin{document}
\begin{table}[!htbp]
\centering
\caption{Experiment outline}
\label{tab:exp_process}
\begin{tabular}{|l|l|l|m{6cm}|}
    \hline
    Sessions & Objectives & Groups & Activities \\ \hline\hline
    \multirow{1}{*}{$1$st session} & \multirow{2}{4cm}{Learning the basics of thermal conduction} &    Control & 
    \multirow{1}{6cm}{Solve a thermal system design problem using a real-time high-fidelity simulation with the CPU heat sink system}
    \\
 &           &     Experimental &   \\   
 &           &                  &   \\ 
 &           &                  &   \\ \hline
\end{tabular}
\end{table}
\end{document}

答案2

那根本不使用会怎样multirow

\documentclass{article}
\usepackage{array}
\begin{document}
\noindent
\begin{tabular}{|m{2cm}|m{3.5cm}|m{2.5cm}|m{5cm}|}
\hline
Sessions & Objectives & Groups & Activities \\
\hline\hline
First session &
  Learning the basics of thermal conduction &
  Control\newline Experimental &
  Solve a thermal system design problem using a real-time
  high-fidelity simulation with the CPU heat sink system \\
\hline
\end{tabular}
\end{document}

在此处输入图片描述

另一方面,我会使用“顶部对齐”方案:

\documentclass{article}
\usepackage{array}
\begin{document}
\noindent
\begin{tabular}{|l|p{3.5cm}|p{2.5cm}|p{5cm}|}
\hline
Sessions & Objectives & Groups & Activities \\
\hline\hline
First session &
  Learning the basics of thermal conduction &
  Control\newline Experimental &
  Solve a thermal system design problem using a real-time
  high-fidelity simulation with the CPU heat sink system \\
\hline
\end{tabular}
\end{document}

在此处输入图片描述

更好的是,我还会使用booktabs

\documentclass{article}
\usepackage{array,booktabs}
\begin{document}
\noindent
\begin{tabular}{l p{3.5cm} p{2.5cm} p{5cm}}
\toprule
Sessions & Objectives & Groups & Activities \\
\midrule
First session &
  Learning the basics of thermal conduction &
  Control\newline Experimental &
  Solve a thermal system design problem using a real-time
  high-fidelity simulation with the CPU heat sink system \\
\bottomrule
\end{tabular}
\end{document}

在此处输入图片描述

答案3

谢谢你的建议。通过调整行数,我能够生成如图所示的格式良好的表格。

在此处输入图片描述

\begin{table}[!htbp]
\centering
\caption{Experiment outline}
\label{tab:exp_process}
\begin{tabular}{|m{2cm}|m{4cm}|m{2.5cm}|m{6cm}|}
    \hline
    Sessions & Objectives & Groups & Activities \\ \hline\hline
    \multirow{3}{*}{$1$st session} & \multirow{3}{4cm}{Learning the basics of thermal conduction} &    
    \multirow{2}{*}{Control} & 
    \multirow{3}{6cm}{Solve a thermal system design problem using a real-time high-fidelity simulation with the CPU heat sink system}
    \\
 &           &     \multirow{2}{*}{Experimental} &   \\   
 &           &                  &   \\ \hline
\end{tabular}
\end{table}

相关内容