[Tex/LaTex] Vertical Lines not appearing in tabularx

tablestabularx

I am trying to make the following table with the table and tabularx packages, but the vertical lines of the last three columns are not appearing.
Can you, please, point me in the right direction?

\documentclass[a4paper]{article}
\usepackage{array, hhline}
\usepackage[showframe]{geometry}
\usepackage{tabularx}

\begin{document}
    \begin{table*}
    \small
    \makebox[3 \textwidth][l]{       %centering table
    \resizebox{0.8 \textwidth}{!}{   %resize table

    \begin{tabularx}{\textwidth}{|c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c|} 
    \hline
    \multicolumn{4}{|c||}{\textbf{a}} & \multicolumn{4}{|c||}{\textbf{b}} 
    & 
    \multicolumn{4}{|c||}{\textbf{c}} & \multicolumn{4}{|c|}{
    \textbf{d}} \\
    \hline
    aaaaaaa & bbbbbbb & ccccccc & ddddddd & aaaaaaa & bbbbbbb & ccccccc & ddddddd & aaaaaaa & bbbbbbb & ccccccc & ddddddd & aaaaaaa & bbbbbbb & ccccccc & ddddddd\\ 
    \hline\hline
    0.495 & 0.509 & 0.581 & 0.500 & 0.445 & 0.545 & 0.449 & 0.679 & 0.536 & 0.
    600 & 0.392 & 0.736 & 0.509 & 0.454 & 0.500 & 0.500\\ 
    \hline
    0.645 & 0.633 & 0.616 & 0.500 & 0.462 & 0.861 & 0.650 & 0.519 & 0.600 & 0.
    570 & 0.592 & 0.536 & 0.675 & 0.693 & 0.552 & 0.500\\ 
    \hline
    0.549 & 0.489 & 0.500 & 0.500 & 0.572 & 0.510 & 0.457 & 0.467 & 0.578 & 0.447 
    & 0.496 & 0.316 & 0.535 & 0.510 & 0.433 & 0.426\\ 
    \hline
    0.515 & 0.520 & 0.469 & 0.500 & 0.532 & 0.497 & 0.538 & 0.745 & 0.626 & 0.588
    & 0.569 & 0.591 & 0.615 & 0.623 & 0.536 & 0.452\\ 
    \hline
    0.760 & 0.471 & 0.500 & 0.500 & 0.749 & 0.542 & 0.574 & 0.379 & 0.673 & 0.563 
    & 0.544 & 0.483 & 0.613 & 0.425 & 0.500 & 0.500\\ 
    \hline
    0.604 & 0.527 & 0.430 & 0.500 & 0.469 & 0.498 & 0.547 & 0.400 & 0.537 & 0.434
    & 0.522 & 0.397 & 0.518 & 0.436 & 0.500 & 0.500\\ 
    \hline
    0.524 & 0.479 & 0.500 & 0.500 & 0.715 & 0.528 & 0.658 & 0.585 & 0.697 & 0.523 
    & 0.604 & 0.681 & 0.522 & 0.559 & 0.507 & 0.486\\ 
    \hline
    \end{tabularx}
    }   %centering table
    }   %resize table

    \caption{Caption}
    \end{table*}
\end{document}

enter image description here
Thanks

Best Answer

As others have already pointed out, it's simply incorrect to use a tabularx environment without employing at least one column of type X. A separate issue: Since your table has 16 [!] columns, you should give serious thought to displaying the material in landscape format.

The first table in the following screenshot implements fixes to these two concerns.

In addition, you should also be concerned with making the table more readable. Specifically, all these vertical and horizontal lines do nothing to enhance the material's legibility. In fact, one could argue that they reduce legibility. The second table in the following screenshot (hopefully) demonstrates that by using no vertical lines at all and by using fewer, but well-spaced horizontal lines, the table gets a much more "open" look which encourages readers to actually spend some time perusing the tabular material.

enter image description here

\documentclass{article}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{booktabs} % for well-spaced horizontal rules
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably
\begin{document}

\begin{sidewaystable}
\setlength\tabcolsep{3pt} % default value: 6pt

