5

It looks like there would be plenty enough space for the table to fit on the page before, where the subsubsection title of my document is. By decreasing the arraystretch to around 1.15, it will fit on the first page but then it really looks a little bit squeezed.

There has to be some sort of setting that forces this amount of whitespace around the table which makes it go on the next page. And I am looking for it.

  • !h or b! is not an option, unfortunately, clear no-no from my tutor.
  • I have tried all kinds of other positioning options after \begin{table} but none of them worked (except for h! or b!)
  • \vspace and other manual methods to change the vertical position of the table directly are also a no-no. Don't ask me why, this is my second try at passing the class (and these were the "mistakes" I did in the first one) lmao.
  • Oh, and other direct methods like \resizebox etc. are also unwelcome unfortunately.

This is the code, don't worry about the missing card symbols in the table (diamonds, hearts, ...). In my original file, I have another font that includes them but I left it out for this minimal example.

\documentclass[paper=a4, fontsize=12pt, parskip=half, captions=tableabove]{scrartcl}

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

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

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

\usepackage[plainheadsepline=true, plainfootsepline=true,  headsepline=0.6pt, footsepline=0.6pt]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearpairofpagestyles

\ohead{\headmark}
\automark{section}


\cfoot{\pagemark}


\usepackage[font=singlespacing]{caption}
\usepackage{setspace}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{ragged2e}


\begin{document}

\subsubsection{random subsubsection}

%Math mode for percentages
\newcolumntype{O}{>{$\displaystyle\RaggedLeft}X<{$}}

\begin{table}[hb]

        \caption{Rangfolge der Pokerhände aufsteigend}
        
        \renewcommand{\arraystretch}{1.5}

        
        \belowrulesep=0pt
        \aboverulesep=0pt
        
        \centering
        
        \begin{tabularx}{\textwidth}{
        >{\RaggedRight\arraybackslash}X|
        >{\RaggedRight\arraybackslash}X
        c
        >{\RaggedRight\arraybackslash}X
        O
        }
        
        \toprule

    %erste Zeile
            Name                        &   Bedeutung                           &   \multicolumn{1}{>{\RaggedRight\arraybackslash}X}{Beispiel}             &   Entscheidungskriterium      &   \multicolumn{1}{>{\RaggedRight\arraybackslash}X}{Wahrscheinlichkeit} \\
            
    
        \cmidrule(r{10pt}){1-1} \cmidrule(l){2-5}
        
    %restliche Zeilen
            Höchste Karte               &   Keine der unteren Kombinationen     &   A♠ {\color{red}K♦} J♠ 7♣ 4♣                             &   Höhe der einzelnen Karten               &   17,41 \% \\
            
            Ein Paar (One Pair)         &   Zwei Karten gleichen Wertes         &   10♠ {\color{red}10♥} J♦ 8♣ {\color{red}6♥}              &   Höhe des Paars + Beikarten              &   43,83 \% \\
            
            Zwei Paare (Two Pair)       &   Zwei Paare                          &   {\color{red}J♦} J♠ 8♣ 8♠ A♠                             &   Höhe der Paare + Beikarten              &   23,50 \% \\
            
            Drilling \\(Three of a Kind)  &   Drei Karten gleichen Wertes         &   Q♣ {\color{red}Q♥} Q♠ {\color{red}A♥} 4♣                &   Höhe des Drillings + Beikarten          &   4,83 \% \\
            
            Straße (Straight)           &   Fünf Karten in einer Reihe          &   {\color{red}7♥} 8♣ {\color{red}9♦ 10♥} J♠               &   Höchste Karte                           &   4,62 \% \\
            
            Flush                       &   Fünf Karten in einer Farbe          &   3♠ 5♠ 8♠ 9♠ K♠                                          &   Höhe der einzelnen Karten               &   3,03 \% \\
            
            Full House                  &   Ein Drilling und ein Paar           &   {\color{red}K♥} K♣ {\color{red}K♦} 9♠ {\color{red}9♦}   &   Höhe des Drillings und Höhe des Paars   &   2,60 \% \\
            
            Four of a Kind              &   Vier Karten gleichen Wertes         &   A♣ {\color{red}A♦ A♥} A♠ 4♠                             &   Höhe des Vierlings und der Beikarte     &   0,17 \% \\
            
            Straight Flush              &   Straße in einer Farbe               &   8♣ 9♣ 10♣ J♣ Q♣                                         &   Höchste Karte                           &   0,028 \% \\
            
            Royal Flush                 &   Straße in einer Farbe, Zehn bis Ass   &   {\color{red}10♦ J♦ Q♦ K♦ A♦}                            &   Split Pot                               &   0,003 \% \\
            

            \bottomrule
            
        \end{tabularx}
        \label{tab:Rangfolge der Pokerhände aufsteigend}
        
