I think the easiest way is to use tabularx
.
Please note that multicol
package is for having a document in two (or more) columns, it is not for \multicolumn
in tables.
Please also observe that because I've set the width of the tabularx
environment to equal \linewidth
, the \centering
instruction is no longer needed.
As egreg pointed out in his comment, if the table has no caption, a center
environment suffices; if it has a caption, then table
should not have the [H]
option.
For more professional tables, use booktabs
.
\documentclass[a4paper]{book}
\usepackage{tabularx}
\usepackage{ragged2e}
\usepackage{float}
\usepackage{caption}
\usepackage{booktabs}
\begin{document}
If your table is at a fixed position, you can use
\texttt{center} environment.
%\begin{table}[H]
\begin{center}
%%\centering %% not needed since width of tabularx env. = \linewidth
\begin{tabularx}{\linewidth}{|l|>{\RaggedRight}X|}
\hline
\multicolumn{1}{|c}{Compressible} & \multicolumn{1}{|c|}{Incompressible} \\ \hline
aaaaaaaaaaaaaaaaaaaaaaaa & bbbbbbb bbbbbbbbbbbbb bbbbbbbbbbb bbbbbbbbbbbbbbb bbbbbbbbbb bbbbbbbbbb bbbbbb \\
cccccccccccccccccccccccccccc & ddddddddddddddddddddddddddddd \\ \hline
\end{tabularx}
%\end{table}
\end{center}
If your table has a caption, the \texttt{[H]} option should not be used, because it can float.
Table \ref{tab:mytab} is an example
with \texttt{booktabs}.
\begin{table}[htb]
\caption{\label{tab:mytab}A professional table}
\begin{tabularx}{\linewidth}{l>{\RaggedRight}X}
\toprule
\multicolumn{1}{c}{Compressible} & \multicolumn{1}{c}{Incompressible} \\
\midrule
aaaaaaaaaaaaaaaaaaaaaaaa & bbbbbbb bbbbbbbbbbbbb bbbbbbbbbbb bbbbbbbbbbbbbbb bbbbbbbbbb bbbbbbbbbb bbbbbb \\
cccccccccccccccccccccccccccc & ddddddddddddddddddddddddddddd \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
\multicolumn{1}{c}{...}
for the cells to be centered, see here for example: tex.stackexchange.com/questions/87596/…l
for column specification, notp{...}
, but it's impossible to help you without an MWE. topanswers.xyz/tex?q=606