How do I create this table?

Don't use booktabs with vertical rules.

And don't load packages twice (you have two \usepackage{graphicx}).

I have used tabularx, and \\[4pt] and \rule{0pt}{16pt} to add some space before and after the horizontal rule.

\documentclass[11pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{tabularx}
\begin{document}
\begin{center}
    \begin{tabularx}{\textwidth}{X|X}
        \multicolumn{1}{c|}{hello} & 
        \multicolumn{1}{c}{hello} \\[4pt]
        \hline
        \rule{0pt}{16pt}hello hello hello hello hello hello hello hello hello hello space infinity & hello hello hello hello  \\
        hello hello hello hello hello & hello hello hello hello  \\
    \end{tabularx}
   \end{center}
   \end{document}

enter image description here


The screenshot that accompanies your query creates the impression that each table column should be just wide enough (but no wider) to typeset three instances of the word "hello", separated by whitespace. If this impression is correct, you should use the p column type for both columns. The p column type takes an argument -- the usable width. In the preamble, be sure to set up a length parameter and measure the width of "hello hello hello" via a \settowidth directive.

Oh, and don't use the booktabs package (and \midrule directives) if you employ vertical lines. Instead, use \hline.

enter image description here

\documentclass[11pt,a4paper]{article}
\usepackage{array} % for "\extrarowheight" macro
\newlength\mylen
\settowidth\mylen{\sffamily hello hello hello} % measure width of "hello hello hello"
\begin{document}
\begin{center}
\sffamily % switch to sans-serif
\setlength\extrarowheight{2pt} % for a more open "look"
\begin{tabular}{p{\mylen}|p{\mylen}}
\multicolumn{1}{c|}{hello} & 
\multicolumn{1}{c}{hello} \\[2pt]
\hline
hello hello hello hello hello hello hello hello hello hello space infinity & hello hello hello hello  \\
hello hello hello hello hello & hello hello hello hello \\
\end{tabular}
\end{center}
\end{document}

like this:

enter image description here

beside tabularx are used options !{<option>} and \Xhline{<width>} from the package array (in this case loaded by the package tabularx) and macro \makecell from the package of the same name:

\documentclass[11pt,a4paper]{article}
\usepackage{makecell, tabularx}

\begin{document}
\begin{center}
\setcellgapes{5pt}\makegapedcells
    \begin{tabularx}{\textwidth}{X!{\vline width 1pt} X}
        \makecell{hello}   & \makecell{hello} \\
    \Xhline{1pt}
        hello hello hello hello hello hello hello hello hello hello space infinity
                            & hello hello hello hello  \\
        hello hello hello hello hello hello hello hello hello hello space infinity
                            & hello hello hello hello  \\
    \end{tabularx}
   \end{center}
\end{document}

Tags:

Tables