
この列挙リストには次のものを含めたいと思います。
- 質問のみに (a)、(b)、(c) のラベルが付けられます。回答にはラベルが付けられません。
これらの 6 行は 1 行ずつ表示されます。最初は最初の質問のみが表示され、次のページを押すと回答が表示されます。次に 2 番目の質問、その次に 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}
答え1
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}