# Theorem Environment, Text in math mode breaks out of margin

Could someone explain to me why some of the text in math mode breaks out of the margins?

Edit: Sorry for the bad question formatting. Why is it that when I paste things it runs on like a single sentence?

\documentclass[a4paper,12pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}

\newtheorem{manualtheoreminner}{Theorem}
\newenvironment{manualtheorem}[1]{%
\renewcommand\themanualtheoreminner{#1}%
\manualtheoreminner
}{\endmanualtheoreminner}

\begin{document}

\begin{manualtheorem}{2.3 (Dimension Theorem}
\begin{proof}
Let nullity($\mathsf{T}) = m$ and $\mathrm{dim}(\mathsf{V}) = n$. Since $\mathsf{N(T)}$ is a subspace of $\mathsf{V}$, nullity$(\mathsf{T}) \subseteq \beta$ by Fact 1.5. Hence $a_1\beta_1 + \ldots + a_m\beta_m = n(t)$ and $\mathsf{T}(a_1\beta_1 + \ldots + a_m\beta_m) = 0$ for all $a$, and by linearity $a_1\mathsf{T}(\beta_1) + \ldots + a_m\mathsf{T}(\beta_m) = 0$ for all $a$. Hence no set containing any one of $\{ \mathsf{T}(\beta_1), \ldots, \mathsf{T}(\beta_m)\}$ can be linearly independent.

\paragraph{} Now since $\mathsf{V}$ is generated by $\{\beta_1, \ldots, \beta_n \}$, it follows that $\mathsf{R(T)}$ is generated by $\{\mathsf{T}(\beta_1), \ldots, \mathsf{T}(\beta_n)\}$ by Thm 2.2. Since any set containing $\{\mathsf{T}(\beta_1), \ldots, \mathsf{T}(\beta_m)\}$ is linearly dependent, it follows that $\{\mathsf{T}(\beta_{m+1}), \ldots, \mathsf{T}(\beta_{n})\}$ generates $\mathsf{R(T)}$.

\paragraph{} $a_{m+1}\beta_{m+1} + \ldots + a_n\beta_n \neq n(t)$. Suppose otherwise, $a_1\beta_1 + \ldots a_m\beta_m = a_{m+1}\beta_{m+1} + \ldots + a_n\beta_n$. Contradiction of linear independence. Hence $\mathsf{T}(a_{m+1}\beta_{m+1} + \ldots + a_n\beta_n) \neq 0$; $\{ \mathsf{T}(\beta_{m+1}), \ldots, \mathsf{T}(\beta_n)\}$ is linearly independent.

\paragraph{}Thus $\{\mathsf{T}(\beta_{m+1}), \ldots, \mathsf{T}(\beta_n) \}$ is the basis of $\mathsf{R(T)}$ and rank($\mathsf{T}) = \mathrm{dim}(\mathsf{V}) - \mathrm{nullity}(\mathsf{T)}$.

\end{proof}
\end{manualtheorem}

\end{document}

• Don't use \paragraph{}: it is not meant to produce a new paragraph in the usual sense. The command has a badly chosen name, but it is for adding a section title below the level of \subsubsection. A blank line is what's needed to end a paragraph and start a new one. – egreg Jul 31 '19 at 14:36

I'd write your code like below. Main changes are:

1. replace \ldots by \dots
2. use proof enviroment out of manualtheorem
3. use \operatorname{} for rank, for example (or use \DeclareMathOperator{\rank}{rank} on preamble and then \rank, as reminded by @Sebastiano)
4. use \dim for dimension

WME

\documentclass[a4paper,12pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}

\newtheorem{manualtheorem}{Theorem}
%\newenvironment{manualtheorem}[1]{%
%   \renewcommand\themanualtheoreminner{#1}%
%   \manualtheoreminner
%}{\endmanualtheoreminner}

\begin{document}

\begin{manualtheorem}[Dimension Theorem]Statement here.
\end{manualtheorem}

\begin{proof}
Let $\operatorname{nullity}(\mathsf{T}) = m$ and $\dim(\mathsf{V}) = n$. Since $\mathsf{N(T)}$ is a subspace of $\mathsf{V}$, $\operatorname{nullity}(\mathsf{T}) \subseteq \beta$ by Fact 1.5. Hence $a_1\beta_1 + \dots + a_m\beta_m = n(t)$ and $\mathsf{T}(a_1\beta_1 + \dots + a_m\beta_m) = 0$ for all $a$, and by linearity $a_1\mathsf{T}(\beta_1) + \dots + a_m\mathsf{T}(\beta_m) = 0$ for all $a$. Hence no set containing any one of $\{ \mathsf{T}(\beta_1), \dots, \mathsf{T}(\beta_m)\}$ can be linearly independent.

Now since $\mathsf{V}$ is generated by $\{\beta_1, \dots, \beta_n \}$, it follows that $\mathsf{R(T)}$ is generated by $\{\mathsf{T}(\beta_1), \dots, \mathsf{T}(\beta_n)\}$ by Thm~2.2. Since any set containing $\{\mathsf{T}(\beta_1), \dots, \mathsf{T}(\beta_m)\}$ is linearly dependent, it follows that $\{\mathsf{T}(\beta_{m+1}), \dots, \mathsf{T}(\beta_{n})\}$ generates $\mathsf{R(T)}$.

We claim that $a_{m+1}\beta_{m+1} + \dots + a_n\beta_n \neq n(t)$. Suppose otherwise, $a_1\beta_1 + \dots a_m\beta_m = a_{m+1}\beta_{m+1} + \dots + a_n\beta_n$. Contradiction of linear independence. Hence $\mathsf{T}(a_{m+1}\beta_{m+1} + \dots + a_n\beta_n) \neq 0$ and so $\{ \mathsf{T}(\beta_{m+1}), \dots, \mathsf{T}(\beta_n)\}$ is linearly independent.

Thus $\{\mathsf{T}(\beta_{m+1}), \dots, \mathsf{T}(\beta_n) \}$ is the basis of $\mathsf{R(T)}$ and $\operatorname{rank}(\mathsf{T}) = \dim(\mathsf{V}) - \operatorname{nullity}(\mathsf{T)}$.
\end{proof}

\end{document}