0

Ok so I have tried various solutions to this problem and the ~10 underfull hbox warning have been reduced to 1. But this one's really sticky and I'm at my wit's end.

The warning is directed to the ending of the tabularx environment (not the table environment) and I highly suspect that it has something to do with the last column, especially the multicolumn I used to work around the math mode (that I created, called O) because I don't wan't the header to be in Math font. I also find it weird that not the entire space of that column is used. And also, the cmidrule-line that goes from column 2-5 didn't go all the way through like toprule and bottomrule so I had to shorten it negatively on the right side "cmidrule(lr{-13.5pt})...". I don't know what I did to cause this but I know that this was not always the case...

That's all the information I can give you, I hope there is a simple solution to this, I've been sitting at this for hours now :(((

EDIT: The warning specifies to the alignment, the full information is here: "Underfull \hbox (badness 10000) in alignment at lines 345--345" (this is the end of the tabularx environment)

Please don't kill me for my (probably) Spaghetti code, here is a shortened version of the table,:

%(these are all the packages I put in so far, don't know if it matters much)
\documentclass[paper=a4, titlepage, fontsize=14pt, DIV=calc, parskip=half]{scrartcl}

\usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry}

\usepackage[autostyle = true, german = quotes]{csquotes}
%\usepackage[ngerman]{babel}
\usepackage{polyglossia}
\setdefaultlanguage{german}
\setotherlanguages{english}

\usepackage{ulem}
\usepackage[x11names]{xcolor}

\usepackage{scrlayer-scrpage}
\usepackage{setspace}

\usepackage{booktabs}
\usepackage{array}
\usepackage{makecell}
\usepackage{tabularx}
\usepackage{tabulary} %tried to use this but tabularx is probably the better option for my use
\usepackage{ragged2e}

\usepackage{graphicx}
\usepackage{eso-pic}

\usepackage{hyperref}
\usepackage{url}

\usepackage{amsmath}\usepackage{amsfonts}\usepackage{amssymb}

%----------------------now to the table----------------------%

% math mode for the percentages
\newcolumntype{O}{>{$\displaystyle\hsize=0.8\hsize\RaggedRight}X<{$}}


\begingroup

\begin{table}[t]
\setlength{\tabcolsep}{5pt}
\renewcommand{\arraystretch}{1.5}

%just to make the horizontal lines touch the vertical one, irrelevant for this issue
\belowrulesep=0pt
\aboverulesep=0pt

\centering

\begin{tabularx}{\linewidth}{@{} >{\hsize=1.05\hsize\RaggedRight}X| >{\hsize=1.15\hsize\RaggedRight}X
>{\hsize=0.9\hsize\RaggedRight}X
>{\hsize=1.2\hsize\RaggedRight}X
O
@{}}

\toprule
Name &
Bedeutung &
Beispiel &
Entscheidungskriterium &
\multicolumn{1}{>{\hsize=0.8\hsize\RaggedRight}X}{Wahrscheinlichkeit} \\

\cmidrule(r{7.75pt}){1-1} \cmidrule(lr{-13.5pt}){2-5}

Höchste Karte & Keine der unteren Kombinationen & A♠ {\color{red}K♦} J♠ 7♣ 4♣ & Höhe  der einzelnen Karten & 17,41 \% \\
Straight Flush & Straße in einer Farbe & 8♣ 9♣ 10♣ J♣ Q♣ & Höchste Karte & 0,028 \% \\
Royal Flush & Straße in einer Farbe mit Ass als höchste Karte & {\color{red}10♦ J♦ Q♦ K♦ A♦} & Split Pot & 0,003 \%  \\ \bottomrule
\end{tabularx}

\end{table}
\endgroup

This is what it currently looks like. Don't worry about the contents, I cut most of it out in my code to make it easier to understand but for the image, I think it doesn't matter if the entire content is still there:

table image

5
  • Welcome to tex.sx. I can't really help with the main question, but the hyphenation "th-ree" is simply dreadful. Aug 12, 2022 at 19:00
  • You're right, I didn't even notice that. I will fix that. Thank You :) Aug 12, 2022 at 19:08
  • ! LaTeX Error: Missing \begin{document}. please post an example of the warning that you are asking about that does not generate errors Aug 12, 2022 at 19:21
  • Oh I didn't know this would be necessary but it makes sense. It's my first post here and I'm a latex beginner so I wasn't sure about the stackexchange etiquette and maybe the smart people here can find my mistake without needing a fully working document. And @DavidCarlisle actually did, I'm the happiest person ever :)). Aug 12, 2022 at 20:32
  • oh thats you haha Aug 13, 2022 at 4:45

1 Answer 1

0

You can fill the underfull box to remove the warning

\begin{tabularx}{\linewidth}{@{\extracolsep{\fill}} >{\hsize=1.05\hsize\RaggedRight}X| >{\hsize=1.15\hsize\RaggedRight}X
>{\hsize=0.9\hsize\RaggedRight}X
>{\hsize=1.2\hsize\RaggedRight}X
O
@{}}

You also need

\newcolumntype{O}{>{\hsize=0.8\hsize$\displaystyle\RaggedRight}X<{$}}

so the hsize change is in scope at the end of the cell.

You also need to something about long german words:-)

enter image description here

1
  • You are my lord, you are my savior. I will forever be in your debt. Aug 12, 2022 at 20:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .