# How to numbering sentences and equations in the same numbering system?

At the beginning I use \numberwithin{equation}{subsection} so every time I use environment, it will tag my equations on the right with respect to sections or subsections.

\documentclass[12pt]{article}
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{enumerate}
\setlength{\textwidth}{16cm}
\setlength{\textheight}{23cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\topmargin}{0cm}
\title{{\textbf{\textrm TITLE}}}
\author{Bruce}
\date{\today}

\usepackage{xcolor}
\numberwithin{equation}{subsection}
\newsavebox\thmbox
\newtheorem{mytheorem}{Theorem}
\newenvironment{theorem}%
{\begin{lrbox}{\thmbox}%
\begin{minipage}{\dimexpr\linewidth-2\fboxsep}
\begin{mytheorem}}%
{\end{mytheorem}%
\end{minipage}%
\end{lrbox}%
\begin{trivlist}
\item[]\colorbox{lightgray}{\usebox\thmbox}
\end{trivlist}}
\newtheorem{mydef}{Definition}
\begin{document}
\maketitle
\section{First Chapter}
\subsection{First subsection}
$$F=ma$$
\begin{theorem}
Force is equal mass times acceleration.
\end{theorem}
\end{document}


It will tag F=ma as (1.1.1). Now I also want to number my sentence using the same numbering system, without centring the whole sentence. For example, If I use

$$\mbox{Force is equal mass times acceleration.}$$


It will still number the sentence, but its output acts like an equation(centring). How can I fix that?

I try add more text in the \theorem environment. But the space between them are too large, or am I using the incorrect code for flalign?

\begin{theorem}
\begin{flalign}
\text{(1)Force is equal mass times acceleration.}&&
\end{flalign}
\begin{flalign}
\text{(2)Mass in conserved in general.}&&
\end{flalign}
\end{theorem}

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Dec 15 '14 at 15:44
• what do you mean by sentence(theorem) ? I honestly can not guess. sentences are not normally numbered in latex, and your test document has no theorems or sentences in it. – David Carlisle Dec 15 '14 at 15:52
• Your example just produces the error ! Incomplete \iffalse; all text was ignored after line 6. <inserted text> \fi  – David Carlisle Dec 15 '14 at 15:54
• Sorry it should work now. I want to number my theorem 'Force is equal mass times acceleration' as (1.1.2). – user3624246 Dec 15 '14 at 16:07
• Add \numberwithin{theorem}{subsection}. – Gonzalo Medina Dec 15 '14 at 16:12

You can use flalign instead of equation with a double & at the end of the sentence:

\begin{flalign}
\text{Force is equal mass times acceleration.}&&
\end{flalign}


MWE (note the use of \text instead of \mbox)

\documentclass[12pt]{article}
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{enumerate}
\setlength{\textwidth}{16cm}
\setlength{\textheight}{23cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\topmargin}{0cm}
\title{{\textbf{\textrm TITLE}}}
\author{Bruce}
\date{\today}

\usepackage{xcolor}
\numberwithin{equation}{subsection}
\newsavebox\thmbox
\newtheorem{mytheorem}{Theorem}
\newenvironment{theorem}%
{\begin{lrbox}{\thmbox}%
\begin{minipage}{\dimexpr\linewidth-2\fboxsep}
\begin{mytheorem}}%
{\end{mytheorem}%
\end{minipage}%
\end{lrbox}%
\begin{trivlist}
\item[]\colorbox{lightgray}{\usebox\thmbox}
\end{trivlist}}
\newtheorem{mydef}{Definition}
\begin{document}
\maketitle
\section{First Chapter}
\subsection{First subsection}
$$F=ma$$
\begin{flalign}
\text{Force is equal mass times acceleration.}&&
\end{flalign}
\begin{theorem}
Force is equal mass times acceleration.
\end{theorem}
\end{document}


Output

## EDIT

I don't know what you are trying to achieve, maybe this?

\makeatletter
\newcommand{\numleft}{\tagsleft@true}
\newcommand{\numright}{\tagsleft@false}
\makeatother


The first line simulates the option leqno of amsmath and the second the option reqno.

Use them like

\begin{theorem}
\numleft
\begin{flalign}
\end{flalign}
\numright
\end{theorem}


Complete code

\documentclass[12pt]{article}
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{enumerate}
\setlength{\textwidth}{16cm}
\setlength{\textheight}{23cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\topmargin}{0cm}
\title{{\textbf{\textrm TITLE}}}
\author{Bruce}
\date{\today}

\makeatletter
\newcommand{\numleft}{\tagsleft@true}
\newcommand{\numright}{\tagsleft@false}
\makeatother

\usepackage{xcolor}
\numberwithin{equation}{subsection}
\newsavebox\thmbox
\newtheorem{mytheorem}{Theorem}
\newenvironment{theorem}%
{\begin{lrbox}{\thmbox}%
\begin{minipage}{\dimexpr\linewidth-2\fboxsep}
\begin{mytheorem}}%
{\end{mytheorem}%
\end{minipage}%
\end{lrbox}%
\begin{trivlist}
\item[]\colorbox{lightgray}{\usebox\thmbox}
\end{trivlist}}
\newtheorem{mydef}{Definition}
\begin{document}
\maketitle
\section{First Chapter}
\subsection{First subsection}
$$F=ma$$

\begin{theorem}
\numleft
\begin{flalign}