在 texWorks 中制作交互式幻灯片

在 texWorks 中制作交互式幻灯片

我想为我的演示文稿制作交互式幻灯片。这是我第一次尝试使用这种类型的幻灯片。我发现了 邮政 然后应用命令Highlightonly。但是我无法创建我想要的内容。我用下面的代码解释:

\documentclass[10pt,aspectratio=1610]{beamer}
\usepackage{natbib}
\usepackage{enumerate}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[utf8]{inputenc}
\usepackage{mwe}
\usepackage{etoolbox}
\usepackage{bookmark}
\usepackage{subcaption}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{pdflscape}
\usepackage{float}
\usepackage{amsmath}
\usepackage{ragged2e}
\usepackage{blindtext}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage{bigints}
\usepackage{caption}
\usepackage{xcolor}
\usepackage{stackengine}
\usepackage{multirow}
\usepackage{hyperref}
\usepackage{textgreek} 
\usepackage{color, colortbl}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\usepackage{fancyvrb}
\usepackage{fvextra}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\tiny
\setbeamertemplate{footline}[text line]{%
\parbox{\linewidth}{\vspace*{-8pt}some text\hfill\insertauthor\hfill\insertpagenumber}}
\setbeamertemplate{navigation symbols}{}

\setbeamercolor{framesubtitle}{fg=white!40!black}
\usetheme{Madrid}
\usecolortheme{seagull}

\makeatletter
\setbeamertemplate{footline}{
  \leavevmode%
  \hbox{% 
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=3.2ex,dp=1.6ex,right]{author in head/foot}%
\usebeamerfont{author in head/foot} \insertshortauthor \hspace{1mm} \expandafter\ifblank\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=3.2ex,dp=1.6ex,left]{date in head/foot}%   
   \hspace{1mm}  \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother
 \setbeamerfont{institute}{size=\fontsize{10pt}{10pt}}
  \setbeamerfont{title}{size=\fontsize{16pt}{16pt}}
  \setbeamerfont{author}{size=\fontsize{14pt}{14pt}}
\usepackage{graphicx}
\usetheme{Madrid}
\setbeamertemplate{caption}[numbered]

\begin{document}
\begingroup
\setbeamertemplate{footline}{}
\begin{frame}
\titlepage
\end{frame}
\endgroup

\makeatletter
\patchcmd{\beamer@subsubsectionintoc}
{\vfill}
{\vskip\itemsep{5ex}}
{}
{}
\makeatother

\hypersetup{
bookmarksnumbered=true
}
\setcounter{tocdepth}{5}

