在 texworks 中制作交互式幻灯片 #2

在 texworks 中制作交互式幻灯片 #2

我发布了我的第一个问题这里samcarter_is_at_topanswers.xyz帮助我找到了正确的答案。现在,我又遇到了另一个问题。是否可以在两张幻灯片上都显示 h1=(1,2,3,4)?如果我想在第一张幻灯片上显示 h1=(1,2,3,4),但在另一张幻灯片上显示 h3=(1,2,3,4)?以下是示例代码:

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

答案1

要在幻灯片之间替换文本,例如h1h3您可以使用\alt<>{some text}{another text}

正如之前所说,请清理您的代码。仅使用您在此特定演示中需要的代码。所有额外的代码和手动格式化都会使您的代码很容易出现问题。

\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} \Highlight<2>{\alt<1>{h1}{h3}=(\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}

在此处输入图片描述

相关内容