# Wrap equations just like normal text

I am trying to write an APA style paragraph with equations in the paragraph, however LaTeX seems to be deciding to try and keep the equation on a full line, instead of naturally wrapping on to the next line much like text would. Here is an example of how it looks now:

It should just wrap. Is there an automatic way to just allow it to wrap just like any other text not in the  signs?

Edit:

Here is my text including packages:

\documentclass[letterpaper,man,natbib]{apa6}

\usepackage[english]{babel} \usepackage[utf8x]{inputenc}
\usepackage{amsmath} \usepackage{graphicx} \usepackage{breqn}

$F(3,36) = 14.017, p < 0.001, n^2_{partial} = 0.539$. Specifically,
participants who were in the no perfume group ($M = 6.4, SE = 0.34$)
gave significantly higher ratings than participants who were in the No
Name ($M=3.4, SE=0.37$), $q(3,36) = 8.30, p < 0.01, d = 2.67$,
PopStar($M=3.7, SE = 0.33$), $q(3,36) = 7.47, p < 0.01, d = 5.53$, or
MovieStar($M=4.3, SE = 0.40$), $q(3,36) = 5.81, p < 0.01, d = 1.81$
groups.


This is a sample of my full paper, I hope that is enough.

• Welcome to TeX.SE! Please show us the code you've used to generate the screenshot you posted. – Mico Oct 7 '16 at 6:41
• Yes, formulas between $...$ will wrap, unless you put them in boxes, or you have some weird parameters set up. What's an APA style paragraph? Show your code. – Pieter van Oostrum Oct 7 '16 at 7:26
• I assume that \raggedright is applied in your document and that you write the "equations" as NoName $(M=3.4, SE=0.37)$, $q(4,36)=7.47, p<0.01, d=2.67$. Please confirm or disconfirm this hunch. – Mico Oct 7 '16 at 7:26
• @PietvanOostrum hi welcome to the site:-) – David Carlisle Oct 7 '16 at 7:45
• @PietvanOostrum I am using the APA document class and writing and APA style format to report statistical analysis findings. That is what I meant. – ComputerLocus Oct 8 '16 at 2:20

It appears that your document uses \raggedright style rather than full justification and that you input the "equations" in the following format:

NoName $(M=3.4, SE=0.37)$, $q(4,36)=7.47, p<0.01, d=2.67$;
PopStar $(M=3.7, SE=0.33)$, $q(4,36)=8.30, p<0.01, d=5.53$; or
MovieStar $(M=4.3, SE=0.40)$, $q(4,36)=5.81, p<0.01, d=1.81$ groups.


See panel A. below, which pretty much manages to replicate the "look" of your screenshot. I will call this math style "long equations" style.

Assuming this hunch is correct, there are two remedies to consider:

• Use \RaggedRight (a macro provided by the ragged2e package) instead of \raggedright, and

• use "short" equations, i.e., write

NoName ($M=3.4$, $SE=0.37$), $q(4,36)=7.47$, $p<0.01$, $d=2.67$;
PopStar ($M=3.7$, $SE=0.33$), $q(4,36)=8.30$, $p<0.01$, $d=5.53$; or
MovieStar ($M=4.3$, $SE=0.40$), $q(4,36)=5.81$, $p<0.01$, $d=1.81$ groups.


Observe that there are now five rather than two equations per line. I certainly recommend the "short equations" style.

As panels B, C, and D below illustrate, you'll get much more satisfying output if you use one of the combinations of \RaggedRight and "short" equation style.

Panel E shows the "look" that's generated if (a) full justification is in effect and (b) short equations are used.

\documentclass{article}
\usepackage{amstext,ragged2e}
\usepackage[textwidth=5.6in]{geometry}
\usepackage{setspace} \onehalfspacing
\begin{document}

\begingroup
\noindent
\verb+A. \raggedright, "long" equations+

\noindent\raggedright
ratings $F(3.36)=14.017$, $p<0.001$, $n^2_{\text{partial}}=0.539$. Specifically, participants who were in the no perfume group ($M=6.4, SE=0.34$) gave significantly higher ratings than participants who were in the NoName $(M=3.4, SE=0.37)$, $q(4,36)=7.47, p<0.01, d=2.67$;
PopStar $(M=3.7, SE=0.33)$, $q(4,36)=8.30, p<0.01, d=5.53$; or
MovieStar $(M=4.3, SE=0.40)$, $q(4,36)=5.81, p<0.01, d=1.81$ groups.

