如何在 Beamer 或 Prosper 中放置图表?

如何在 Beamer 或 Prosper 中放置图表?

我现在非常困惑,不知道如何将我已经拥有的内容实现到 Beamer 或 Prosper 中进行演示...我尝试过使用两者并以不同的方式放置它,但都没有用。我让它工作了一次,但它只在页面上显示了 2 个“项目框”(总共有 5 个)。我最初拥有的内容如下,任何帮助将其放入 Beamer/Prosper 进行演示的帮助都将不胜感激。谢谢!

\documentclass[landscape, 12pt]{report} 
\usepackage{ocgx}
\usepackage{tikz}
\usepackage{array}

\addtolength{\oddsidemargin}{-2.90in} 
\addtolength{\evensidemargin}{-2.90in}
\addtolength{\textwidth}{4in}

\newcommand{\myarrow}{\raisebox{1ex}{\tikz \draw[->, line width=1.25mm] (0,0)--++(1,0);}}

\newcommand{\ocgItem}[2]{%
\colorbox{%
\ifcase#1 \or
red\or
green\fi
}{\huge Item 1}%
}
\begin{document}
\begin{minipage}[t]{5cm}
\switchocg{ocg1}{%
\fcolorbox{black}{white}{%
    \bfseries\Large%
    \resizebox{5cm}{!}{\begin{tabular}{c c c c c c c c c c c c c c}  
\\
\\
\\
  {\Huge Project 1} \\ 
\\
\\
\\
\end{tabular}}}}\\%
    \begin{ocg}{OCG 1}{ocg1}{0}
            \colorbox{white}{%
                \parbox{10cm}{%
                    \colorbox{green}{\begin{center}
\begin{tabular}{m{4.18cm}} 
  Step 1
\end{tabular}
\end{center}
}\\%
                    \colorbox{red}{\normalsize \color{white}{\begin{center}
\begin{tabular}{m{4.3cm}} 
  Step 2
\end{tabular}
\end{center}}}\\%
                    \colorbox{green}{\normalsize \begin{center}
\begin{tabular}{m{4.3cm}} 
  Step 3
\end{tabular}
\end{center}}\\%
                    \colorbox{red}{\normalsize \color{white}{\begin{center}
\begin{tabular}{m{4.3cm}} 
  Step 4
\end{tabular}
\end{center}}}\\%
                    \colorbox{green}{\normalsize \begin{center}
\begin{tabular}{m{4.3cm}} 
  Step 5
\end{tabular}
\end{center}}\\%
                    \colorbox{green}{\normalsize \begin{center}
\begin{tabular}{m{4.3cm}} 
  Step 6
\end{tabular}
\end{center}}%
                    }%
                 }
    \end{ocg}
\end{minipage}%
\indent \myarrow
\indent \begin{minipage}[t]{5cm}
\switchocg{ocg2}{%
\fcolorbox{black}{white}{%
    \bfseries\Large%
    \resizebox{5cm}{!}{\begin{tabular}{c c c c c c c c c c c c c c}
\\
\\
\\
  {\Huge Project 2} \\ 
\\
\\
\\
\end{tabular}}}}\\%
    \begin{ocg}{OCG 2}{ocg2}{0}
            \colorbox{white}{%
                \parbox{10cm}{%
                     \colorbox{red}{\normalsize \color{white}{\begin{center}
\begin{tabular}{m{4.3cm}} 
  Step 1
\end{tabular}
\end{center}}}\\%
                    \colorbox{green}{\normalsize \begin{center}
\begin{tabular}{m{4.3cm}} 
  Step 2 
\end{tabular}
\end{center}}%
                    }%
                }
    \end{ocg}
\end{minipage}%
\end{document}

答案1

不幸的是,您的示例无法为我编译,因此该答案基于您上一个问题的答案https://tex.stackexchange.com/a/316483/36296

因此将代码转换为 beamer 非常简单,只需minipageframe环境替换最外层即可:

\documentclass{beamer}
\usepackage{ocgx}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{calc}
\newlength{\BOXlength}
\setlength{\BOXlength}{%
    \widthof{%
        \fcolorbox{black}{white}{%
            \bfseries\Large%
            \resizebox{2cm}{!}{Box 2}}}%
}


\newcommand{\ocgItem}[2]{%
    % input:
    % #1: colorselection. write 1 here for red, 2 for green
    % #2: The Text displayed.
    % Example: \ocgItem{2}{Item 1}\\% Produces green
    \colorbox{%
        \ifcase#1 \or
        red\or%1
        green\fi%2
    }{\huge #2}%
}
\begin{document}
    \begin{frame}
        \centering
        \begin{minipage}[t]{\BOXlength}
            \switchocg{ocg1}{%
                \fcolorbox{black}{white}{%
                    \bfseries\Large%
                    \resizebox{2cm}{!}{Box 1}}}\\%
            \begin{ocg}{OCG 1}{ocg1}{0}
                \colorbox{white}{%
                    \parbox{10cm}{%
                        \ocgItem{2}{Item 1}\\%
                        \ocgItem{1}{Item 2}\\%
                        \ocgItem{2}{Item 3}\\%
                        \ocgItem{1}{Item 4}%
                    }%
                }
            \end{ocg}
        \end{minipage}\hspace{2em}
        \begin{minipage}[t]{\BOXlength}
            \switchocg{ocg2}{%
                \fcolorbox{black}{white}{%
                    \bfseries\Large%
                    \resizebox{2cm}{!}{Box 2}}}\\%
            \begin{ocg}{OCG 2}{ocg2}{1}
                \colorbox{white}{%
                    \parbox{10cm}{%
                        \ocgItem{1}{Item 1}\\%
                        \ocgItem{2}{Item 2}\\%
                        \ocgItem{1}{Item 3}\\%
                        \ocgItem{2}{Item 4}%
                    }%
                }
            \end{ocg}
        \end{minipage}%
\end{frame}
\end{document}

在此处输入图片描述

相关内容