\makeatletter
\patchcmd{\beamer@subsubsection}
{\Hy@writebookmark{\the\c@subsubsection}{#2}}%
{\Hy@writebookmark{\the\c@subsubsection}{\numberline{\thesection.\thesubsection.\thesubsubsection}#2}}%
{}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% I just copy pasted some codes. I actually do not get what they mean.%%%%%%%%%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcounter{tmp}
\newcommand<>\Highlight[1]{%
\stepcounter{tmp}%
\only#2{\begin{tikzpicture}[remember picture,overlay]
\fill[gray!60!black,opacity=1] 
  ([xshift=-.2em,yshift=2ex]pic cs:start-\thetmp)
    rectangle  
  ([xshift=.2em,yshift=-1ex]pic cs:end-\thetmp);
\end{tikzpicture}}%
\tikzmark{start-\thetmp}#1\hfill\tikzmark{end-\thetmp}%
}

\begin{frame}{frametiTle}{\begin{Large}framesubtiTle\end{Large}}
\begin{large}\textbf{A BIG LINE}\end{large}

\begin{flalign}
&\; \hspace{5mm} \Highlight<+>{h1=(\textcolor{blue}{1,\,2},\,\textcolor{red}{3,\,4})},&& \nonumber\\
\hspace*{3mm} \text{1 some line some line some line some line some line\vspace*{-5mm}}&\nonumber
\; \genfrac{}{}{0pt}{}{\nearrow}{\searrow}\\
&\;\hspace{5mm} h2=(1,\,2,\,3,\,4),&&\nonumber
\end{flalign}

\hspace*{2mm} 2 another line another line another line another line another line another line another line another line.\vspace{3mm}\\


\only<1> {3 third line:third line:third line:third line:third line:
\begin{alignat}{1}
(a+b)^2
&=(a+b)^2(a+b)^2(a+b)^2(a+b)^2(a+b)^2(a+b)^2\textcolor{green}{(a+b)^2(a+b)^2(a+b)^2}\nonumber \\
(a+b)^2
&=(a+b)^2(a+b)^2(a+b)^2(a+b)^2(a+b)^2(a+b)^2\textcolor{green}{(a+b)^2(a+b)^2(a+b)^2}\nonumber
\end{alignat}
$=(a+b)^2(a+b)^2(a+b)^2$.\vspace{.2cm}\\%
last line last linelast linelast line $\textcolor{green}{(a+b)^2(a+b)^2(a+b)^2}$ \vspace{.2cm}\\
$\textcolor{red}{(a+b)^2(a+b)^2(a+b)^2}$}


\end{frame}
\end{document}

这给出

输出

首先,我想用深灰色隐藏线条和最后一段(从3 third line:third line(a+b)2)。然后我想通过制作其余部分的不透明图像来显示它们。如何在 Beamer 中执行此操作?希望我已经清楚地说明了我的问题。任何帮助都将不胜感激。

答案1

  • 如果您希望某些内容仅在框架内的某些幻灯片上可见,则可以使用\visible<>{...}。与此相比,\only<>{...}其优点是内容仍将占据空间,从而避免了文本在幻灯片之间跳转的问题。

  • 如果你希望某些东西在某些覆盖层上是半透明的,你可以使用\uncover<>{...}(结合例如\setbeamercovered{transparent}

  • 你真的应该清理一下你的前言和文档。有很多包与 beamer 不兼容或没有必要。另外不要多次加载相同的包。

    经验法则:仅使用此特定项目所需的代码,这样您可以避免许多未缩进的副作用。


\documentclass[10pt,aspectratio=1610]{beamer}
\usepackage{natbib}
%\usepackage{enumerate}
%\usepackage{amsmath}
%\usepackage{amssymb}
%\usepackage[utf8]{inputenc}
%\usepackage{mwe}
%\usepackage{etoolbox}
%\usepackage{bookmark}
\usepackage{subcaption}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{pdflscape}
%\usepackage{float}
%\usepackage{amsmath}
\usepackage{ragged2e}
\usepackage{blindtext}
%\usepackage{amsfonts}
%\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage{bigints}
\usepackage{caption}
%\usepackage{xcolor}
\usepackage{stackengine}
\usepackage{multirow}
%\usepackage{hyperref}
\usepackage{textgreek} 
%\usepackage{color, colortbl}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\usepackage{fancyvrb}
\usepackage{fvextra}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\tiny
\setbeamertemplate{footline}[text line]{%
\parbox{\linewidth}{\vspace*{-8pt}some text\hfill\insertauthor\hfill\insertpagenumber}}
\setbeamertemplate{navigation symbols}{}

\setbeamercolor{framesubtitle}{fg=white!40!black}
\usetheme{Madrid}
\usecolortheme{seagull}

\makeatletter
\setbeamertemplate{footline}{
  \leavevmode%
  \hbox{% 
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=3.2ex,dp=1.6ex,right]{author in head/foot}%
\usebeamerfont{author in head/foot} \insertshortauthor \hspace{1mm} \expandafter\ifblank\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=3.2ex,dp=1.6ex,left]{date in head/foot}%   
   \hspace{1mm}  \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother
 \setbeamerfont{institute}{size=\fontsize{10pt}{10pt}}
  \setbeamerfont{title}{size=\fontsize{16pt}{16pt}}
  \setbeamerfont{author}{size=\fontsize{14pt}{14pt}}
%\usepackage{graphicx}
\usetheme{Madrid}
\setbeamertemplate{caption}[numbered]
\setbeamerfont{framesubtitle}{size=\Large}
\setbeamercovered{transparent}

\begin{document}


\makeatletter
\patchcmd{\beamer@subsubsectionintoc}
{\vfill}
{\vskip\itemsep{5ex}}
{}
{}
\makeatother

\hypersetup{
bookmarksnumbered=true
}
\setcounter{tocdepth}{5}

\makeatletter
\patchcmd{\beamer@subsubsection}
{\Hy@writebookmark{\the\c@subsubsection}{#2}}%
{\Hy@writebookmark{\the\c@subsubsection}{\numberline{\thesection.\thesubsection.\thesubsubsection}#2}}%
{}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% I just copy pasted some codes. I actually do not get what they mean.%%%%%%%%%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcounter{tmp}
\newcommand<>\Highlight[1]{%
\stepcounter{tmp}%
\only#2{\begin{tikzpicture}[remember picture,overlay]
\fill[gray!60!black,opacity=1] 
  ([xshift=-.2em,yshift=2ex]pic cs:start-\thetmp)
    rectangle  
  ([xshift=.2em,yshift=-1ex]pic cs:end-\thetmp);
\end{tikzpicture}}%
\tikzmark{start-\thetmp}#1\hfill\tikzmark{end-\thetmp}%
}



\begin{frame}
\frametitle{frametiTle}
\framesubtitle{framesubtiTle}

{\large \textbf{A BIG LINE}}

\begin{flalign}
&\; \hspace{5mm} \visible<2->{\Highlight<2>{h1=(\textcolor{blue}{1,\,2},\,\textcolor{red}{3,\,4})},}&& \nonumber\\
\hspace*{3mm} \text{\uncover<1>{1 some line some line some line some line some line\vspace*{-5mm}}}&\nonumber
\; \uncover<1>{\genfrac{}{}{0pt}{}{\nearrow}{\searrow}}\\
&\;\hspace{5mm} \uncover<1>{h2=(1,\,2,\,3,\,4),}&&\nonumber
\end{flalign}

\hspace*{2mm} \uncover<1>{2 another line another line another line another line another line another line another line another line.\vspace{3mm}}\\


\visible<2-> {3 third line:third line:third line:third line:third line:
\begin{alignat}{1}
(a+b)^2
&=(a+b)^2(a+b)^2(a+b)^2(a+b)^2(a+b)^2(a+b)^2\textcolor{green}{(a+b)^2(a+b)^2(a+b)^2}\nonumber \\
(a+b)^2
&=(a+b)^2(a+b)^2(a+b)^2(a+b)^2(a+b)^2(a+b)^2\textcolor{green}{(a+b)^2(a+b)^2(a+b)^2}\nonumber
\end{alignat}
$=(a+b)^2(a+b)^2(a+b)^2$.\vspace{.2cm}\\%
last line last linelast linelast line $\textcolor{green}{(a+b)^2(a+b)^2(a+b)^2}$ \vspace{.2cm}\\
$\textcolor{red}{(a+b)^2(a+b)^2(a+b)^2}$}


\end{frame}
\end{document}

在此处输入图片描述

相关内容