mdtheorem beamer 计数器每次暂停时都会改变

mdtheorem beamer 计数器每次暂停时都会改变

这是一个最小工作示例:

\documentclass[10pt]{beamer}

\usepackage[framemethod=tikz,nobreak]{mdframed}

\mdtheorem[innerlinewidth=0.5pt, %
roundcorner=4pt,linecolor=blue,innerleftmargin=16pt,
innerrightmargin=16pt,backgroundcolor=white, %
frametitlerule=true,frametitlebackgroundcolor=cyan,innertopmargin=\topskip,innerbottommargin=\topskip]{definizione}{Definizione}

\begin{document}

\begin{frame}{A slide} 

\begin{definizione}[A definition]

My definition. 

\end{definizione}\pause

\begin{itemize}
\item A comment about definition;\pause
\item Another comment
\end{itemize}
\end{frame}

\end{document}

我希望每个页面上的定义都有一个计数器,但它会在暂停或新的覆盖后不断改变计数器(使用相同的定理)。

有人可以帮忙吗?

答案1

两种方法:

  • 如果你想保留mdframed,你可以使用\only<2->{\addtocounter{definizione}{-1}}快速破解来获得正确的数字

  • 或者直接使用 beamer 自己的定义环境。标题的格式/语言可以调整以匹配您现在的内容,唯一稍微复杂一点的是街区周围的边界。


\documentclass[10pt]{beamer}

\usepackage[framemethod=tikz,nobreak]{mdframed}

\mdtheorem[innerlinewidth=0.5pt, %
roundcorner=4pt,linecolor=blue,innerleftmargin=16pt,
innerrightmargin=16pt,backgroundcolor=white, %
frametitlerule=true,frametitlebackgroundcolor=cyan,innertopmargin=\topskip,innerbottommargin=\topskip]{definizione}{Definizione}

%%%%%%%%%%%%%%%%%%%%%%%%%%%

\useinnertheme{rounded}
\setbeamertemplate{theorems}[numbered]

\uselanguage{itanlian}
\languagepath{italian}
\deftranslation[to=italian]{Definition}{Definizione}
\deftranslation[to=italian]{definition}{definizione}

\definecolor{theocolor}{RGB}{0,173,239}

\setbeamercolor{block title}{fg=black,bg=theocolor}
\setbeamercolor{block body}{fg=black,bg=theocolor!20!white}

\makeatletter
\setbeamertemplate{theorem begin}
{%
  \begin{\inserttheoremblockenv}
    {%
      \inserttheoremname
      \inserttheoremnumber
      \ifx\inserttheoremaddition\@empty\else
      : \inserttheoremaddition\fi%
    }%
}
\makeatother

\begin{document}

\begin{frame}{A slide} 
\only<2->{\addtocounter{definizione}{-1}}
\begin{definizione}[A definition]

My definition. 

\end{definizione}\pause

\begin{itemize}
\item A comment about definition;\pause
\item Another comment
\end{itemize}
\end{frame}

\begin{frame}{B slide} 
\begin{definition}[A definition]

My definition. 

\end{definition}\pause

\begin{itemize}
\item A comment about definition;\pause
\item Another comment
\end{itemize}
\end{frame}

\end{document}

在此处输入图片描述

相关内容