定理/练习后的点与文本在同一行

定理/练习后的点与文本在同一行

我希望“练习 xx。”(带一个点)以斜体粗体红色显示,字体大小与练习文本相同,并放在同一行。

Exercise 1. Solve x+1=2.
Exercise 2. Solve x-1=3.

我现在有:

\documentclass[10pt,xcolor=dvipsnames]{beamer}
\setbeamertemplate{theorems}[numbered]
\newtheorem{exe}{Exercise}
\begin{document}
\begin{frame}{Frame title}
\begin{exe} Here is the exercise.
\end{exe}
\end{frame}
\end{document}

但这不是我想要的。请帮忙!

答案1

基于https://tex.stackexchange.com/a/329929/36296

\documentclass{beamer}
\newtheorem{exe}{Exercise}
\usepackage{lmodern}

\makeatletter
\setbeamertemplate{theorem begin}{%
%  \begin{\inserttheoremblockenv}% removed
  {%
    \textcolor{red}{\bfseries\inserttheoremname\space\inserttheoremnumber.}
    \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
    \space% new
  }%
}

\setbeamertemplate{theorem end}{}
\makeatother

\begin{document}
    \begin{frame}{A theorem in a box}
            \begin{exe} Here is the exercise.
            \end{exe}
    \end{frame} 
\end{document}

在此处输入图片描述

相关内容