Subequation is adding a random 9 to the end of my equation [closed]

Here is the full equation block:

    \documentclass[12pt, English]{article}
\usepackage{amsfonts,amsmath,amssymb}
\usepackage{epsf, subfigure, verbatim, epsfig}
\usepackage{lineno, color}
\usepackage{geometry}
\geometry{verbose,letterpaper,tmargin=2.54cm,bmargin=2.54cm,
lmargin=2.54cm,rmargin=2.54cm}
\newtheorem{defi}{Definition}
\newtheorem{prop}{Proposition}
\newtheorem{theo}{Theorem}
\newtheorem{lemm}{Lemma}
\newtheorem{rema}{Remark}
\newtheorem{coro}{Corollary}
\DeclareMathOperator{\tr}{Tr}
\newcommand{\dsize}{\displaystyle}
\newcommand{\jdn}{\textcolor{blue}}
\newcommand{\njr}{\textcolor{red}}
\newcommand{\am}{\textcolor{NavyBlue}}
\newcommand{\dif}{\mathrm{d}}
\linenumbers
%\bibpunct{(}{)}{;}{p}{,}{,}
% Patch to fix line numbering problem
\newcommand*\patchAmsMathEnvironmentForLineno[1]{%
\expandafter\let\csname old#1\expandafter\endcsname
\csname #1\endcsname
\expandafter\let\csname oldend#1\expandafter\endcsname
\csnameend#1\endcsname
\renewenvironment{#1}%
{\linenomath\csname old#1\endcsname}%
{\csname oldend#1\endcsname\endlinenomath}}%
\newcommand*\patchBothAmsMathEnvironmentsForLineno[1]{%
\patchAmsMathEnvironmentForLineno{#1}%
\patchAmsMathEnvironmentForLineno{#1*}}%
\AtBeginDocument{%
\patchBothAmsMathEnvironmentsForLineno{equation}%
\patchBothAmsMathEnvironmentsForLineno{align}%
\patchBothAmsMathEnvironmentsForLineno{flalign}%
\patchBothAmsMathEnvironmentsForLineno{alignat}%
\patchBothAmsMathEnvironmentsForLineno{gather}%
\patchBothAmsMathEnvironmentsForLineno{multline}%
}
\begin{document}
\begin{titlepage}
Title
\end{titlepage}
\begin{abstract}
Abstract
\end{abstract}
\section{Model}

\begin{subequations} \label{eq:MainMod}
\begin{align}
x_1(n+1) &= \lambda_s x_1(n) + (1-\delta_m)\lambda_m x_2(n) + (1-
\delta_h)\lambda_h x_3(n) + \eta_s \lambda_c x_4(n)\\
& \hspace{5ex} + (1-\mu_s)\hat{x}_1(n,1) + \alpha_m (1-\mu_m)
\hat{x}_2(n,1), \nonumber\\
x_2(n+1) &= \eta_m \lambda_c x_4(n) + (1-\mu_m)(1-\alpha_m)\hat{x}_2(n,1),\\
x_3(n+1) &= \delta_h \lambda_h x_3(n) + \eta_h \lambda_c x_4(n) + (1-
\mu_h)\hat{x}_3(n,1) + \alpha_c (1-\mu_c) \hat{x}_4(n,1),\\
x_4(n+1) &= (1-\mu_c) (1-\alpha_c) \hat{x}_4(n,1),
\end{align}
\end{subequations}
\end{document}


And it shows up normally until the last line which looks like:

x_4(n+1) = (1-mu_c)(1-alpha_c)xhat_4(n,1),^9

(Can I attach a screenshot somehow?)

I've tried eliminating the comma right after the last term in the code, but that doesn't work.

closed as unclear what you're asking by user36296, Zarko, Mico, barbara beeton, diabonasOct 1 '17 at 15:05

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• please merge your two code snippets to one small but complete document which reproduce your problem. in this please remove all not relevant stuff from document preamble. help us to help you! welcome to tex.se! – Zarko Aug 9 '17 at 22:08
• @Zarko I'm slightly new to latex, so I was hoping to provide full disclosure of my preamble in case there was something I wasn't aware of :\ – ClimbingChemist Aug 9 '17 at 22:26
• @Zarko I deleted a few, but really not sure about the others. – ClimbingChemist Aug 9 '17 at 22:32
• well, delete wsome preamble and test, if your problem still presis. do thes so far, that you cancompile your equation. i test it and in \documentclass{article}\usepackage{amsmath}\begin{document}.... your equations...\end{document} i can't reproduce your proble. – Zarko Aug 9 '17 at 22:38
• even with your document i cant reproduce your problem. do you test this code? does it still reproduce your problem? do you really need line numbering and all this patch for it? i cant see any benefits of them. – Zarko Aug 9 '17 at 22:47