完整代码

完整代码

我想在后面放置一些额外的文本(图片中的绿色文本) Theorem (...),不在括号内,但仍在同一行(顶部)。

如何设置选项来实现这一点?请问一下。

在此处输入图片描述

\documentclass{beamer}

\mode<presentation>
{
    \usetheme{Warsaw}
    \setbeamertemplate{headline}{}
    \setbeamertemplate{itemize item}[triangle]
    \setbeamertemplate{itemize subitem}[triangle]
    \setbeamertemplate{itemize subsubitem}[triangle]
    \setbeamercovered{transparent}
    \useoutertheme{infolines}
    \usefonttheme{professionalfonts}
}

\begin{document}

\begin{frame}

\begin{theorem}[ABC formula {\color{green} Compute ABC}]
  $ABC = abc$.
\end{theorem}

\end{frame}

\end{document}

答案1

这就是模板theorem begin存在的目的。默认是

\defbeamertemplate*{theorem begin}{default}
{%
  \begin{\inserttheoremblockenv}
  {%
    \inserttheoremname
    \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
  }%
}

你需要的是

\defbeamertemplate*{theorem begin}{no ()}
{%
  \begin{\inserttheoremblockenv}
  {%
    \inserttheoremname
    \ \inserttheoremaddition%
  }%
}

完整代码

\documentclass{beamer}
\mode<presentation>
{
    \usetheme{Warsaw}
    \setbeamertemplate{headline}{}
    \setbeamertemplate{itemize item}[triangle]
    \setbeamertemplate{itemize subitem}[triangle]
    \setbeamertemplate{itemize subsubitem}[triangle]
    \setbeamercovered{transparent}
    \useoutertheme{infolines}
    \usefonttheme{professionalfonts}
}
\defbeamertemplate*{theorem begin}{no ()}
{%
  \begin{\inserttheoremblockenv}
  {%
    \inserttheoremname
    \ \inserttheoremaddition%
  }%
}
\begin{document}
    \begin{frame}
        \begin{theorem}[(ABC formula) \color{green} Compute ABC]
            $ABC = abc$.
        \end{theorem}
    \end{frame}
\end{document}

相关内容