适合投影仪滑块的桌子

适合投影仪滑块的桌子

我有以下代码:

\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}

它生成一个向投影仪幻灯片右侧倾斜的表格,我希望该表格的宽度与幻灯片大小完全一致(高度成比例)。显然,我希望将其放在幻灯片的中心。

答案1

两行列标题您能接受吗?

在此处输入图片描述

我添加了makecell一个包,用于对列标题进行简单的设置,并使siunitx第三列的数字对齐更加美观:

\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}

编辑: 看看,如果你喜欢下面的更专业的表格。对于它,我使用包booktabs。我还重新安排了你的序言,比现在更一致,并删除了一些包的重复加载以及由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}

在此处输入图片描述

答案2

基于大卫·卡莱尔斯评论

\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}
            \makebox[0pt]{\resizebox{.98\paperwidth}{!}{%
            \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}

在此处输入图片描述

答案3

您可以使用columns具有唯一列的环境:

\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}
    \begin{columns}
      \column{\paperwidth}
      \resizebox{\linewidth}{!}{%
        \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{columns}
  \end{table}
\end{frame}
\end{document}

相关内容