在 beamer 中对定义、示例等进行编号时出现的问题

在 beamer 中对定义、示例等进行编号时出现的问题

大家好!我正尝试对定义、定理、示例和练习进行正确编号。我甚至尝试使用 \addtocounter 对跨多张幻灯片的“示例”进行编号,但无济于事。不知何故,我无法做到不犯错误并得到我想要的东西。请帮帮我!

这是编码:

\documentclass[Spanish,notheorems, handout]{beamer}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage[spanish]{babel}
\usepackage{amsmath, mathtools}
\usepackage[tikz]{bclogo} 
\usepackage{xcolor}
\usepackage{tikz} % zeichnen
\usetikzlibrary{cd} % kommutierende Diagramme
%\setbeamertemplate{theorems}[numbered]
\selectlanguage{spanish}
\uselanguage{spanish}
\languagepath{spanish}
\decimalpoint
\usepackage{multicol}
\usepackage{bm}
\usepackage{ragged2e}
%\usepackage[lastexercise]{exercise}
\usepackage[shortlabels]{enumitem}
\usepackage{epigraph}
\usepackage{graphicx}
\usepackage[many]{tcolorbox}
\usetikzlibrary{calc}
\usepackage{systeme}
\usepackage{tkz-euclide,tikz,tikz-3dplot}
\usepackage{pst-plot}
\usepackage{tkz-fct}
\usepackage{pgfplots}


%%%%%%%%%%%%% WATERMARK  %%%%%%%%%%%%%%%%%%%
%\usepackage{background}
%\backgroundsetup{
%placement=center,
%scale=4,
%contents={Educativo},
%opacity=0.7
%}
%\setbeamertemplate{background}{\BgMaterial}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcounter{theo}[section]
\setcounter{theo}{0}
\renewcommand{\thetheo}{\arabic{chapter}.\arabic{section}.\arabic{theo}}

\theoremstyle{definition}
\newtheorem{definizione}[theo]{Definizione}
\newtheorem{esempio}[theo]{Esempio}
\newtheorem{algoritmo}[theo]{Algoritmo}
\newtheorem{osservazione}[theo]{Osservazione}
\theoremstyle{plain}
\newtheorem{corollario}[theo]{Corollario}
\newtheorem{proposizione}[theo]{Proposizione}


\newenvironment{theo}[2][]{%
   \refstepcounter{theo}%
   \ifstrempty{#1}%
      {\mdfsetup{%
         frametitle={%
            \tikz[baseline=(current bounding box.east),outer sep=0pt]
            \node[anchor=east,rectangle,fill=black!20]
            {\strut Teorema~\thetheo};}%
         }%
      }%
      {\mdfsetup{%
         frametitle={%            
            \tikz[baseline=(current bounding box.east),outer sep=0pt]
            \node[anchor=east,rectangle,fill=black!20]
            {\strut Teorema~\thetheo~(#1).};}%
         }%
      }%
   \mdfsetup{innertopmargin=10pt,linecolor=black!30,%
             linewidth=2pt,topline=true,%
             frametitleaboveskip=\dimexpr-\ht\strutbox\relax}
   \begin{mdframed}[backgroundcolor=gray!10]\relax\label{#2}}{\end{mdframed}%
}

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

\usepackage{amsmath,amsthm, amssymb, latexsym, amsfonts, pgf}
\usepackage{mathtools}
\usepackage{nicefrac,xfrac}
\usepackage{graphicx}
\usepackage{pifont}
\usepackage{adforn}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setbeamertemplate{theorem}[ams style]
\setbeamertemplate{theorems}[numbered]
\newenvironment{example*}
  {\addtocounter{theorem}{-1}\example}
  {\endexample}

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

\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    \usebeamerfont{title}\secname\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}


\beamerdefaultoverlayspecification{<+->}



\newtcolorbox{mybox}{
  enhanced,
  left=0pt,
  right=0pt,
  top=8pt,
  bottom=8pt,
  colback=white,
  colframe=red,
  width=\textwidth,
  enlarge left by=0mm,
  boxsep=5pt,
  fontupper=\itshape\small,
  arc=4pt,
  outer arc=4pt,
  leftupper=1.5cm,
  overlay={
    \node[anchor=west] 
      at ([xshift=10pt] $ (frame.north west)!0.5!(frame.south west) $ )
       {\includegraphics[width=1cm,height=1cm]{2.pdf}};}
       }




%Information to be included in the title page:
\title{Matemática Financiera II}
\author{Profesor Abreu}
\institute{Universidad Cat\'olica Santo Domingo}
\date{2021}

\begin{document}

\frame{\titlepage}

相关内容