# The text in first column of a multirow table is crossing the borders

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


In the above tex code the text in the first column of my table is crossing the border, how can I rectify this?One way is to increase the width of but that is not a permanent solution, as I want the text int he first column to start in a new line if it reaches the table border! Screen Shot:

• – darthbith Oct 23 '14 at 20:29
• multrow's * is like l you need to give it a length 2.8in here – David Carlisle Oct 23 '14 at 20:37

I think you should look into using a tabularx environment instead of the basic tabular environment to start organizing the table's structure. Start by setting the width of the tabularx environment to \textwidth. Next, because it looks like the terms in the left-hand column shouldn't suffer line breaks, use the l column type for it. For the right-hand column, use (a modified form of) the X column type. That way, LaTeX will calculate the width of the column for you.

I wouldn't use the multirow package and its \multirow macro for this table. I would also get rid of the three vertical lines and load the booktabs package to draw well-spaced horizontal lines. E.g., I would replace all \hline\hline directives with \midrule and all \cline{2-2} instructions with \cmidrule(l){2-2}. If you look closely at the image below, you'll notice that the lines drawn by\topruleand\bottomruleare thicker than\midrulewhich is, in turn, thicker than\cmidrule. In contrast,\hlineand\cline both create lines of the same thickness. (By the way, if it were my own table, I'd also get rid of these horizontal lines as well and replace them with a bit of vertical whitespace. However, you seem to have a liking for plenty of horizontal lines, so I didn't purge them from the example.)

I'd also suggest using \small instead of \footnotesize unless your document is really, really pressed for space.

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