[Tex/LaTex] Table to fit beamer slide

beamertables

I have the following code:

\documentclass[xcolor=table]{beamer}

\usepackage{pgf}
\usepackage{polski}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usepackage{etoolbox}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usepackage{ragged2e}
\usepackage[utf8]{inputenc}
\usepackage{xcolor,hyperref}
\usepackage{graphicx}
\usepackage{float}
\usepackage{eurosym}
\usepackage[export]{adjustbox}
\usetheme{boxes}
\usecolortheme{default}
\usefonttheme{serif}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\beamersetaveragebackground{white}
\pretocmd{\tableofcontents}{\begin{minipage}{\textwidth}}{}{}
\apptocmd{\tableofcontents}{\end{minipage}}{}{}
  \usepackage{pgfplots, pgfplotstable}
\begin{document}
    \begin{frame}
        \begin{table}[]
            \centering
            \caption{My caption}
            \label{my-label}
            \resizebox{11.5cm}{!}{
            \begin{tabular}{|c|c|c|c|c|}
                \hline
                Kraj                   & Okres zwiększonej podaży pieniądza & Liczba kwartałów      & Liczba epizodów       & Inflacja                   \\ \hline
                Kanada                 & 1972 Q1 - 1974 Q2                  & 4                     & 5                     & {\color[HTML]{009901} TAK} \\ \hline
                & 1978 Q4 - 1983 Q1                  & 18                    &                       & {\color[HTML]{FE0000} NIE} \\ \hline
                & 1986 Q4 - 1987 Q3                  & 4                     &                       & {\color[HTML]{FE0000} NIE} \\ \hline
                & 1990 Q3 - 1993 Q4                  & 14                    &                       & {\color[HTML]{FE0000} NIE} \\ \hline
                & 1996 Q1 - 1998 Q4                  & 12                    &                       & {\color[HTML]{009901} TAK} \\ \hline
                \multicolumn{1}{|l|}{} & \multicolumn{1}{l|}{}              & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{}      \\ \hline
                Dania                  & 1975 Q4 - 1978 Q1                  & 10                    & 4                     & {\color[HTML]{009901} TAK} \\ \hline
                & 1984 Q2 - 1988 Q4                  & 19                    &                       & {\color[HTML]{FE0000} NIE} \\ \hline
                & 1992 Q2 - 1994 Q3                  & 10                    &                       & {\color[HTML]{009901} TAK} \\ \hline
                & 1996 Q4 - 1999 Q3                  & 12                    &                       & {\color[HTML]{009901} TAK} \\ \hline
                \multicolumn{1}{|l|}{} & \multicolumn{1}{l|}{}              & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{}      \\ \hline
                Francja                & 1990 Q3 - 1993 Q4                  & 14                    & 2                     & {\color[HTML]{FE0000} NIE} \\ \hline
                & 1995 Q3 - 1996 Q3                  & 4                     &                       & {\color[HTML]{FE0000} NIE} \\ \hline
            \end{tabular}}
        \end{table}
    \end{frame}
\end{document}

It generates a table that it tilted to the right of a beamer slide i want this table to be of precisely the slide size width (height proportionally). And obviously i want to have it in the centre of a slide.

Best Answer

Are two-line column headers acceptable to you?

enter image description here

I add makecell package for simple settings of column headers and siunitx for nicer numbers align in the third column:

\documentclass[xcolor=table]{beamer}
\usepackage{pgf}
\usepackage{polski}
\usetikzlibrary{intersections}
\usepackage{etoolbox}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usepackage{ragged2e}
\usepackage[utf8]{inputenc}
\usepackage{xcolor,hyperref}
\usepackage{graphicx}
\usepackage{float}
\usepackage{eurosym}
\usepackage[export]{adjustbox}
\usetheme{boxes}
\usecolortheme{default}
\usefonttheme{serif}
\usetikzlibrary{shapes,arrows}
\beamersetaveragebackground{white}
\pretocmd{\tableofcontents}{\begin{minipage}{\textwidth}}{}{}
\apptocmd{\tableofcontents}{\end{minipage}}{}{}
  \usepackage{pgfplots, pgfplotstable}
\usepackage{makecell}
\usepackage{siunitx}

\begin{document}
\begin{frame}
    \begin{table}[]
        \centering
        \caption{My caption}
        \label{my-label}
\begin{tabular}{|c|c|S[table-format=2.0]|c|c|}
    \hline
