
Я хочу, чтобы этот список включал следующие вещи:
- Только вопросы помечены (a), (b), (c). Ответы не должны быть помечены вообще.
Эти шесть строк должны появляться одна за другой. Сначала отображается только первый вопрос, а затем ответ на него после нажатия кнопки «следующая страница». Затем второй вопрос, затем второй ответ, ...
\documentclass[]{beamer} \begin{document} \begin{frame} \frametitle{Example} \begin{enumerate}[(a)] \item<1-> Q: what is the answer to the first question? \item<2-> A: The answer is A. \item<3-> Q: what is the answer to the second question? \item<4-> A: The answer is B. \item<5-> Q: what is the answer to the second question? \item<6-> A: The answer is C. \end{enumerate} \end{frame} \end{document}
решение1
Одна из возможностей — создать пользовательскую пустую item
команду:
\documentclass[]{beamer}
\newcommand{\answer}{\item[]} %new code
\begin{document}
\begin{frame}
\frametitle{Example}
\begin{enumerate}[<+->][(a)] %new code
\item Q: what is the answer to the first question?
\answer A: The answer is A.
\item Q: what is the answer to the second question?
\answer A: The answer is B.
\item Q: what is the answer to the second question?
\answer A: The answer is C.
\end{enumerate}
\end{frame}
\end{document}
Я также удалил отдельные спецификации наложения и добавил +-
оператор, который влияет на весь список.
Как отметил в комментариях @moewe, код можно сделать более компактным, добавив повторно используемые элементы в определения пользовательских элементов:
\documentclass[]{beamer}
\newcommand{\answer}[1]{\item[] A: The answer is #1.} %new code
\newcommand{\question}{\item Q:} %new code
\begin{document}
\begin{frame}
\frametitle{Example}
\begin{enumerate}[<+->][(a)]
\question what is the answer to the first question?
\answer{A}
\question what is the answer to the second question?
\answer{B}
\question what is the answer to the second question?
\answer{C}
\end{enumerate}
\end{frame}
\end{document}
Результат тот же, что и раньше. Я не делаю то же самое для частей "каков ответ на...", потому что подозреваю, что они там только ради MWE
решение2
Просто используйте []
для указания пустых меток элементов. Определенно вы можете определить свои собственные макросы для таких элементов.
\documentclass[]{beamer}
\begin{document}
\begin{frame}
\frametitle{Example}
\begin{enumerate}[(a)]
\item<1-> Q: what is the answer to the first question?
\item[]<2-> A: The answer is A.
\item<3-> Q: what is the answer to the second question?
\item[]<4-> A: The answer is B.
\item<5-> Q: what is the answer to the second question?
\item[]<6-> A: The answer is C.
\end{enumerate}
\end{frame}
\end{document}