0

Here it is a Minimal Working Example:

\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}

I want a single counter for the definition on each page, but it keeps changing the counter after pause or new overlay (with the same theorem).

Can someone help?

1

Two approaches:

  • if you want to keep mdframed, you could use \only<2->{\addtocounter{definizione}{-1}} as a quick hack to get the correct number

  • or simply use beamers own definition environment. The format/language of the title can be adjusted to match what you have now, the only thing which would be a bit more complicate would be the boarder around the block.


\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.