\begin{tabularx}{\textwidth}{| *{3}{*{4}{C|}|} *{4}{C|} } 
\hline
\multicolumn{4}{|c||}{\textbf{a}} & 
\multicolumn{4}{ c||}{\textbf{b}} & 
\multicolumn{4}{ c||}{\textbf{c}} & 
\multicolumn{4}{ c| }{\textbf{d}} \\
\hline
aaaaaa & bbbbbb & cccccc & dddddd & 
aaaaaa & bbbbbb & cccccc & dddddd & 
aaaaaa & bbbbbb & cccccc & dddddd & 
aaaaaa & bbbbbb & cccccc & dddddd \\ 
\hline\hline
0.495 & 0.509 & 0.581 & 0.500 & 0.445 & 0.545 & 0.449 & 0.679 & 
0.536 & 0.600 & 0.392 & 0.736 & 0.509 & 0.454 & 0.500 & 0.500\\ 
\hline
0.645 & 0.633 & 0.616 & 0.500 & 0.462 & 0.861 & 0.650 & 0.519 & 
0.600 & 0.570 & 0.592 & 0.536 & 0.675 & 0.693 & 0.552 & 0.500\\ 
\hline
0.549 & 0.489 & 0.500 & 0.500 & 0.572 & 0.510 & 0.457 & 0.467 & 
0.578 & 0.447 & 0.496 & 0.316 & 0.535 & 0.510 & 0.433 & 0.426\\ 
\hline
0.515 & 0.520 & 0.469 & 0.500 & 0.532 & 0.497 & 0.538 & 0.745 & 
0.626 & 0.588 & 0.569 & 0.591 & 0.615 & 0.623 & 0.536 & 0.452\\ 
\hline
0.760 & 0.471 & 0.500 & 0.500 & 0.749 & 0.542 & 0.574 & 0.379 & 
0.673 & 0.563 & 0.544 & 0.483 & 0.613 & 0.425 & 0.500 & 0.500\\ 
\hline
0.604 & 0.527 & 0.430 & 0.500 & 0.469 & 0.498 & 0.547 & 0.400 & 
0.537 & 0.434 & 0.522 & 0.397 & 0.518 & 0.436 & 0.500 & 0.500\\ 
\hline
0.524 & 0.479 & 0.500 & 0.500 & 0.715 & 0.528 & 0.658 & 0.585 & 
0.697 & 0.523 & 0.604 & 0.681 & 0.522 & 0.559 & 0.507 & 0.486\\ 
\hline
\end{tabularx}
\caption{Version with lots of vertical and horizontal lines}

\vspace{1cm}

\begin{tabularx}{\textwidth}{@{} c *{14}{C} c @{}} 
\toprule
\multicolumn{4}{@{}c}{\textbf{a}} & 
\multicolumn{4}{   c}{\textbf{b}} & 
\multicolumn{4}{   c}{\textbf{c}} & 
\multicolumn{4}{c@{}}{\textbf{d}} \\
\cmidrule(r){1-4}   \cmidrule(lr){5-8}
\cmidrule(lr){9-12} \cmidrule(l){13-16}
aaaaaa & bbbbbb & cccccc & dddddd & 
aaaaaa & bbbbbb & cccccc & dddddd & 
aaaaaa & bbbbbb & cccccc & dddddd & 
aaaaaa & bbbbbb & cccccc & dddddd \\ 
\midrule
0.495 & 0.509 & 0.581 & 0.500 & 0.445 & 0.545 & 0.449 & 0.679 & 
0.536 & 0.600 & 0.392 & 0.736 & 0.509 & 0.454 & 0.500 & 0.500\\ 
0.645 & 0.633 & 0.616 & 0.500 & 0.462 & 0.861 & 0.650 & 0.519 & 
0.600 & 0.570 & 0.592 & 0.536 & 0.675 & 0.693 & 0.552 & 0.500\\ 
0.549 & 0.489 & 0.500 & 0.500 & 0.572 & 0.510 & 0.457 & 0.467 & 
0.578 & 0.447 & 0.496 & 0.316 & 0.535 & 0.510 & 0.433 & 0.426\\ 
0.515 & 0.520 & 0.469 & 0.500 & 0.532 & 0.497 & 0.538 & 0.745 & 
0.626 & 0.588 & 0.569 & 0.591 & 0.615 & 0.623 & 0.536 & 0.452\\
0.760 & 0.471 & 0.500 & 0.500 & 0.749 & 0.542 & 0.574 & 0.379 & 
0.673 & 0.563 & 0.544 & 0.483 & 0.613 & 0.425 & 0.500 & 0.500\\ 
0.604 & 0.527 & 0.430 & 0.500 & 0.469 & 0.498 & 0.547 & 0.400 & 
0.537 & 0.434 & 0.522 & 0.397 & 0.518 & 0.436 & 0.500 & 0.500\\ 
0.524 & 0.479 & 0.500 & 0.500 & 0.715 & 0.528 & 0.658 & 0.585 & 
0.697 & 0.523 & 0.604 & 0.681 & 0.522 & 0.559 & 0.507 & 0.486\\ 
\bottomrule
\end{tabularx}
\caption{Version with no vertical rules and with fewer but well-spaced horizontal rules}
\end{sidewaystable}
\end{document}