2

I am making a Beamer presentation, like say:

\begin{frame}
\only<1>{\Huge}\onslide<1->{Text 1.}
\begin{itemize}
\item<2->\only<2>{\Huge} Item 1.
\item<3->\only<3>{\Huge} Item 2.
\end{itemize}

\end{frame}

The goal is to make each slide present the currently introduced text in a huge font, while leaving the rest of the text visible but much smaller.

This works, but

(1) This requires a lot of writing commands per slide.

(2) Is quite fragile -- if I have to reorder things, I could potentially need to spend a lot of time renumbering.

Is there a way to make it do the same job while parsing a source that looks more like, for example,

\begin{frame}
Text 1.
\slide 
\begin{itemize}
\item Item 1.
\item Item 2.
\end{itemize}

or perhaps with a minimal amount of extra commands to separate out the slides?


I don't have a lot of experience with creating commands, but experimented with this and it didn't work:

\newcounter{slidenum}
\setcounter{slidenum}{1} 
\newcommand{\next}[1]{\only<\theslidenum>{\Huge}\onslide<\theslidenum->{#1}\addtocounter{slidenum}{1}}

In the way that I imagine this working, I could put every next overlay in a \next{...} command and at the start of every frame, restart the counter. But when I try to use it in a slide, the item in the \next{...} is neither made huge nor is it hidden on the first overlay.

1
  • +1 nice question. Next time, could you please add a complete minimal example? i.e., include the \documentclass{article} command and \begin{document}, etc.
    – scottkosty
    Commented Apr 12, 2023 at 19:43

2 Answers 2

3

Does the following do what you want?

\documentclass{beamer}

\newcommand{\hugeOnce}[1]{{\only<.>{\Huge} #1}}

\begin{document}

\begin{frame}[<+->]
\only<+->{\hugeOnce{Text 1.}}
\begin{itemize}
\item \hugeOnce{Item 1.}
\item \hugeOnce{Item 2.}
\end{itemize}

\end{frame}

\end{document}
2
  • Yes it does! It certainly solves the fagility problem. It's a little more code than I was hoping to write per overlay, but it works quite well. Thank you for sharing this!
    – Addem
    Commented Apr 13, 2023 at 15:16
  • 1
    @Addem That's great! Thanks for letting me know. Could you please give the other answer a try? It really is more elegant and practical (I think it would save some typing and keep your code cleaner).
    – scottkosty
    Commented Apr 13, 2023 at 16:24
3

You could use a similar trick as in https://topanswers.xyz/tex?q=1334#a1579 and create a new beamer action:

\documentclass{beamer}

\newenvironment{hugeenv}{\only{\Huge}}{}

\begin{document}
    
\begin{frame}
\only<+>{\Huge} Text
\begin{itemize}[<huge@+|+->]
\item Item 1.
\item Item 2.
\end{itemize}

\end{frame}

\end{document}
10
  • Nice and clean! I vote for this answer :).
    – scottkosty
    Commented Apr 12, 2023 at 20:04
  • 1
    @scottkosty Thanks! I like yours too, nice to understand what is is happening! Commented Apr 12, 2023 at 20:10
  • Depending on what the OP wants, I wonder if it would make sense to put the default overlay as the default overlay of the frame. Would there then be a simple way to rewrite the \only command (that could rely on the default overlay instead of repeating \Huge)?
    – scottkosty
    Commented Apr 13, 2023 at 16:30
  • @scottkosty I'm not sure I understand your comment, do you mean something like \begin{frame}[<huge@+|+->]? Commented Apr 13, 2023 at 16:38
  • 1
    I'll come knocking soon! :)
    – scottkosty
    Commented Apr 13, 2023 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .