使用數字進行枚舉問題

使用數字進行枚舉問題

我正在使用該beamer包,並且正在寫很多問題。我正在回答每個問題並且每個問題都被列舉,所以當我添加另一個問題時,我需要手動輸入數字。每個問題都有其答案,並且在未來的某個時候必須有中等規模的評論。請記住,我想添加任何問題,而不必擔心問題的順序,也無需更改數字,就像我在文檔中的任何位置添加方程式並且 Latex 毫無問題地枚舉它一樣。我不知道是否值得使用這個enumerate包(有很多問題)o是否有技巧(也許是計數器)。我該如何解決這個問題?

編輯: 我的程式碼是:

\documentclass[]{beamer}

\mode<presentation>{
\usetheme{Madrid}
\setbeamertemplate{navigation symbols}{} 
}

\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage[utf8]{inputenc}
\title[]{Actividad de la novena}
\date{Diciembre 22 de 2014} % Date, can be changed to a custom date

\begin{document}

\begin{frame}
\titlepage
\end{frame}

\begin{frame}
    \begin{block}{}
    1. Por primera vez en la historia de la humanidad, un módulo de aterrizaje aterriza     en un cometa para estudiarlo. ¿Cuándo ocurrió este hecho?
    \end{block}

    \begin{enumerate}[a)]
        \item El 5 de noviembre.
        \item El 12 de noviembre.
        \item El 29 de octubre.
        \item El 25 de octubre
    \end{enumerate}
\end{frame}

\begin{frame}
\begin{block}{}
2. Dicho módulo de aterrizaje no iba solo, él se desprendió de una sonda espacial     que lo acompañaba. ¿Cuáles son los nombres del módulo y de la sonda?
\end{block}

\begin{enumerate}[a)]
    \item Philae y Orión. 
    \item Orión y Rosetta.
    \item Philae y Rosetta.
    \item Orión y Lutecia.
\end{enumerate}

 \end{frame}

\begin{frame}
\begin{block}{}
3. ¿Cuándo ocurrió la segunda vuelta presidencial?
\end{block}
\end{frame}

\begin{frame}
\begin{block}{}
4. Si solo tomamos en cuenta listas abiertas, ¿cuál fue el segundo senador con más     votos en el país?
\end{block}

\begin{enumerate}[a)]
    \item Musa Besaile. 
    \item Horacio Serpa.
    \item Jorge Enrique Robledo.
    \item Bernando Elías.
\end{enumerate}
\end{frame}

\end{document}

答案1

這是使用新計數器的簡單解決方案question

\documentclass{beamer}
\newcounter{question}
\newcommand\question[1]{\stepcounter{question}Q.~\arabic{question} -- #1}

\begin{document}
\begin{frame}
  \frametitle{Frame one}
  \question{Where is my first question?}

  \question{What is my second question?}
\end{frame}

\begin{frame}
  \frametitle{Frame two}

  \question{Who is my third question?}

  \question{When is my fourth question?}
\end{frame}
\end{document}

如果您的文件需要標記問題(並透過 交叉引用\ref),您可以\refstepcounter使用\stepcounter

相關內容