![带切片计数器的环境](https://linux22.com/image/455455/%E5%B8%A6%E5%88%87%E7%89%87%E8%AE%A1%E6%95%B0%E5%99%A8%E7%9A%84%E7%8E%AF%E5%A2%83.png)
我正在从头开始创建一个编号环境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}