多行表第一列的文本超出了边界

多行表第一列的文本超出了边界
\begin{table}[!ht]\footnotesize
\centering
\begin{tabular}{|p{2.8in}|p{3.5in}|} \hline
Goals & Approaches\\\hline
\multirow{3}{*}{STRU Mathematical Modeling} & Empirical studies for loop       classification\\\cline{2-2}
                       & Category-based loop modeling \\\cline{2-2}
     & Segmented dynamic analysis \\\hline\hline
\multirow{3}{*}{STRU Path Analysis}         & Taint analysis to find input- and secret-controlled loops  \\\cline{2-2} 
                                                 & Graph compaction with path equivalence classes                   \\\cline{2-2}
                       & Inter-procedural, demand-driven, path-sensitive, symbolic analysis to determine complexity   \\\hline\hline
\multirow{3}{*}{**Demand-driven, Composable Analysis**} & Analysis accuracy boundary identifier   \\\cline{2-2}      
                                                                 & Dynamic analysis and {\it fc-vector} summary for library calls  \\\cline{2-2}
                                                                 & Type inference for dynamic dispatching problems \\\hline\hline
\multirow{3}{*}{Analysis for Intelligence Amplification} & eXtensible Common Software Graph (XCSDG) based visualization \\\cline{2-2}
                                                                            & Graph query language  \\\cline{2-2}
                                                                            & Demand-driven based scripting for quickly constructing semantic analysis based on the human needs\\\hline

\end{tabul    \end{table}

在上面的 tex 代码中,我的表格第一列中的文本超出了边框,我该如何纠正这个问题?一种方法是增加宽度,但这不是永久的解决方案,因为我希望第一列中的文本在到达表格边框时从新行开始! 在此处输入图片描述 屏幕截图:

答案1

我认为您应该考虑使用tabularx环境而不是基本tabular环境来开始组织表格的结构。首先将tabularx环境的宽度设置为\textwidth。接下来,因为看起来左侧列中的术语不应该出现换行符,l所以使用列类型。对于右侧列,使用(修改形式的)列类型X。这样,LaTeX 就会为您计算列的宽度。

我不会将multirow包及其\multirow宏用于此表。我还会删除三条垂直线并加载包booktabs以绘制间距良好的水平线。例如,我会将所有指令替换为\hline\hline\ toprule \ bottomrule \midrule \cmidrule \hline \cline`,两者都会创建相同粗细的线条。(顺便说一句,如果这是我自己的表,我也会删除这些水平线并用一些垂直空白替换它们。但是,您似乎喜欢大量的水平线,所以我没有从示例中删除它们。)\midrule\cline{2-2}\cmidrule(l){2-2}. If you look closely at the image below, you'll notice that the lines drawn byandare thicker thanwhich is, in turn, thicker than. In contrast,and

我还建议使用\small而不是 ,除非\footnotesize您的文档确实非常缺乏空间。

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx,booktabs,ragged2e}
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X} % Ragged-Right form of "X" column type
\begin{document}
\begin{table}[!ht]
\small
\begin{tabularx}{\textwidth}{ @{} l Y @{} } 
\toprule
Goals & Approaches\\
\midrule
STRU Mathematical Modeling 
& Empirical studies for loop classification\\
\cmidrule(l){2-2}
& Category-based loop modeling \\
\cmidrule(l){2-2}
& Segmented dynamic analysis \\
\midrule
STRU Path Analysis 
& Taint analysis to find input- and secret-controlled loops  \\
\cmidrule(l){2-2}
& Graph compaction with path equivalence classes \\
\cmidrule(l){2-2}
& Inter-procedural, demand-driven, path-sensitive, symbolic analysis to determine complexity   \\
\midrule
**Demand-driven, Composable Analysis** 
& Analysis accuracy boundary identifier   \\
\cmidrule(l){2-2}
& Dynamic analysis and \emph{fc-vector} summary for library calls  \\
\cmidrule(l){2-2}
& Type inference for dynamic dispatching problems \\
\midrule
Analysis for Intelligence Amplification 
& eXtensible Common Software Graph (XCSDG) based visualization \\
\cmidrule(l){2-2}
& Graph query language  \\
\cmidrule(l){2-2}
& Demand-driven based scripting for quickly constructing semantic analysis based on the human needs\\
\bottomrule
\end{tabularx}    
\end{table}
\end{document}

相关内容