the text in R markdown is below. I am trying to export to a pdf.

Another benefit of the multi-level model is its hierarchical structure. In this case, most games against opposing teams are played in groups of three. Each of the three games will have different pitchers. The "pitchers within games" feature was built into the model.

\center $Score_i \sim Normal(\mu_i,\sigma_i)$  \center
\center $\mu_i = \alpha_{TEAM[i]}+\beta_{ERA}+\beta_{WL}$  \center
\center $\alpha_{TEAM[i]} \sim Normal(\alpha_i,\alpha_{sigma})$  \center
\center $\alpha_i \sim Normal(0,1)$  \center
\center $\alpha_{sigma} \sim HalfCauchy(0,2)$  \center
\center $\beta_{ERA} \sim Normal(0,1)$  \center
\center $\beta_{WL} \sim Normal(0,1)$  \center
\center $\sigma_i \sim HalfCauchy(0,2.5)$  \center


The author chose to work in a Bayesian mixed-effects model built in Stan, which uses Hamiltonian Monte Carlo in order to construct posterior distributions.

Please note that the equations are not actually wrapped as code in the R markdown document.

The problem is that, although the centering and spacing on the equations are perfect, the following paragraph ("The author chose...") is still centered. In fact, ALL of the text following the equations are centered.

I would like to re-align all of the text following the equations back to the left.

• Is this a LaTex question, in that case: Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – albert Sep 5 '18 at 18:27

you should never use \center (it is the implementation of the center environment) and as it has scope the rest of the current group, all but the first are doing nothing other than add vertical space.

Delete all the \center and all the \$ and then use $a=b$ to get a centred displayed equation (or an environment such as gather* for multi-line displays..

Also words such as HalfCauchy should be marked up as \mathrm{HalfCauchy} as the default math italic font is designed to make adjacent letters not look like a word, but as a product of variables.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

Another benefit of the multi-level model is its hierarchical
structure. In this case, most games against opposing teams are played
in groups of three. Each of the three games will have different
pitchers. The "pitchers within games" feature was built into the
model.
\begin{gather*}
\mathrm{Score}_i \sim \mathrm{Normal}(\mu_i,\sigma_i)  \\
\mu_i = \alpha_{\mathrm{TEAM}[i]}+\beta_{\mathrm{ERA}}+\beta_{\mathrm{WL}}  \\
\alpha_{\mathrm{TEAM}[i]} \sim \mathrm{Normal}(\alpha_i,\alpha_{\mathrm{sigma}})  \\
\alpha_i \sim \mathrm{Normal}(0,1)  \\
\alpha_{\mathrm{sigma}} \sim \mathrm{HalfCauchy}(0,2)  \\
\beta_{\mathrm{ERA}} \sim \mathrm{Normal}(0,1)  \\
\beta_{\mathrm{WL}} \sim \mathrm{Normal}(0,1)  \\
\sigma_i \sim \mathrm{HalfCauchy}(0,2.5)
\end{gather*}
The author chose to work in a Bayesian mixed-effects model built in
Stan, which uses Hamiltonian Monte Carlo in order to construct
posterior distributions.

\end{document}

• Thank you, that worked! I'm curious about the other functions at the beginning: documentclass, amsmath, etc. They don't seem to be necessary to achieve the desired results, and the pdf won't launch without them (note I'm using R markdown). – Blake Shurtz Sep 6 '18 at 16:14
• @BlakeShurtz any latex tutorial should give an introduction to basic latex syntax, I can't really describe the language just in a comment here. Every latex document starts \documentclass.... – David Carlisle Sep 6 '18 at 16:17