# How do you put this long equation in latex?

\documentclass[a4paper,12pt]{report}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[round]{natbib}
\usepackage{pgf}
\usepackage{url}
\usepackage[english]{babel}
\usepackage{multirow}
\usepackage{fancyhdr}
\usepackage{anysize}
\usepackage{amsmath, mathtools}

\begin{document}
\begin{equation}\label{eq:20}
\begin{split} \
\MoveEqLeft \{T_{1} \in (x_{1},x_{1}+h_{1}],\dots,T_{n} \in (x_{n},x_{n}+h_{n}], N(t)=n\} = \\
&\{N(0,x_{1}]=0, N(x_{1},x_{1}+h_{1}] = 1, N(x_{1}+h_{1},x_{2}]=0, \\
& N(x_{2}, x_{2}+h_{2}]=1,\dots, N(x_{n-1}+h_{n-1},x_{n}]=0, \\
& N(x_{n},x_{n}+h_{n}]=1, N(x_{n}+h_{n},t]=0\}
\end{split}
\end{equation}

Taking probabilities on both sides and using the property of independen increments of the Poisson Process N, we obtain:

\begin{equation} \label{eq:21}
\begin{split}
\MoveEqLeft  P(T_{1} \in (x_{1},x_{1}+h_{1}], \dots, T_{n} \in (x_{n},x_{n}+h_{n}], N(t)=n) \\ P(N(0,x_{1}]=0)P(N(x_{1},x_{1}+h_{1}]=1)P(N(x_{1}+h_{1},x_{2}]=0)= \\
& P(N(x_{2},x_{2}+h{2}]=1) \dots P(N(x_{n-1}+h_{n-1},x_{n}]=0) \\
&P(N(x_{n}, x_{n}+h_{n}]=1) P(N(x_{n}+h_{n},t]=0)= \\
&e^{-\mu(x_{1}}[\mu(x_{1},x_{1}+h_{1}]e^{-\mu(x_{1},x_{1}+h_{1}]}]e^{-\mu(x_{1}+h_{1},x_{2}]} \\
&[\mu(x_{2},x_{2}+h_{2}]e^{-\mu(x_{2}, x_{2}+h_{2}]}] \dots e^{-\mu(x_{n-1}+h_{n-1},x_{n}]} \\
&[\mu(x_{n}, x_{n}+h_{n}]e^{-\mu(x_{n}, x_{n}+h_{n}]]e^{\mu(x_{n}+h_{n},t]}= \\
&e^{-\mu(t)} \mu(x_{1}, x_{1}+h_{1}] \dots \mu(x_{n}, x_{n}+h_{n}]
\end{split}
\end{equation}
\end{document}


I write this in LaTeX and I have an error.

Gives me error because I have other split before?

Can I help me to solve equation?

• Welcome. Please add a complete and compilable MWE so that we can solve your issue easier. By the way, what do you mean by "Can I help me" :)) ?
– user156344
Jan 13, 2019 at 15:02
• Other commands added. The equation number 20 give me right, the equation 21 did not run give me an error to PDF. Jan 13, 2019 at 15:08
• Read here about what an MWE is. Without it we can't reproduce your error. Just adding a \documentclass{} is not enough, because your equation may use package amsmath or something... By the way, there are more { than } in your equation, which clearly leads to a fatal error.
– user156344
Jan 13, 2019 at 15:15
• You should put your usepackage not in comment, but edit your MWE. I did it for you. Btw, I am not a scientist, but your code would be more readable if you indent your equations. Most TeX editors have functions that allow you to jump from one opening brace to the closing one. Use them to track the unclosed one. Jan 13, 2019 at 15:59
• the error is simply that you are missing a } in e^{-\mu(x_{n}, x_{n}+h_{n} two lines up from the bottom you then just get warnings that it is too wide Jan 13, 2019 at 16:11

As already pointed out by David Carlisle, the immediate source of the syntax error in the second equation environment is that a } was incorrectly written as ].

In addition, there seem to be a few more errors of mathematical content, such as incorrectly placed square brackets. I've tried my best to clean up the appearance of both equations. Hopefully, you can use this code as a half-way point towards cleaning up the remaining issues.

Observe that I replaced some of the \dots directives with \dotsb ("dots binary"), as they (i.e., the typographic ellipses) would appear to indicate multiplicative elision. \documentclass[a4paper,12pt]{report}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
%% Commented out unneeded \usepackage statements:
%\usepackage[round]{natbib}
%\usepackage{pgf}
%\usepackage{url}
%\usepackage[english]{babel}
%\usepackage{multirow}
%\usepackage{fancyhdr}
%\usepackage{anysize}
\usepackage{mathtools} % 'mathtools' loads 'amsmath' automatically
\begin{document}
\setcounter{equation}{19} % just for this example

\begin{equation}\label{eq:20}
\begin{split}
\MoveEqLeft
\bigl\{T_{1} \in (x_{1},x_{1}+h_{1}],\dots,T_{n} \in (x_{n},x_{n}+h_{n}], N(t)=n \bigr\} \\
{}=\bigl\{&N(0,x_{1}]=0, N(x_{1},x_{1}+h_{1}] = 1, N(x_{1}+h_{1},x_{2}]=0, \\
& N(x_{2}, x_{2}+h_{2}]=1,\dots, N(x_{n-1}+h_{n-1},x_{n}]=0, \\
& N(x_{n},x_{n}+h_{n}]=1, N(x_{n}+h_{n},t]=0 \bigr\}
\end{split}
\end{equation}

