Approach 1:
Using tabularx with flexible columns
I am using tabularx with two X columns and 8 columns total. Why am I still getting Overfull
\hboxwarnings?How can I make a LaTeX table with long well names and API numbers fit within
\textwidthusingtabularx?Is there a way to allow tabularx columns to wrap text aggressively to prevent overlapping?
\documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{tabularx,ragged2e,booktabs,caption,float,array} \begin{document} \begin{table}[h] \centering \renewcommand{\arraystretch}{1.2} % a little more row spacing \begin{tabularx}{\textwidth}{|c|X|X|c|c|c|c|c|} \hline \textbf{\#} & \textbf{Well Name} & \textbf{API Number} & \textbf{Location} & \textbf{Date} & \textbf{Event} & \textbf{Top (ft)} & \textbf{Bottom (ft)} \\ \hline 1 & PRITCHARD SWD \#001 & 30-045-28351 & NM & 01/01/1994 & Perf & 8383 & 8560 \\ \hline 2 & SALTY DOG SWD \#003R & 30-045-31274 & NM & 04/01/2003 & Perf & 6961 & 7038 \\ \hline 3 & STANOLIND GAS COM SWD \#001 & 30-045-23779 & NM & 05/01/2004 & Perf & 7254 & 7400 \\ \hline 4 & BIG FIELD SWD \#009 & 30-045-32258 & NM & 12/01/2004 & Perf & 7176 & 7323 \\ \hline 5 & SALTY DOG SWD \#005 & 30-045-29000 & NM & 03/01/2006 & Perf & 6494 & 6657 \\ \hline 6 & SALTY DOG SWD \#006 & 30-045-32943 & NM & 07/01/2006 & Perf & 6756 & 6898 \\ \hline 7 & SPONGE BOB SWD \#001 & 30-045-33927 & NM & 11/01/2006 & Perf & 7075 & 7220 \\ \hline 8 & WASTE DISPOSAL WELL \#002 & 30-045-35747 & NM & 03/01/2017 & Perf & 7323 & 7484 \\ \hline \end{tabularx} \caption{Details of saltwater disposal wells used for hydrodynamic model calibration.} \label{table:wells} \end{table} \end{document} Approach 2:
Using Fixed-width p{} columns I set fixed widths for some columns (p{2cm} and p{1cm}), but my table still produces overfull \hbox warnings. How can I adjust the column widths correctly?
How can I balance widths for a table with long well names and short numeric columns in LaTeX?
\documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{tabularx,ragged2e,booktabs,caption,float,array} \begin{document} \begin{table}[H] \centering \renewcommand{\arraystretch}{1.2} % more row spacing \begin{tabular}{|c|p{2cm}|p{1cm}|c|c|c|c|c|} \hline \textbf{\#} & \textbf{Well Name} & \textbf{API Number} & \textbf{Location} & \textbf{Date} & \textbf{Event} & \textbf{Top (ft)} & \textbf{Bottom (ft)} \\ \hline 1 & PRITCHARD SWD \#001 & 30-045-28351 & NM & 01/01/1994 & Perf & 8383 & 8560 \\ \hline 2 & SALTY DOG SWD \#003R & 30-045-31274 & NM & 04/01/2003 & Perf & 6961 & 7038 \\ \hline 3 & STANOLIND GAS COM SWD \#001 & 30-045-23779 & NM & 05/01/2004 & Perf & 7254 & 7400 \\ \hline 4 & BIG FIELD SWD \#009 & 30-045-32258 & NM & 12/01/2004 & Perf & 7176 & 7323 \\ \hline 5 & SALTY DOG SWD \#005 & 30-045-29000 & NM & 03/01/2006 & Perf & 6494 & 6657 \\ \hline 6 & SALTY DOG SWD \#006 & 30-045-32943 & NM & 07/01/2006 & Perf & 6756 & 6898 \\ \hline 7 & SPONGE BOB SWD \#001 & 30-045-33927 & NM & 11/01/2006 & Perf & 7075 & 7220 \\ \hline 8 & WASTE DISPOSAL WELL \#002 & 30-045-35747 & NM & 03/01/2017 & Perf & 7323 & 7484 \\ \hline \end{tabular} \caption{Details of saltwater disposal wells used for hydrodynamic model calibration.} \label{table:wells} \end{table} \end{document} 