\end{table}

\end{document}

And here's the resulting table, currently placed on a page by itself. Observe the copious amounts of whitespace above and below the table.

enter image description here

5 Answers 5

9

LaTeX limits the size of floats on a page. In particular the parameter \textfraction specifies the minimal amount of the page that is reserved for text (and hence, cannot be used by floats). Default is 0.2 so at most 80% of the page can be used by floats. Check the LaTeX documentation for the other parameters. Your problem can be solved by

\renewcommand{\textfraction}{0.0}
3
  • 1
    +1. But even with \renewcommand{\textfraction}{0.0}, or with a slightly less draconian \renewcommand{\textfraction}{0.1}, LaTeX still places the table environment above rather than below the subsubsection-level header. In order to place the table below the header, I can think of no alternative than to provide the [h] positioning specifier.
    – Mico
    Commented Sep 4, 2022 at 8:21
  • Thank you very much. This is basically exactly what I was looking for. However, Fran made me unsure if this solution is any "cleaner" or "better" than h! . For some context, I am a CS student who sits at his PC about 24/7 and the class is a LaTeX beginner course (mostly visited by non CS students who don't sit at their PC 24/7) that includes a final paper in which we ought to show our LaTeX skills based on the lectures. Apparently though, my individual formatting settings (e.g. an own math mode) were not appreciated as the goal is to make a simple and formal "fake scientific" document. Commented Sep 4, 2022 at 16:35
  • Keeping this in mind, is \textfraction still a viable solution? It isn't mentioned anywhere in the script but the script in general is pretty basic and doesn't mention a lof of things... Other packages and commands that weren't directly in the script weren't seen as a positive contribution to the document, either so for this second try, I would like to deviate as little as possible from it. Personally, I would put the \textfraction in there and be happy, no questions asked, but if there is a "simpler" solution (=less "foreign" commands), it might make the tutors happier, too :). Commented Sep 4, 2022 at 16:41
5

Only a long comment about the philosophy of the solution:

!h or b! is not an option, unfortunately, clear no-no from my tutor.

The reason to float rules is avoid as far as possible bad document layouts, and your table height is crying out for a dedicated page. It is simply horrible a page with a big table and a few lines of text before or after the table. The ! option is just ignore the rules for a good design, so I plenty understand to this tutor, but any other solution to do the same by others ways as reduce \textfraction is equally bad for this float and could be also worse for the next floats, whereas ! is a punctual "infraction" that could have sense in some cases, and in this respect is better, but not the best.

Oh, and other direct methods like \resizebox etc. are also unwelcome unfortunately.

Why unfortunately ? resize a table is just the worst solution, producing tables of with rules of unpredictable thickness and fonts of any size, destroying the consistency of the document. If you need a smaller table, never try a negative zoom of a table, just reduce the font of the table to \small or \footnotesize, or redesign the table (funnily, Mico have posted this solution just writing this.)

The other solution, is think again in the whole document layout: Is it nice that a section comes out directly with a big table without any explanation? Start a section with a table is odd. Even if the content of the section is only the table, it will be better some introductory text to the table and allow to the float the migration to the next page, even if this implies place the table after the next section, because a cross-reference, i.e., a ..whatever (table \ref{tab:Rangfolge der Pokerhände aufsteigend}) should be enough to avoid doubts about where this table is relevant.