\thead{Kraj} & \thead{Okres zwiększonej\\ podaży pieniądza} 
                & {\thead{Liczba\\ kwartałów}}      
                    & \thead{Liczba\\ epizodów}       
                        & \thead{Inflacja}                   \\ \hline
    Kanada                 & 1972 Q1 - 1974 Q2                  & 4                     & 5                     & {\color[HTML]{009901} TAK} \\ \hline
    & 1978 Q4 - 1983 Q1                  & 18                    &                       & {\color[HTML]{FE0000} NIE} \\ \hline
    & 1986 Q4 - 1987 Q3                  & 4                     &                       & {\color[HTML]{FE0000} NIE} \\ \hline
    & 1990 Q3 - 1993 Q4                  & 14                    &                       & {\color[HTML]{FE0000} NIE} \\ \hline
    & 1996 Q1 - 1998 Q4                  & 12                    &                       & {\color[HTML]{009901} TAK} \\ \hline
    \multicolumn{1}{|l|}{} & \multicolumn{1}{l|}{}              & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{}      \\ \hline
    Dania                  & 1975 Q4 - 1978 Q1                  & 10                    & 4                     & {\color[HTML]{009901} TAK} \\ \hline
    & 1984 Q2 - 1988 Q4                  & 19                    &                       & {\color[HTML]{FE0000} NIE} \\ \hline
    & 1992 Q2 - 1994 Q3                  & 10                    &                       & {\color[HTML]{009901} TAK} \\ \hline
    & 1996 Q4 - 1999 Q3                  & 12                    &                       & {\color[HTML]{009901} TAK} \\ \hline
    \multicolumn{1}{|l|}{} & \multicolumn{1}{l|}{}              & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{}      \\ \hline
    Francja                & 1990 Q3 - 1993 Q4                  & 14                    & 2                     & {\color[HTML]{FE0000} NIE} \\ \hline
    & 1995 Q3 - 1996 Q3                  & 4                     &                       & {\color[HTML]{FE0000} NIE} \\ \hline
\end{tabular}
%}
\end{table}
\end{frame}
\end{document}

Edit: See, if you like the following, more professional look of table. For it I use package booktabs. I also rearrange your preamble, than now is more consistent and delete repeating load of some package and also package loaded by beamer (\graphicx,hyperref) and select small font size (\small`).

\documentclass[xcolor=table]{beamer}
\usetheme{boxes}
\usecolortheme{default}
\usefonttheme{serif}
\beamersetaveragebackground{white}
\usepackage[utf8]{inputenc}
\usepackage{eurosym}
\usepackage{polski}
\usepackage{etoolbox}
\usepackage{pgfplots, pgfplotstable}
\usetikzlibrary{arrows,
                calc,
                intersections,
                shapes}
\usepackage{mathrsfs}
\usepackage{ragged2e}

\usepackage{booktabs,makecell}% <-- added
\renewcommand\theadfont{\small}% <-- added
\usepackage{siunitx}% <-- added

\pretocmd{\tableofcontents}{\begin{minipage}{\textwidth}}{}{}
\apptocmd{\tableofcontents}{\end{minipage}}{}{}


\begin{document}
\begin{frame}
    \begin{table}
        \centering
    \caption{My caption}
        \label{my-label}
    \small
\begin{tabular}{ccS[table-format=2.0]cc}
    \toprule
\thead{Kraj} 
        &   \thead{Okres zwiększonej\\ podaży pieniądza} 
            &   {\thead{Liczba\\ kwartałów}}
                &   \thead{Liczba\\ epizodów}
                    &   \thead{Inflacja}                                \\
    \midrule
Kanada  & 1972 Q1 - 1974 Q2 &   4   &   5   & {\color[HTML]{009901} TAK} \\
        & 1978 Q4 - 1983 Q1 &  18   &       & {\color[HTML]{FE0000} NIE} \\
        & 1986 Q4 - 1987 Q3 &   4   &       & {\color[HTML]{FE0000} NIE} \\
        & 1990 Q3 - 1993 Q4 &  14   &       & {\color[HTML]{FE0000} NIE} \\
        & 1996 Q1 - 1998 Q4 &  12   &       & {\color[HTML]{009901} TAK} \\
    \midrule
Dania   & 1975 Q4 - 1978 Q1 &  10   &   4   & {\color[HTML]{009901} TAK} \\
        & 1984 Q2 - 1988 Q4 &  19   &       & {\color[HTML]{FE0000} NIE} \\
        & 1992 Q2 - 1994 Q3 &  10   &       & {\color[HTML]{009901} TAK} \\
        & 1996 Q4 - 1999 Q3 &  12   &       & {\color[HTML]{009901} TAK} \\
    \midrule
Francja & 1990 Q3 - 1993 Q4 &  14   &   2   & {\color[HTML]{FE0000} NIE} \\
        & 1995 Q3 - 1996 Q3 &   4   &       & {\color[HTML]{FE0000} NIE} \\ 
        \bottomrule
\end{tabular}
    \end{table}
\end{frame}
\end{document}

enter image description here