# MikTeX freezes while compiling

MikTeX freezes when I try to compile .tex files, even for files that compiled previously. I use WinEdt as my text editor. What I'm trying to accomplish is this:

\documentclass[11pt]{report}
\usepackage{bm}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{geometry}
\geometry{left=1in,right=1in,top=1in,bottom=1in}
% ----------------------------------------------------------------
\begin{document}
\subsection*{MCMC Estimation}
One of the drawbacks to the MCMC methodology I had proposed is the long runtime, particularly when there are large numbers of items and mixture components. This concern led to the introduction of alternative methodologies, such as Fast Approximate Bayes and Weighted Likelihood Bootstrap, which I explain below. Given that the computer I use had eight core processors, I explored the possibility of using parallel processing to speed up the MCMC process. MATLAB informed me that parallel processing was not possible with the MCMC code as written. I translated the MCMC code into R, but was unable to write code that would perform parallel processing. Consequently, I took a "poor man's" approach, and ran $M=5$ independent MCMC chains in MATLAB. The running of independent chains reminded me of the $\hat{R}$ convergence test that Gelman, Carlin, Stern, and Rubin (GCSR; 2004).  $\hat{R}$ is an ANOVA-like statistic that compares the between-chain variance of draws from the posterior distribution with the variance within chains of these draws. Let $\bm{\phi}_s$ denote the draw of the vector of parameters for draw $s=\{1,\dots,S\}$ of $S$ MCMC iterations. After every 10,000 posterior draws (iterations), let $N$ denote the number of draws retained in the second half of the MCMC simulations. Let $\bm{\psi}_{ms}$ denote the $s$-th iteration's vector of posterior draws from batch $m$. In addition, let $\bm{\psi}_{m\cdot}$ and $\bm{\psi}_{\cdot\cdot}$, respectively, denote batch $m$'s posterior mean and the (overall) mean from all batches combined. Then, $B$, the between-batch variance is given by
$$B = \frac{N}{M-1} (\bm{\psi}_{m\cdot} - \bm{\psi}_{\cdot\cdot})^\prime (\bm{\psi}_{m\cdot} - \bm{\psi}_{\cdot\cdot}),$$
while $W$, the mean within-batch variance is
$$W = \frac{1}{M}\sum_{m=1}^M s^2_m,$$
where $s^2_m$ denotes the variance of batch $m$:
$$s^2_m = \frac{1}{N-1} (\bm{\psi}_{ms} - \bm{\psi}_{m\cdot})^\prime (\bm{\psi}_{ms} - \bm{\psi}_{m\cdot}).$$
The estimated marginal posterior variance, $\widehat{\text{var}}(\bm{\psi}|\text{Y})$, conditional on the observed data, $Y$, is a weighted average of the between- and within-batch variances. That is,
$$\widehat{\text{var}}(\bm{\psi}|\text{Y}) = \frac{(N-1)W + B}{N}.$$


WinEdt does not completely process the .tex document. The log file that WinEdt gives me looks like this:

Command Line:   pdflatex.exe --interaction=errorstopmode --synctex=-1 "DissertationResearchSummaryFall2019.tex"

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7250 64-bit)
entering extended mode
(DissertationResearchSummaryFall2019.tex
LaTeX2e <2019-10-01> patch level 3
("C:\Program Files\MiKTeX 2.9\tex/latex/base\report.cls"
Document Class: report 2019/10/25 v1.4k Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex/latex/base\size11.clo"))
("C:\Program Files\MiKTeX 2.9\tex/latex/tools\bm.sty")
("C:\Program Files\MiKTeX 2.9\tex/generic/babel\babel.sty"
("C:\Program Files\MiKTeX 2.9\tex/generic/babel\switch.def")
======================================================================
.
.
.
("C:\Program Files\MiKTeX 2.9\tex/latex/arabi\bblopts.cfg")
("C:\Program Files\MiKTeX 2.9\tex/latex/babel-english\english.ldf"
("C:\Program Files\MiKTeX 2.9\tex/generic/babel\babel.def"
.
.
.
(DissertationResearchSummaryFall2019.aux)
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
)
*


That's where WinEdt stops.

Thanks to @Bernard, I figured out. Somewhere along the line, I lost my

\end{document}


command.

• I have no such problem with this code, yet I use MiKTeX and WinEdt. What does the .log file say? Unrelated: you shouldn't use the plain TeX construct $$...$$, but LaTeX construct $...$ or the gather* environment with \intertext{...}`. – Bernard Nov 21 '19 at 19:38
• Move \end{document} behind the \subsection command. If it compiles, move it down until you find the place where it break. – Ulrike Fischer Nov 21 '19 at 19:57