1

I posted my first question here. samcarter_is_at_topanswers.xyz helped me with the correct answer. Now following that question, I got another query. Is it possible to show h1=(1,2,3,4) on both slides too? and also if I want to show in first slide h1=(1,2,3,4) but in the other slide say h3=(1,2,3,4) ? Here is the sample code:

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

Ly T
  • 11
  • 2
    you are still loading far too many packages, epstopdf shouldn't be used at all and most the of the others aren't related to this question (or usable in beamer) – David Carlisle Aug 01 '23 at 20:22

1 Answers1

0

To replace text between slides, say h1 with h3, you can use \alt<>{some text}{another text}.

And as said before, please clean up your code. Only use what you need for this particular presentation. All the extra code and manual formatting make your code very prone to problems.

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

enter image description here