(margin note: Use simpler labels, you will be happier)

5
  • Thanks for this elaborate response :). I said unfortunately because over the course of my paper here, I have read a simple graphic downscale many times as a solution to space issues. I didn't know it was that bad, though so thank you for the clarification there. Commented Sep 4, 2022 at 16:18
  • The subsubsection starts with a table because the text right before it basically introduces the topic already. I could put this paragraph in the next chapter but it isn't very long so about 3/4 of the page would probably still be empty. My first decision when I read the other answers was to use \textfraction even though I was a little scared my tutor wouldn't like this one, too, but your comment made me a little insecure. Is it genuinely bad style to decrease the \textfraction? The standard 20% seem a little over the top but there is obviously a sense behind it... Commented Sep 4, 2022 at 16:25
  • 1
    What is a bad style is very subjective. Compare yourself the page with the table only vs the answers that solved the technical issue. What do you think that is more elegant? i.e. What is more pleasant for the reader? What layout do you see more often in good books? Scattered text between big tables, or big tables alone in the page?
    – Fran
    Commented Sep 4, 2022 at 16:46
  • Ok, future me will decide what is more pleasant to read. I have plenty of options to work with, thanks to you all. One more question though, unrelated to the format. By nature, the word "Three" in the first column will be hyphenated to "Th-ree" if I don't put "\\" behind the first word (by using \arraybackslash for the column option). However, the contents of the other columns in that row now start from the second line, where the word "Three" currently is. Is there a way to avoid this manual fix by adjusting some language settings that stop this horrendous hyphenation from happening? Commented Sep 4, 2022 at 17:15
  • 1
    You can use \mbox{Threee} to avoid the hyphen in that word or \hyphenation{Three} in the preamble to avoid hyphens in any "Three" in the whole document.
    – Fran
    Commented Sep 4, 2022 at 17:50
4

A list of parameters related to floats (based on the source: Standard Document Classes for LaTeX version 2e*, p. 17):

Parameter Description How to change
\topfraction This indicates the maximum part of a text page that can be occupied by floats at the top. \renewcommand\topfraction{.7}
\bottomfraction This indicates the maximum part of a text page that can be occupied by floats at the bottom. \renewcommand\bottomfraction{.3}
\textfraction This indicates the minimum part of a text page that has to be occupied by text. \renewcommand\textfraction{.2}
\floatpagefraction This indicates the minimum part of a page that has to be occupied by floating objects before a ‘float page’ is produced. \renewcommand\floatpagefraction{.5}

The restrictions LaTeX is given by user--[hb] only accepts "here" and "bottom of the page"--must also match the restrictions given by the parameters. Under the default settings, your float exceeds the available space dedicated for floats. Then, the float is put in a queue. Due to its size, it would never match restrictions on any page, so is likely to be placed at the end of a document, on an additional page, here the second page.

The following settings relaxes constrains

\renewcommand\textfraction{.1}
\renewcommand\bottomfraction{.9}

See the example below where I use the above settings. Even if I add a paragraph between the section and the table, the float is still placed on the same page

enter image description here

\documentclass[paper=a4, fontsize=12pt, parskip=half, captions=tableabove]{scrartcl}

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

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

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

\usepackage[plainheadsepline=true, plainfootsepline=true,  headsepline=0.6pt, footsepline=0.6pt]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearpairofpagestyles

\ohead{\headmark}
\automark{section}


\cfoot{\pagemark}


\usepackage[font=singlespacing]{caption}
\usepackage{setspace}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{ragged2e}

\renewcommand\textfraction{.1}
\renewcommand\bottomfraction{.9}

\usepackage{kantlipsum}   %<--- added

\begin{document}
\subsubsection{random subsubsection}
\kant[6][1-2]   %<--- Added

