1

Am making a numbered environment teo from scratch. I want to have a counter, for which I used teoc.

\newcounter{teoc}[section]
\newenvironment{teo}[1][]
   {\refstepcounter{teoc}\par\smallskip
     \noindent \textbf{\color{blue}Teo~\theteoc. #1}
     \rmfamily}
   {\smallskip}

Using the two calls below I get Teo 1 and Teo 2 even though I am in section 4, meaning that I do not get Teo 4.1 and 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}

I want to introduce the sectioning numbering scheme before my counter.

1 Answer 1

0
  • You not provide MWE, so we not know which document class you use and which package is employed for writing theorems.
  • Assuming, that you use amsthm package, possibole solution can be:
\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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .