mathtools package destroys wordwrap latex

I have a latex document, something like this:

\documentclass[6x9]{book}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[paperheight=9in,paperwidth=6in,top=0.5in,bottom=1in,right=0.75in,left=0.75in,heightrounded,]{geometry}
%\usepackage{mathtools}

\graphicspath{ {images/} }

\title{Sample}
\author{Me}
\date{Date}

\begin{document}

\maketitle
\pagenumbering{roman}
\tableofcontents{}
\newpage
\pagenumbering{arabic}

%CHAPTER 1

\chapter{}
\section{Introduction}

\subsection{}
\text{
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
}

\subsection{}
\text{
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

}

\end{document}


The output of page 1 looks like this:

However, when I uncomment the line \usepackage{mathtools}, and compile the latex into a pdf, I get this:

For some reason, it seems that the package mathtools is removing the wordwrap in latex, or redefining \text{}. The package amsmath does the same. Is there a way to fix this? Maybe use something other than \text{}? I've tried \paragraph{}, and it works like it should, but it makes the font bold and indents the paragraph, but I don't want that. \noindent doesn't remove the indent:

I am new to Latex, and using overleaf.com. Any help would be appreciated. Thanks.

• What makes you think that \text should be used for marking text? Typesetting text is TeX's main job, no special marker is necessary. Jul 6, 2019 at 20:41

Never ignore error messages.

! Undefined control sequence.
l.28 \text
{
?


Any pdf that is produced if you scroll past an error is accidental output and not to be used for anything but debugging.

Once you load mathtools it loads amsmath (actually amstext) which defined \text to work like \mbox in this context so forcing everything on to a line.

Simply remove the \text commands.

• I was thinking I should still correct my many mistakes in my book. :-) +1 Jul 6, 2019 at 15:58
• @Sebastiano if you have a tex error you have no book. Jul 6, 2019 at 15:59
• Great, thank you all! Jul 6, 2019 at 16:27

To expand on the answer by David: LaTeX is not a mark-up language where you have to indicate for each piece of content what it is. Instead, it is a macro expansion language, where certain macros are used to set options, structure the document or modify the appearance of the macro arguments. However, when a piece of content is just part of regular text, then it does not need any macro around it. In this case the content that you enclosed in \text{} macros should be included without that (or any other) macro.

The \text macro itself is defined by amsmath in order to be able to use regular text in math mode. Math mode is used in LaTeX when you want to typeset formulas, equations, definitions etc (i.e., mathematics), which is indicated by surrounding the mathematical content by $ and $ (multiline), $$ and $$ (inline) or $ and $ (inline, older syntax, but still widely used). In math mode all letters are considered as mathematical variable names, so you cannot write regular words, unless you use the \text macro (there are a few alternative macros as well). But this macro should never be used to write text in a normal paragraph, because 1. it is not necessary (as explained above) and 2. it produces unwanted effects, as you have seen in your document.

• This answer was very helpful too; thank you! Jul 6, 2019 at 16:27