将表格放置在幻灯片的一角

将表格放置在幻灯片的一角

我想让下一张幻灯片中的表格“浮动”在幻灯片的右上角。我该怎么做?

在此处输入图片描述

\documentclass{beamer}

\begin{document}             
\begin{frame}                                                            
  \begin{itemize}                                                        
    \item comment 1 regarding table                                      
    \item comment 2                                                                                                                               
    \item comment 3                                                      
    \item comment 3                                                      
    \item comment 3                                                      
    \item comment                                                        
    \item comment                                                        
    \item comment                                                        
    \item comment                                                        
    \item tabular should be floating in the upper right corner           
  \end{itemize}                                                          
\begin{tabular}{|c|c|}\hline                                             
0&0\\\hline                                                              
0&0\\\hline                                                              
1&1\\\hline                                                              
0&0\\\hline                                                              
0&1\\\hline                                                              
1&0\\\hline                                                              
\end{tabular}                                                            
\end{frame}                                                              
\end{document}  

答案1

以下是使用 tikz 覆盖的一种方法:

\documentclass[fragile]{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\begin{document}             
\begin{frame}                                                            
  \begin{itemize}                                                        
    \item comment 1 regarding table                                      
    \item comment 2                                                                                                                               
    \item comment 3                                                      
    \item comment 3                                                      
    \item comment 3                                                      
    \item comment                                                        
    \item comment                                                        
    \item comment                                                        
    \item comment                                                        
    \item tabular should be floating in the upper right corner           
  \end{itemize}                                                     

\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east] at ($(current page.north east)+(-1cm,-1.5cm)$){\begin{tabular}{|c|c|}\hline                                             
0&0\\\hline                                                              
0&0\\\hline                                                              
1&1\\\hline                                                              
0&0\\\hline                                                              
0&1\\\hline                                                              
1&0\\\hline                                                              
\end{tabular}};
\end{tikzpicture}
\end{frame}                                         
\end{document}  

在此处输入图片描述

答案2

可以根据column环境创建列。

截屏

\documentclass[]{beamer}
\usetheme{Madrid}
%\usepackage{tikz}

\begin{document}
\begin{frame}  
\begin{columns}[T]
\begin{column}{10cm}
  \begin{itemize}                                                        
    \item comment 1 regarding table                                      
    \item comment 2                                                                                                                               
    \item comment 3                                                      
    \item comment 3                                                      
    \item comment 3                                                      
    \item comment                                                        
    \item comment                                                        
    \item comment                                                        
    \item comment                                                        
    \item tabular should be floating in the upper right corner           
  \end{itemize}  
\end{column}
\begin{column}{5cm}
\begin{tabular}{|c|c|}\hline                                             
0&0\\\hline                                                              
0&0\\\hline                                                              
1&1\\\hline                                                              
0&0\\\hline                                                              
0&1\\\hline                                                              
1&0\\\hline                                                              
\end{tabular} 
\end{column}
\end{columns}                                                          


\end{frame} 
\end{document}

答案3

如何使用minipage环境并控制左/右列\textwidth

输出

\documentclass{beamer}
\begin{document}
\begin{frame}
  \begin{minipage}[t]{0.85\textwidth}% Left side
    \begin{itemize}
      \item comment 1 regarding table
      \item comment 2
      \item comment 3
      \item comment 3
      \item comment 3
      \item comment
      \item comment
      \item comment
      \item comment
      \item tabular should be floating in the upper right corner
    \end{itemize}
  \end{minipage}\begin{minipage}[t]{0.15\textwidth}\vspace{0pt}% Right side
    \begin{tabular}{|c|c|}\hline
      0&0\\\hline
      0&0\\\hline
      1&1\\\hline
      0&0\\\hline
      0&1\\\hline
      1&0\\\hline
    \end{tabular}
  \end{minipage}
\end{frame}
\end{document}

答案4

使用包文本位置。如果希望表格位置更高且更靠右,则可以使用负值:

在此处输入图片描述

\documentclass{beamer}
\usepackage[overlay]{textpos}
\begin{document}             
\begin{frame}                                                            
  \begin{textblock*}{0.15\linewidth}(0.9\textwidth, 0.001\textheight)
\begin{tabular}{|c|c|}\hline                                             
0&0\\\hline                                                              
0&0\\\hline                                                              
1&1\\\hline                                                              
0&0\\\hline                                                              
0&1\\\hline                                                              
1&0\\\hline                                                              
\end{tabular}                                                            
  \end{textblock*}
  \begin{itemize}                                                        
    \item comment 1 regarding table                                      
    \item comment 2                                                                                                                               
    \item comment 3                                                      
    \item comment 3                                                      
    \item comment 3                                                      
    \item comment                                                        
    \item comment                                                        
    \item comment                                                        
    \item comment                                                        
    \item tabular should be floating in the upper right corner           
  \end{itemize}                                                          
\end{frame}                                                              
\end{document} 

相关内容