%Math mode for percentages
\newcolumntype{O}{>{$\displaystyle\RaggedLeft}X<{$}}

\begin{table}[hb]

  \caption{Rangfolge der Pokerhände aufsteigend}

  \renewcommand{\arraystretch}{1.5}


  \belowrulesep=0pt
  \aboverulesep=0pt

  \centering

  \begin{tabularx}{\textwidth}{
      >{\RaggedRight\arraybackslash}X|
      >{\RaggedRight\arraybackslash}X
    c
      >{\RaggedRight\arraybackslash}X
    O
  }

    \toprule

    %erste Zeile
    Name                        &   Bedeutung                           &   \multicolumn{1}{>{\RaggedRight\arraybackslash}X}{Beispiel}             &   Entscheidungskriterium      &   \multicolumn{1}{>{\RaggedRight\arraybackslash}X}{Wahrscheinlichkeit} \\
    \cmidrule(r{10pt}){1-1} \cmidrule(l){2-5}
    %restliche Zeilen
    Höchste Karte                 & Keine der unteren Kombinationen       & A♠ {\color{red}K♦} J♠ 7♣ 4♣                           & Höhe der einzelnen Karten             & 17,41 \% \\
    Ein Paar (One Pair)           & Zwei Karten gleichen Wertes           & 10♠ {\color{red}10♥} J♦ 8♣ {\color{red}6♥}            & Höhe des Paars + Beikarten            & 43,83 \% \\
    Zwei Paare (Two Pair)         & Zwei Paare                            & {\color{red}J♦} J♠ 8♣ 8♠ A♠                           & Höhe der Paare + Beikarten            & 23,50 \% \\
    Drilling \\(Three of a Kind)  & Drei Karten gleichen Wertes           & Q♣ {\color{red}Q♥} Q♠ {\color{red}A♥} 4♣              & Höhe des Drillings + Beikarten        & 4,83 \% \\
    Straße (Straight)             & Fünf Karten in einer Reihe            & {\color{red}7♥} 8♣ {\color{red}9♦ 10♥} J♠             & Höchste Karte                         & 4,62 \% \\
    Flush                         & Fünf Karten in einer Farbe            & 3♠ 5♠ 8♠ 9♠ K♠                                        & Höhe der einzelnen Karten             & 3,03 \% \\
    Full House                    & Ein Drilling und ein Paar             & {\color{red}K♥} K♣ {\color{red}K♦} 9♠ {\color{red}9♦} & Höhe des Drillings und Höhe des Paars & 2,60 \% \\
    Four of a Kind                & Vier Karten gleichen Wertes           & A♣ {\color{red}A♦ A♥} A♠ 4♠                           & Höhe des Vierlings und der Beikarte   & 0,17 \% \\
    Straight Flush                & Straße in einer Farbe                 & 8♣ 9♣ 10♣ J♣ Q♣                                       & Höchste Karte                         & 0,028 \% \\
    Royal Flush                   & Straße in einer Farbe, Zehn bis Ass   & {\color{red}10♦ J♦ Q♦ K♦ A♦}                          & Split Pot                             & 0,003 \% \\


    \bottomrule

  \end{tabularx}
  \label{tab:Rangfolge der Pokerhände aufsteigend}

\end{table}

\end{document}

Update.
It seems your tutor wants you to learn LaTeX using standard methods. Tricks are left for later until you have learned and understood the basics. I'd choose the same approach.

The table is wordy and IMO the only thing you can think of is to increase width of columns that contain long phrases; plus decrease font size of the whole table if that's necessary. Then, rows would be reduced to two lines. The table should fit your page without any non-standard changes. Because you can't use \hsize and you still need to control widths of particular columns, I double you really need tabularx; perhaps to use it as a "filler" for the last column.

I did more or less what I suggested above. I changed font size to \footnotesize and increased columns widths using fixed lengths and p{} and below is the table

enter image description here

