단일 목록의 다양한 항목 기호

단일 목록의 다양한 항목 기호

나는 이 열거 목록을 다음과 같이 원합니다.

  1. 질문에만 (a), (b), (c)로 표시되어 있습니다. 답변에는 라벨을 전혀 붙여서는 안 됩니다.
  2. 이 6개의 줄은 하나씩 나타나야 합니다. 처음에는 첫 번째 질문만 표시되고 다음 페이지를 누르면 답변이 표시됩니다. 그 다음 두 번째 질문, 그 다음 두 번째 답변...

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

관련 정보