有没有办法在 beamer 中创建列宽的表格?

有没有办法在 beamer 中创建列宽的表格?

我正在使用 beamer 类编写演示文稿,我想显示一个表格,然后将一些文本分成两列。我尝试使用下面的代码,但它不起作用,而且我找不到太多关于这一点的信息。

\documentclass[10pt]{beamer}
%\usepackage{fullpage}
\usepackage[latin1]{inputenc} %codificação de caracteres ã é etc
\usepackage[english,portuguese]{babel}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{adjustbox}
\usepackage[compatibility=false]{caption}
\usepackage{subcaption}

\mode<presentation> {
\setbeamertemplate{caption}[numbered]

\usetheme{Luebeck}
\usenavigationsymbolstemplate{}



\begin{document}

\begin{frame}
\frametitle{Composição Química} 



\begin{table*}[H]
\centering
%\begin{adjustbox}{max width=\textwidth}
\scalebox{0.8}{
\begin{tabular}{|l|l|l|l|l|l|l|c|c|}
\hline
\textbf{El. Químico} (\%) & \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{Si} & \multicolumn{1}{c|}{Mn} & \multicolumn{1}{c|}{Cr} & \multicolumn{1}{c|}{Mo} & \multicolumn{1}{c|}{V} & P                          & S                          \\      \hline
\textbf{Máximo}           & 1.65                   & 0.40                    & 0.50                    & 13.00                   & 0.90                    & 1.00                   & \multicolumn{1}{l|}{0.030} & \multicolumn{1}{l|}{0.030} \\      \hline
\textbf{Mínimo}           & 1.45                   & 0.10                    & 0.15                    & 11.00                   & 0.60                    & 0.70                   & -                          & -                          \\      \hline
\end{tabular}
}


\caption{Composição Química do aço C 265}
\end{tabular}
%\end{adjustbox}
\label{cq}
\end{table*}


\column{.45\textwidth}

Carborígenos
\begin{itemize}
\item Crómio
\item Vanádio
\item Molibdénio
\end{itemize}

\column{.45\textwidth}

Alfagenos
\begin{itemize}
\item Crómio
\item Vanádio
\item Molibdénio
\item Silício
\end{itemize}




\end{frame}

\end{document}

答案1

这里有几个问题:

  • {后面有一个开头\mode<presentation>但没有结束括号,所以我将其删除了。

  • beamer没有定义星号table环境。而且这样做也没有实际意义,更像columnsbeamer两个彼此相邻的小页面,文本不会从一列流向另一列,例如article

  • 当你想在中使用多列时beamer,你需要将它们包装在一个columns环境中,例如

    \begin{columns}
    \column{0.4\textwidth}
    Text in first column
    \column{0.4\textwidth}
    Text in second column
    \end{columns}
    

在此处输入图片描述

\documentclass[10pt]{beamer}
%\usepackage{fullpage}
\usepackage[latin1]{inputenc} %codificação de caracteres ã é etc
\usepackage[english,portuguese]{babel}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{adjustbox}
\usepackage[compatibility=false]{caption}
\usepackage{subcaption}

\mode<presentation> 
\setbeamertemplate{caption}[numbered]

\usetheme{Luebeck}
\usenavigationsymbolstemplate{}



\begin{document}

\begin{frame}
\frametitle{Composição Química} 



\begin{table}
\centering
\small
\begin{tabular}{|l|l|l|l|l|l|l|c|c|}
\hline
\textbf{El. Químico} (\%) & \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{Si} & \multicolumn{1}{c|}{Mn} & \multicolumn{1}{c|}{Cr} & \multicolumn{1}{c|}{Mo} & \multicolumn{1}{c|}{V} & P                          & S                          \\      \hline
\textbf{Máximo}           & 1.65                   & 0.40                    & 0.50                    & 13.00                   & 0.90                    & 1.00                   & \multicolumn{1}{l|}{0.030} & \multicolumn{1}{l|}{0.030} \\      \hline
\textbf{Mínimo}           & 1.45                   & 0.10                    & 0.15                    & 11.00                   & 0.60                    & 0.70                   & -                          & -                          \\      \hline
\end{tabular}
\caption{Composição Química do aço C 265}
\label{cq}
\end{table}

\begin{columns}
\column{.45\textwidth}

Carborígenos
\begin{itemize}
\item Crómio
\item Vanádio
\item Molibdénio
\end{itemize}

\column{.45\textwidth}

Alfagenos
\begin{itemize}
\item Crómio
\item Vanádio
\item Molibdénio
\item Silício
\end{itemize}

\end{columns}
\end{frame}

\end{document}

相关内容