\documentclass[paper=a4, fontsize=12pt, parskip=half, captions=tableabove]{scrartcl}
\usepackage[top=3.5cm, bottom=3.5cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage[font=singlespacing]{caption}
    \captionsetup[table]{position=top, skip=3pt}
\usepackage{setspace}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{ragged2e,microtype}
\usepackage[autostyle = true, german = quotes]{csquotes}
\usepackage{polyglossia}
    \setdefaultlanguage{german}
    \setotherlanguages{english}
\usepackage{ulem}
\usepackage[x11names]{xcolor}
\usepackage[
  plainheadsepline=true,
  plainfootsepline=true,
  headsepline=0.6pt,
  footsepline=0.6pt,
]{scrlayer-scrpage}

\clearpairofpagestyles
\automark{section}
\ohead{\headmark}
\cfoot{\pagemark}
\pagestyle{scrheadings}

% Added
\renewcommand{\tabularxcolumn}[1]{>{\footnotesize}p{#1}}
\newcommand\xthead[1]{\small#1}
\newcolumntype{P}[1]{>{\footnotesize\RaggedRight}p{#1}}

\begin{document}
\section{Random section}

\begingroup
  \renewcommand{\arraystretch}{1.4}
  \belowrulesep=0pt
  \aboverulesep=0pt
  \begin{table}[hb]
    \caption{Rangfolge der Pokerhände aufsteigend}
    \centering
    \begin{tabularx}{\textwidth}{P{2.4cm} c | P{3.2cm} c P{3.2cm} >{\Centering}X}
      \toprule
      %erste Zeile
      \xthead{Name}
        && \xthead{Bedeutung}
        & \xthead{Beispiel}
        & \xthead{Entscheidungskriterium}
        & \xthead{Wahrschein-\newline lichkeit (\%)} \\
      \cmidrule(r{-6pt}){1-1} \cmidrule(l{6pt}){3-6}
      %restliche Zeilen
      Höchste Karte                       && Keine der unteren Kombinationen       & A♠ {\color{red}K♦} J♠ 7♣ 4♣                           & Höhe der einzelnen Karten             & 17,41 \\
      Ein Paar\newline (One Pair)         && Zwei Karten gleichen Wertes           & 10♠ {\color{red}10♥} J♦ 8♣ {\color{red}6♥}            & Höhe des Paars\newline+ Beikarten     & 43,83 \\
      Zwei Paare\newline(Two Pair)        && Zwei Paare                            & {\color{red}J♦} J♠ 8♣ 8♠ A♠                           & Höhe der Paare\newline+ Beikarten     & 23,50 \\
      Drilling\newline (Three of a Kind)  && Drei Karten gleichen Wertes           & Q♣ {\color{red}Q♥} Q♠ {\color{red}A♥} 4♣              & Höhe des Drillings\newline+ Beikarten & 4,83  \\
      Straße\newline(Straight)            && Fünf Karten in einer Reihe            & {\color{red}7♥} 8♣ {\color{red}9♦ 10♥} J♠             & Höchste Karte                         & 4,62  \\
      Flush                               && Fünf Karten in einer Farbe            & 3♠ 5♠ 8♠ 9♠ K♠                                        & Höhe der einzelnen Karten             & 3,03  \\
      Full House                          && Ein Drilling und ein Paar             & {\color{red}K♥} K♣ {\color{red}K♦} 9♠ {\color{red}9♦} & Höhe des Drillings und Höhe des Paars & 2,60  \\
      Four of a Kind                      && Vier Karten gleichen Wertes           & A♣ {\color{red}A♦ A♥} A♠ 4♠                           & Höhe des Vierlings und der Beikarte   & 0,17  \\
      Straight Flush                      && Straße in einer Farbe                 & 8♣ 9♣ 10♣ J♣ Q♣                                       & Höchste Karte                         & 0,028 \\
      Royal Flush                         && Straße in einer Farbe, Zehn bis Ass   & {\color{red}10♦ J♦ Q♦ K♦ A♦}                          & Split Pot                             & 0,003 \\


      \bottomrule

    \end{tabularx}
    \label{tab:Rangfolge der Pokerhände aufsteigend}
  \end{table}
\endgroup
\end{document}
3
  • Thank you very much. This is exactly what I was looking for. Fran made me a little unsure about how clean this option is, though (whatever clean really means). Commented Sep 4, 2022 at 16:50
  • Is there maybe another option to reduce the height of the floats so that it fits into the default \textfraction format, e.g. by reducing the amount of lines needed for the contents (=wider columns)? I wouldn't know how I can do this effectively (with the tabularx package at least). \hsize for specific column width is heavily banned, too. Commented Sep 4, 2022 at 16:54
  • @Fran's is right. The LaTeX standard settings are for a reason. However, you sometimes need to make unconventional changes but that should be justified. You could also make those changes local if you enclose the whole table with the settings inside a group. As to your table, I can't think of anything else then decreasing font and changing columns because the table contain a lot of long phrases. See my update.
    – Celdor
    Commented Sep 4, 2022 at 18:51
3
  • What you can do when size of floats is bigger than default reserved space for it, is explained in other answers. So comments below is regarding this problem, off-topic
  • Your document example seems to be erroneous, compiling it, i get error
! Class scrartcl Error: incompatible `everysel' detected .
  • fonts, which contain playcards symbols, is not loaded, i.e. it is unknown
  • with better formatting of table, given table is less tall and can be fit on page without changing default setions of \textfraction, \bottomfraction etc.
  • for table is suggest to use tabularray package. Using it, the table code is short and simple:
% !TEX TS-program = lualatex
\documentclass[paper=a4, fontsize=12pt, 
               parskip=half, 
               captions=tableabove]{scrartcl}
\usepackage[vmargin=3.5cm, hmargin=2.5cm,
            showframe
            ]{geometry}
\usepackage[plainheadsepline=true, plainfootsepline=true,
            headsepline=0.6pt, footsepline=0.6pt]{scrlayer-scrpage}

\usepackage[autostyle = true, german = quotes]{csquotes}
\usepackage{polyglossia}
\usepackage{libertine} % added for playcards symbols
\setdefaultlanguage{german}
\setotherlanguages{english}

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

\pagestyle{scrheadings}
\clearpairofpagestyles

\ohead{\headmark}
\automark{section}
\cfoot{\pagemark}

\usepackage[font=singlespacing]{caption}
\usepackage{setspace}
                                
\usepackage{ragged2e}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\sisetup{locale = DE}

\usepackage{lipsum}
%\renewcommand\textfraction{.1}     % in your case is not needed
%\renewcommand\bottomfraction{.9}   % in your case is not needed

\begin{document}

\subsubsection{Random subsubsection}
\lipsum[66]
\begin{table}[htb]
    \caption{Rangfolge der Pokerhände aufsteigend}
    \label{tab:Rangfolge der Pokerhände aufsteigend}
    \begin{tblr}{colsep=4pt,
                 colspec = {@{} X[l] | X[l] c X[1.2,l] X[0.8, c,si={table-format=2.3{\,\%},
                                                                         table-align-text-after=false}] @{}
                            },
                 rowsep = 3pt,
                 row{1}  = {guard}
                }
        \toprule
% column heders
Name    &   Bedeutung   
            &   Beispiel    
                &   Entscheidungskriterium      &   Wahrscheinlichkeit  \\
        \midrule
%restliche Zeilen
Höchste Karte               
        &   Keine der unteren Kombinationen     
            &   A♠ \textcolor{red}{K♦} J♠ 7♣ 4♣                             
                &   Höhe der einzelnen Karten               &   17.41 \% \\
{Ein Paar\\ (One Pair)}         
    &   Zwei Karten gleichen Wertes         
        &   10♠ \textcolor{red}{10♥} J♦ 8♣ \textcolor{red}{6♥}             
            &   Höhe des Paars + Beikarten                  &   43.83\,\% \\
{Zwei Paare\\ (Two Pair)}       
    &   Zwei Paare                          
        &   \textcolor{red}{J♦} J♠ 8♣ 8♠ A♠
            &   Höhe der Paare + Beikarten                  &   23.50\,\% \\
{Drilling\\  (Three of a Kind) } 
    &   Drei Karten gleichen Wertes         
        &   Q♣ \textcolor{red}{Q♥} Q♠ \textcolor{red}{A♥} 4♣                
                &   Höhe des Drillings + Beikarten          &   4.83\,\% \\
Straße (Straight)
    &   Fünf Karten in einer Reihe
        &   \textcolor{red}{7♥} 8♣ \textcolor{red}{9♦ 10♥} J♠
            &   Höchste Karte                               &   4.62\,\% \\
Flush
    &   Fünf Karten in einer Farbe
        &   3♠ 5♠ 8♠ 9♠ K♠
            &   Höhe der einzelnen Karten                   &   3.03\,\% \\                
Full House
    &   Ein Drilling und ein Paar
        &   \textcolor{red}{K♥} K♣ \textcolor{red}{K♦} 9♠ \textcolor{red}{9♦}
            &   Höhe des Drillings und Höhe des Paars       &   2.60\,\% \\
Four of a Kind
    &   Vier Karten gleichen Wertes
        &   A♣ \textcolor{red}{A♦ A♥} A♠ 4♠
            &   Höhe des Vierlings und der Beikarte         &   0.17\,\% \\
Straight Flush
    &   Straße in einer Farbe
        &   8♣ 9♣ 10♣ J♣ Q♣
            &   Höchste Karte                               &   0.028\,\% \\
Royal Flush
    &   Straße in einer Farbe, Zehn bis Ass
        &   \textcolor{red}{10♦ J♦ Q♦ K♦ A♦}
            &   Split Pot                                   &   0.003\,\% \\
                
\bottomrule
    \end{tblr}
\end{table}
\end{document}
        \bottomrule
    \end{tblr}
\end{table}

\end{document}

enter image description here

Addedndum: From your comment below can be understand, that in last column table you not like to have numbers aligned at decimal comas. In this case you change table preamble to:

    \begin{tblr}{colsep=4pt,
                 colspec = {@{} X[l] | X[l] c X[1.2,l] X[0.8, l] @{}
                            },
                 rowsep = 3pt,
                }

and you will get (to my opinion not so nice result as is original answer) the following result:

enter image description here

But this is up to you. BTW, you already accept other answer, so this addendum actually you is not needed .... `

2
  • Thank you very much for this response. The table does look pretty nice indeed :). I am not that familiar with the tabulararray package, though so I wouldn't know how to make the bottom rows of the last column left aligned, too. The first row, I just had to change c to l of course but the other rows with the percentages? Or is it better style to have them centered and I should leave it like that? Commented Sep 4, 2022 at 16:16
  • 1
    @FelixStöber, table in my answer follows to your design of table. The tabularray has good documentation where you can find a lot of examples. Why you like to have last column left aligned? now is alligned at decimal points. If you not like this (nice) design, see the addedndum to answer (will appear asap).
    – Zarko
    Commented Sep 4, 2022 at 17:12
2

The tutor may have banned [h!], but he/she didn't ban [h] as well, right? If so, redistributing the column widths is enough to make the table fit on the page, along with the subsubsection-level header. The only use of [h] is to make sure the table is placed below rather than above the subsubsection-level header.

enter image description here

% !TEX TS-program = lualatex
\documentclass[paper=a4, 
               fontsize=12pt, 
               parskip=half, 
               captions=tableabove]{scrartcl}

\usepackage[vmargin=3.5cm, hmargin=2.5cm]{geometry}

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

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

\usepackage[plainheadsepline=true, 
            plainfootsepline=true, 
            headsepline=0.6pt, 
            footsepline=0.6pt]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearpairofpagestyles

\ohead{\headmark}
\automark{section}
\cfoot{\pagemark}

\usepackage[font=singlespacing,skip=0.333\baselineskip]{caption}
\usepackage{setspace,booktabs}

\usepackage{tabularx,ragged2e}
%% Define a variable-width X-type column type:
\newcolumntype{L}[1]{>{\RaggedRight\hsize=#1\hsize}X}

\begin{document}
\setcounter{section}{3}    % just for this example
\setcounter{subsection}{2} % just for this example
\subsubsection{Random subsubsection}

\begin{table}[h]
\caption{Rangfolge der Pokerhände aufsteigend}
\label{tab:Rangfolge der Pokerhände aufsteigend}

\begin{tabularx}{\textwidth}{@{} L{1} L{1.12} l L{1.1} L{0.78} @{}}
% rule: sum of arguments (1+1.12+1.1+0.78=4) must equal # of X-type cols (4)

\toprule

% erste Zeile
Name & Bedeutung & Beispiel & Entscheidungskriterium & Wahrscheinlichkeit \\
 
\midrule
 
% restliche Zeilen
Höchste Karte & Keine der unteren Kombinationen & A♠ {\color{red}K♦} J♠ 7♣ 4♣ & Höhe der einzelnen Karten & 17,41\,\% \\ \addlinespace
 
Ein Paar \newline (One Pair) & Zwei Karten gleichen Wertes & 10♠ {\color{red}10♥} J♦ 8♣ {\color{red}6♥} & Höhe des Paars + Beikarten & 43,83\,\% \\ \addlinespace
 
Zwei Paare \newline (Two Pair) & Zwei Paare & {\color{red}J♦} J♠ 8♣ 8♠ A♠ & Höhe der Paare + Beikarten & 23,50\,\% \\ \addlinespace
 
Drilling (Three of a Kind) & Drei Karten gleichen Wertes & Q♣ {\color{red}Q♥} Q♠ {\color{red}A♥} 4♣ & Höhe des Drillings + Beikarten & 4,83\,\% \\ \addlinespace
 
Straße \newline (Straight) & Fünf Karten in einer Reihe & {\color{red}7♥} 8♣ {\color{red}9♦ 10♥} J♠ & Höchste Karte & 4,62\,\% \\ \addlinespace
 
Flush & Fünf Karten in einer Farbe & 3♠ 5♠ 8♠ 9♠ K♠ & Höhe der einzelnen Karten & 3,03\,\% \\ \addlinespace
 
Full House & Ein Drilling und ein Paar & {\color{red}K♥} K♣ {\color{red}K♦} 9♠ {\color{red}9♦} & Höhe des Drillings und Höhe des Paars & 2,60\,\% \\ \addlinespace
 
Vierling (Four of a Kind) & Vier Karten gleichen Wertes & A♣ {\color{red}A♦ A♥} A♠ 4♠ & Höhe des Vierlings und der Beikarte & 0,17\,\% \\ \addlinespace
 
Straight Flush & Straße in einer Farbe & 8♣ 9♣ 10♣ J♣ Q♣ & Höchste Karte & 0,028\,\% \\ \addlinespace
 
Royal Flush & Straße in einer Farbe, 10 bis Ass & {\color{red}10♦ J♦ Q♦ K♦ A♦} & Split Pot & 0,003\,\% \\

\bottomrule

\end{tabularx} 
\end{table}
\end{document}
2
  • Thanks for this answer. h is not directly banned but it didn't work in this case, either. Though your solution is great, \hsize is also very much banned, unfortunately. I had an \hsize - based column width - table in the first try of this paper but it came back as "absolutely inacceptable" when I got my evaluation. That's because it's a TeX command that shall only be used when one knows how to handle it, and was not taught in the class. For context, it is a basic LaTeX course that is mostly visited by students who don't spend as much time on their pc as me and rather go outside :) Commented Sep 4, 2022 at 16:47
  • @FelixStöber -- That course you've been taking sounds like it's being taught by a bunch or weirdo cultists...
    – Mico
    Commented Sep 4, 2022 at 19:34

You must log in to answer this question.

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