我正在使用tcolorbox
,并且希望我的定理/示例框以标签 0 开头。请参阅下面的 MWE。
\documentclass{article}
\usepackage[dvipsnames]{xcolor} % should be before tcolorbox
\usepackage[most]{tcolorbox}
%\usepackage{tcolorbox}
\tcbuselibrary{theorems,most}
\tcbuselibrary{listings,breakable}
\usepackage{listings}
\usepackage{verbatim}
\usepackage{cleveref}
%\newcounter{mycounter}
%\setcounter{mycounter}{-1}
%\setcounter{section}{-1}
%\newtcbtheorem[]{example}{Example}{label type=example}{exa}
\newtcbtheorem[number within = section]{example}{Example}{label type=example}{exa}
\begin{document}
\begin{example}{Print a string variable.}{label}
\begin{verbatim}
city = input('Enter the name of your favourite city \n')
# Here city is a string variable.
# \n lets you type city in a new line.
print("Your fav city's name:", city)
\end{verbatim}
\end{example}
\end{document}
在这里我尝试使用常规方法setcounter
,但没有奏效(因此发表评论)。有什么简单的补救措施吗?