多行問題:文字超出單元格範圍

多行問題:文字超出單元格範圍

桌子

如附圖所示,文字超出了單元格範圍。如果有人能幫我解決問題,我將不勝感激。

\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}

相關內容