額外 },或忘記 \endgroup 以及模式規範和 exampleblock 或alertblock

額外 },或忘記 \endgroup 以及模式規範和 exampleblock 或alertblock

下面的程式碼會報錯

\documentclass{beamer}
\begin{document}
\begin{frame}
\mode
<presentation>
some text

\mode
<article>

\begin{exampleblock}{Exemple}
tttttt
\end{exampleblock}

\mode
<all>


\end{frame}
\end{document}

它似乎與exampleblock: 如果我用 a 替換它block,就沒有錯誤。但根據\mode規範,beamer 在讀取該行時應該處於吞噬狀態。另外,如果我刪除\mode規範,也不會有錯誤。

我懷疑這是投影機中的一個錯誤。我剛剛透過 tlmgr 升級到最新版本:它仍然發生。

但是,也許我做錯了什麼?

如果這確實是一個錯誤,我該如何解決它直到它得到糾正?

(有人可能想知道為什麼我在文章模式下使用區塊;這是因為我無法在簡報中展示整個系列的範例,但我仍然希望將它們全部放在 beamerarticle 版本中,並且我希望保持出現在那裡)

答案1

該解決方案需要格式和系統修改。

首先,\mode, 後面應該跟有所需的模式,<presentation>或者<article>, 並緊接著 裡面的文本{}

這正是您收到“Extra },或忘記\endgroup”錯誤的原因。

當 Beamer 排版文字時,它始終處於以下五種模式之一:

  • beamer是預設模式。
  • second是排版可選第二螢幕的幻燈片時所使用的模式。
  • handout是創建講義的模式。
  • trans是創建透明膠片的模式。
  • article是控制權轉移到另一個類別(例如article.cls)時的模式。請注意,如果控制權轉移到 book.cls,模式也是文章。

除了這些模式之外,beamer 還可以識別以下模式集名稱:

  • all指所有模式。
  • presentation指前四種模式,即除文章模式外的所有模式。

這是工作代碼。

\documentclass{beamer}

\begin{document}
\begin{frame}
\mode<presentation>{some text}

\mode<article>{
\begin{exampleblock}{Exemple}
  tttttt
\end{exampleblock}}

 \mode<all>{\begin{exampleblock}{Exemple}
  tttttt
 \end{exampleblock}}

\mode<all>{Some text for example purposes}
\end{frame}
\end{document}

結果是

在此輸入影像描述

相關內容