Consider the following table. Some of the text in the second column is italic and also the text is broken in order to fit the column width.
When the following code is used, it generates a table where the text can be formatted however the table grows outside the page boundary.
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabularx}{0.7\textwidth}{llll}
\hline
\multirow{2}{*}{\textbf{S\#}} & \multicolumn{2}{c}{\textbf{Required Input}} & \multirow{2}{*}{\textbf{Output}} \\ \cline{2-3}
& \textbf{1-level} & \textbf{2-level} & \\ \hline
E-call (EC) & Vehicle information, e.g., type and id, vehicle location,\ \textit{freight information, e.g., type and amount.} & Any output here. \ \hline
\end{tabularx}
\end{table}
See picture 2, which is the screenshot of the code:
Best Answer
Environment
tabularx
is already be used, only the usage of the column typeX
is missing. Also it seems the entries should be vertically centered, this can be achieved by the redefinition of\tabularxcolumn
to internally use column typem
instead ofp
. Also the example uses the lines of packagebooktabs
.