
Quiero que esta lista enumere las siguientes cosas:
- Sólo las preguntas están etiquetadas con (a), (b), (c). Las respuestas no deben etiquetarse en absoluto.
Estas seis líneas deberían aparecer una por una. Al principio, solo se muestra la primera pregunta, seguida de su respuesta después de presionar la página siguiente. Luego la segunda pregunta, luego la segunda respuesta...
\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}
Respuesta1
Una posibilidad es crear un item
comando vacío personalizado:
\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}
También eliminé las especificaciones de superposición individuales y agregué un +-
operador que afecta a toda la lista.
Como se señaló en los comentarios de @moewe, el código se puede hacer más compacto agregando los elementos reutilizados a las definiciones de elementos personalizados:
\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}
El resultado es el mismo que antes. No haré lo mismo con las partes de "¿cuál es la respuesta a..." porque sospecho que están ahí sólo por el bien del MWE?
Respuesta2
Simplemente utilícelo []
para especificar etiquetas de elementos vacías. Definitivamente también puedes definir tus propias macros para elementos como este.
\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}