\endgroup
\bigskip\bigskip
\begingroup
\noindent
\verb+B. \RaggedRight, "long" equations+

\noindent\RaggedRight
ratings $F(3.36)=14.017$, $p<0.001$, $n^2_{\text{partial}}=0.539$. Specifically, participants who were in the no perfume group ($M=6.4, SE=0.34$) gave significantly higher ratings than participants who were in the NoName $(M=3.4, SE=0.37)$, $q(4,36)=7.47, p<0.01, d=2.67$;
PopStar $(M=3.7, SE=0.33)$, $q(4,36)=8.30, p<0.01, d=5.53$; or
MovieStar $(M=4.3, SE=0.40)$, $q(4,36)=5.81, p<0.01, d=1.81$ groups.

\endgroup

\bigskip\bigskip
\begingroup

\noindent
\verb+C. \raggedright, "short" equations+

\raggedright
\noindent
ratings $F(3.36)=14.017$, $p<0.001$, $n^2_{\text{partial}}=0.539$. Specifically, participants who were in the no perfume group ($M=6.4$, $SE=0.34$) gave significantly higher ratings than participants who were in the NoName ($M=3.4$, $SE=0.37$), $q(4,36)=7.47$, $p<0.01$, $d=2.67$;
PopStar ($M=3.7$, $SE=0.33$), $q(4,36)=8.30$, $p<0.01$, $d=5.53$; or
MovieStar ($M=4.3$, $SE=0.40$), $q(4,36)=5.81$, $p<0.01$, $d=1.81$ groups.

\endgroup

\bigskip\bigskip
\begingroup
\noindent
\verb+D. \RaggedRight, "short" equations+

\noindent\RaggedRight
ratings $F(3.36)=14.017$, $p<0.001$, $n^2_{\text{partial}}=0.539$. Specifically, participants who were in the no perfume group ($M=6.4$, $SE=0.34$) gave significantly higher ratings than participants who were in the NoName ($M=3.4$, $SE=0.37$), $q(4,36)=7.47$, $p<0.01$, $d=2.67$;
PopStar ($M=3.7$, $SE=0.33$), $q(4,36)=8.30$, $p<0.01$, $d=5.53$; or
MovieStar ($M=4.3$, $SE=0.40$), $q(4,36)=5.81$, $p<0.01$, $d=1.81$ groups.

\endgroup
\bigskip\bigskip
\noindent
\verb+E. full justification, "short" equations+

\noindent
ratings $F(3.36)=14.017$, $p<0.001$, $n^2_{\text{partial}}=0.539$. Specifically, participants who were in the no perfume group ($M=6.4$, $SE=0.34$) gave significantly higher ratings than participants who were in the NoName ($M=3.4$, $SE=0.37$), $q(4,36)=7.47$, $p<0.01$, $d=2.67$;
PopStar ($M=3.7$, $SE=0.33$), $q(4,36)=8.30$, $p<0.01$, $d=5.53$; or
MovieStar ($M=4.3$, $SE=0.40$), $q(4,36)=5.81$, $p<0.01$, $d=1.81$ groups.

\end{document}

• Full justification with "long" equations gives almost the same output as with "short" equations. – Pieter van Oostrum Oct 7 '16 at 10:14
• @PietvanOostrum - Thanks. A serious downside of the "long" equations is that the spacing after the commas is simply wrong for the material at hand. – Mico Oct 7 '16 at 11:02
• observe that with example B, using \RaggedRight, the spaces after the commas are narrower than the spaces around the equal signs and other signs of relation. can't think of a better demonstration that "short" equations are more appropriate than "long" equations. – barbara beeton Oct 7 '16 at 15:38
• Thank you. I did not specifically change anything with the justifications, however I am using Overleaf.com for my editing and it may change things. I have a document class with letterpaper,man,natbib {apa6} and the english/babel, utf8x/inputenc, amsmath, graphicx, breqn packages. I ended up going with the short equation format you suggested as I was in a bit of a time crunch, however for the future I will look at the RaggedRight and hopefully figure out why the full justication was not happening. – ComputerLocus Oct 8 '16 at 2:12
• @ComputerLocus - By all means, then, keep using the apa6 document class, just without the man option. Separately, do create "short" rather than "long' equations... – Mico Oct 10 '16 at 21:49