# Problem with ordering \newtheorem

I don't even know how to start this question. I have problem. I declared \newtheorem{twi}[5.1.]{} and it won't compile + start making theory counter from 5.1., 5.2. etc... :/ I'm new in LaTeX and I use it just because university... so... for me it's useless but I need to end what I have started.

Example of how I want to use it:

\documentclass[leqno]{article}
\usepackage{amssymb, amsmath}
\newtheorem{twi}[5.1.]{}
\begin{document}
\begin{twi}
Something here
\end{twi}
\begin{twi}
Something here again
\end{twi}
\end{document}


and I want output like

5.1. Something here

5.2. Something here again

Ok, thanks to all of you I found motivation to make it and search for my own solution.

• Welcome to TeX.SE. What does 5.1, 5.2 etc denote? – Mico Dec 11 '17 at 12:50
• I have theorems, and I am rewriting the textbook. My guidelines are to stick to page numbers / theorems numbers (but I started from 186 page so there only start 5.1 theorem)- that's why I have to put together the numbering 5.1, 5.2. theorems. – Tymoteusz Stępień Dec 11 '17 at 12:58
• You come here where most users use and like TeX by saying “I care less than nothing about LaTeX”, which is already impolite, and your message features “I want” twice. – egreg Dec 11 '17 at 13:01
• So sorry then, I want to done it - I just need tips, I did not want to say it in a way "do it for me". – Tymoteusz Stępień Dec 11 '17 at 13:03
• Are you sure that is not \section{Text} what you want? – Sigur Dec 11 '17 at 15:38

The \newtheorem macro takes the following arguments:

\newtheorem{name}[counter]{Printed output}[numberby]


where you can leave out the arguments in square brackets, i.e. [counter] and/or [numberby]. These arguments have the following meaning:

• counter gives the name of an existing counter that should be used for numbering the theorems. A typical use-case is that you want to have a continous numbering that includes both equations and theorems, or different types of theorems. However, you cannot use this argument to specify the style of the numbering of the equation.
• numberby gives the name of an existing counter that should be used as a parent number to the theorem's number. A typical use-case is that you want to have a continous numbering of theorems only inside each chapter or section. That's the case here: You want to have numbers like "5.1" meaning "theorem 1 of chapter 5".
• Also, Printed output should not be empty because it inserts additional space even if it is empty. Use whatever label you want to give to your theorems (important distinction: the counters only count, i.e. they only take numbers; everything else has to go to the label).

What you can do in your specific case is: Choose section as numberby, and \S (which results in §) as Printed output in your theorem definition, and then set the value of the section counter to 5:

\documentclass{article}
\usepackage{amsmath}
\newtheorem{twi}{\S}[section]

\begin{document}
\setcounter{section}{5}
\begin{twi}
Something here
\end{twi}
\begin{twi}
Something here again
\end{twi}
\end{document}


• Empty braces {} is not good idea to remove the Theorem Name. It indents the number. Compare with \noindent\textbf{\thesection.1} \textit{Something here}. – Sigur Dec 11 '17 at 13:20
• oh! Ok :D I get it - thank you. And I have question about section countering - if I wan't to counter section like  \mathsection 5. then I just put it in \setcounter{section}{ \mathsection 5}? – Tymoteusz Stępień Dec 11 '17 at 13:22
• No, definitely not. Counters just carry numbers. However, I don't know what \mathsection should be, so I can't give you a working solution. – Tiuri Dec 11 '17 at 13:24
• It's § <-- this – Tymoteusz Stępień Dec 11 '17 at 13:25
• This symbols is \S in text mode, not math mode. – Sigur Dec 11 '17 at 13:26

Here is a possible solution, with period after the number.

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}

\newcounter{mythm}
\setcounter{mythm}{1}
\let\realsection=\section
\renewcommand\section[1]{\setcounter{mythm}{1}%
\realsection{#1}
}
\newenvironment{twi}[1]{%
\vspace{\abovedisplayskip}
\noindent\textbf{\S\thesection.\themythm.} \itshape #1}{\stepcounter{mythm}\par\vspace{\belowdisplayskip}}

\begin{document}
\setcounter{section}{5} % just for example

\lipsum[1]
\begin{twi}
\lipsum[2]
\end{twi}

\begin{twi}
Something here
\end{twi}
\begin{twi}
Something here
\end{twi}

\section{title}

\begin{twi}
Something here
\end{twi}

\lipsum[3]

\end{document}


• It's long one, I found solution to all my wishes about counting :D \renewcommand{\thesection}{\S \arabic{section}.}, \newtheorem{twi}{}[section] and before first section \setcounter{section}{4} - works like charm – Tymoteusz Stępień Dec 11 '17 at 14:22
• @TymoteuszMaciejStępień, this is a solution to a different problem. You are redefining the Section Counter output. This will change everywhere where you use sections. Headers, titles, and so on. if this is what you wish, edit your post and make it clear. You asked about theorem formats. – Sigur Dec 11 '17 at 15:34