我正在从头开始创建一个编号环境teo
。我想要一个计数器,为此我使用了teoc
。
\newcounter{teoc}[section]
\newenvironment{teo}[1][]
{\refstepcounter{teoc}\par\smallskip
\noindent \textbf{\color{blue}Teo~\theteoc. #1}
\rmfamily}
{\smallskip}
使用下面的两个调用我得到了Teo 1
,Teo 2
即使我在第 4 节,这意味着我没有得到Teo 4.1
和Teo 4.2
\begin{teo}
To prove it by contradiction try and assume that the statement is
false, proceed from there and at some point you will arrive to a
contradiction.
\end{teo}
\begin{teo}
To prove it by contradiction try and assume that the statement is
false, proceed from there and at some point you will arrive to a
contradiction.
\end{teo}
我想在我的柜台前介绍分区编号方案。
答案1
- 您没有提供 MWE,所以我们不知道您使用哪个文档类以及使用哪个包来编写定理。
- 假设您使用
amsthm
包,可能的解决方案可能是:
\documentclass{article}
\usepackage{color}
\usepackage{amsmath, amsthm}
\newcounter{teoc}[section]
\renewcommand\theteoc{\thesection.\arabic{teoc}} % <---
\newenvironment{teo}[1][]
{\refstepcounter{teoc}\par\smallskip
\noindent \textbf{\color{blue}Teo~\theteoc. #1}
\rmfamily}
{\smallskip}
\begin{document}
\setcounter{section}{3}
\section{four}
\begin{teo}
To prove it by contradiction try and assume that the statement is
false, proceed from there and at some point you will arrive to a
contradiction.
\end{teo}
\begin{teo}
To prove it by contradiction try and assume that the statement is
false, proceed from there and at some point you will arrive to a
contradiction.
\end{teo}
\end{document}