3

I have referred the previous answers to solve hbox badness. However, I have got even more confused and I am not able to understand my mistake. Here is my code:

\documentclass[12pt,oneside]{report}
\usepackage{booktabs}
\usepackage{float}
\usepackage{multirow}
\begin{document}
\begin{table}[H]
\caption{Contact details for $2D$ model in ABAQUS}
\begin{tabular}{l l l l}
\toprule 
\multicolumn{2}{c}{Tangential Contact} & \multicolumn{2}{c}{Normal Contact}\\
\midrule
Friction formulation & Penalty & Pressure-overclosure & `Hard' contact\\
Friction coefficient & $1$ & Constraint enforcement method & Penalty (standard)\\
Shear Stress limit & $\SI{80}{\kilo\pascal}$ & Allow separation after contact & Yes\\
\bottomrule
\end{tabular}
\label{table:2.1}
\end{table}
\end{document}

Contact details for 2D model in ABAQU

However, this is not desirable. Here are the concerns/problems 1. Underfull hbox badness 10000- I think that Latex is not creating white space in the first row after each of the two words. 2. 1st two and last two columns need to have same width to appeal aesthetically. Also the text must wrap around.

I have read about \parbox, tabularx package, creating new command with \ragggedright. But at the end, I am confused as to how to use them. Can anybody help me out here please? In short, I am not understanding how TABLES work. Can anybody give a short term and long term solution to this. Thanks.

  • I get no Underfull hbox badness 10000 message from your example; and it doesn't compile because siunitx is missing. I only get Overfull \hbox (60.7209pt too wide) which is because the table is too wide. Please, make a real example showing the issue. – egreg Dec 21 '15 at 21:14
  • @egreg : You are right in saying that the package \siunitx is missing. I forgot to include it in MWE. However, other things in the code remain the same. The answer given by Herbert is useful. What else are you expecting me to put in? Kindly clarify. – JaiGuruDev Dec 21 '15 at 23:51
  • Well, you talk about underfull boxes, but there's none in the example. – egreg Dec 21 '15 at 23:53
  • 1
    @JaiGuruDev check the warnings from the example you post, not the ones in your original document. – David Carlisle Dec 21 '15 at 23:56
  • 1
    Posting an example that does not demonstrate the problem that you are asking about does not help anyone help. Start from a copy of your document, delete any text and packages that you can delete and replace \include{chapterfile} by the chapter (with most text removed) until you have the smallest file that you can make that demonstrates your problem. then post that. – David Carlisle Dec 22 '15 at 1:13
2
\documentclass[12pt,oneside]{report}
\usepackage{booktabs,siunitx}
\usepackage{caption,tabularx,ragged2e}
\begin{document}
\begin{table}[!htb]
    \caption{Contact details for $2D$ model in ABAQUS}\label{table:2.1}
    \begin{tabularx}{\linewidth}{@{} l l >{\RaggedRight}X l @{}}\toprule 
            \multicolumn{2}{c}{Tangential Contact} & \multicolumn{2}{c}{Normal Contact}\\
            \midrule
            Friction formulation & Penalty & Pressure-overclosure & `Hard' contact\\
            Friction coefficient & $1$ & Constraint enforcement method & Penalty 
            (standard)\\
            Shear Stress limit & $\SI{80}{\kilo\pascal}$ & Allow separation after contact 
            & Yes\\
            \bottomrule
    \end{tabularx}%
\end{table}
\end{document}

enter image description here

  • This soln works in the sense that no warning of underfull \hbox is issue however the output I am getting is the same which I got previously as shown in the question. The text did not wrap around. Secondly, can you explain the meaning of this code \linewidth}{@{} l l >{\RaggedRight}X l @{} ? this will helpful next time for me. – JaiGuruDev Dec 21 '15 at 23:57
  • your tabular couldn't have linebreaks in the cell. What do you mean by "The text did not wrap around."? – user2478 Dec 22 '15 at 7:31
  • @Herbert- when I use the code which you suggested, then I do not get any warnings. However, the table has got the same display as shown in my question. For example, the word contact__enforcement is displayed in 1 line, same case with allow__separation__after__contact . – JaiGuruDev Dec 23 '15 at 18:19
  • then you do not have a X-column! – user2478 Dec 23 '15 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.