Taking probabilities on both sides and using the property of independent increments of the Poisson Process $N$, we obtain:
\begin{equation} \label{eq:21}
\begin{split}
\MoveEqLeft
P\bigl(T_{1} \in (x_{1},x_{1}+h_{1}], \dots, T_{n} \in (x_{n},x_{n}+h_{n}], N(t)=n\bigr) \\
{}={}&P(N(0,x_{1}]=0)\,
P(N(x_{1},x_{1}+h_{1}]=1)\,
P(N(x_{1}+h_{1},x_{2}]=0) \\
&P(N(x_{2},x_{2}+h_{2}]=1) \dotsb
P(N(x_{n-1}+h_{n-1},x_{n}]=0) \\
&P(N(x_{n}, x_{n}+h_{n}]=1)\,
P(N(x_{n}+h_{n},t]=0) \\
{}={}&e^{-\mu(x_{1}}[\mu(x_{1},x_{1}+h_{1}]\,
e^{-\mu(x_{1},x_{1}+h_{1}]}]\,
e^{-\mu(x_{1}+h_{1},x_{2}]}[\mu(x_{2},x_{2}+h_{2}] \\
&e^{-\mu(x_{2}, x_{2}+h_{2}]}] \dotsm
e^{-\mu(x_{n-1}+h_{n-1},x_{n}]}[\mu(x_{n}, x_{n}+h_{n}] \\
&e^{-\mu(x_{n}, x_{n}+h_{n}}]\,
e^{\mu(x_{n}+h_{n},t]} \\
{}={}&e^{-\mu(t)} \mu(x_{1}, x_{1}+h_{1}] \dotsb \mu(x_{n}, x_{n}+h_{n}]
\end{split}
\end{equation}
\end{document}

• I couldn't understand the content so just went with it as it was which is why I was so much faster than you:-) but the time seems to have been well spent, I will delete my answer Jan 13, 2019 at 16:26

The line &[\mu(x_{n}, x_{n}+h_{n}]e^{-\mu(x_{n}, x_{n}+h_{n}]]e^{\mu(x_{n}+h_{n},t]}= miss a \} (second to last line of the second paragraph).

Here is the working LaTeX, but beware, it looks horrible :

\begin{equation}\label{eq:20}
\begin{split} \
\MoveEqLeft \{T_{1} \in (x_{1},x_{1}+h_{1}],\dots,T_{n} \in (x_{n},x_{n}+h_{n}], N(t)=n\} = \\
&\{N(0,x_{1}]=0, N(x_{1},x_{1}+h_{1}] = 1, N(x_{1}+h_{1},x_{2}]=0, \\
& N(x_{2}, x_{2}+h_{2}]=1,\dots, N(x_{n-1}+h_{n-1},x_{n}]=0, \\
& N(x_{n},x_{n}+h_{n}]=1, N(x_{n}+h_{n},t]=0\}
\end{split}
\end{equation}

Taking probabilities on both sides and using the property of independen increments of the Poisson Process N, we obtain:

\begin{equation} \label{eq:21}
\begin{split}
\MoveEqLeft  P(T_{1} \in (x_{1},x_{1}+h_{1}], \dots, T_{n} \in (x_{n},x_{n}+h_{n}], N(t)=n)
\\
P(N(0,x_{1}]=0)P(N(x_{1},x_{1}+h_{1}]=1)P(N(x_{1}+h_{1},x_{2}]=0)=
\\
& P(N(x_{2},x_{2}+h{2}]=1) \dots P(N(x_{n-1}+h_{n-1},x_{n}]=0)
\\
&P(N(x_{n}, x_{n}+h_{n}]=1) P(N(x_{n}+h_{n},t]=0)=
\\
&e^{-\mu(x_{1}}[\mu(x_{1},x_{1}+h_{1}]e^{-\mu(x_{1},x_{1}+h_{1}]}]e^{-\mu(x_{1}+h_{1},x_{2}]}
\\
&[\mu(x_{2},x_{2}+h_{2}]e^{-\mu(x_{2}, x_{2}+h_{2}]}] \dots e^{-\mu(x_{n-1}+h_{n-1},x_{n}]}
\\
&[\mu(x_{n}, x_{n}+h_{n}]e^{-\mu(x_{n}, x_{n}+h_{n}]]e^{\mu(x_{n}+h_{n},t]}}=
\\
&e^{-\mu(t)} \mu(x_{1}, x_{1}+h_{1}] \dots \mu(x_{n}, x_{n}+h_{n}]
\end{split}
\end{equation}


But I must recommend you to use \begin{align} or \begin{align*} instead of \begin{equation}\begin{split} as it is the norm now.

Here is an example :

\begin{align*}
&P(T_{1} \in (x_{1},x_{1}+h_{1}], \dots, T_{n} \in (x_{n},x_{n}+h_{n}], N(t)=n) =
\\
& \hspace{1cm} \{N(0,x_{1}]=0, N(x_{1},x_{1}+h_{1}] = 1, N(x_{1}+h_{1},x_{2}]=0,
\\
& N(x_{2}, x_{2}+h_{2}]=1,\dots, N(x_{n-1}+h_{n-1},x_{n}]=0,
\\
& N(x_{n},x_{n}+h_{n}]=1, N(x_{n}+h_{n},t]=0\}
\end{align*}


Note \hspace to make a ligne start just a bit later in order to make it look like a line break instead of a new line.