# mdframed package warning: you got a bad break

When I try to compile my main.tex file, the code inside a frame created with the mdframed package behaves weirdly and gives the following warning:

"Package mdframed Warning: You got a bad break because the last box will be empty you have to change it manually by changing the text, the space or something else on input line 3775."

This is the framed code:

\begin{mdframed}
\textbf{Remarks:}
\begin{itemize}
\item In general $\hat{y}(t|t-1,\theta)$ depends on previous predictions $\rightarrow$ initialization is required $\rightarrow$ transient effect $\rightarrow$ the predictor is asymptotically optimal.

Let's explain why. For ARMAX models we have $G(z^{-1})=\frac{B(z^{-1})}{A(z^{-1})}$ and $H(z^{-1})=\frac{C(z^{-1})}{A(z^{-1})}$, so the predictor will be:
\begin{equation*}
\hat{y}(t|t-1,\theta)=\left(1-\frac{A(z^{-1})}{C(z^{-1})}\right)y(t)+\frac{B(z^{-1})}{C(z^{-1})}u(t)
\end{equation*}
In this case the optimal predictor is a dynamic system itself:
\begin{equation*}
C(z^{-1})\hat{y}(t|t-1,\theta)=\left(C(z^{-1})-A(z^{-1})\right)y(t)+B(z^{-1})u(t)
\end{equation*}
When we apply the operator $z^{-1}$ we obtain the previous prediction:
\begin{align*}
\hat{y}(t|t-1,\theta)&=-c_1 \hat{y}(t-1|t-2,\theta)-c_2 \hat{y}(t-2|t-3,\theta)-\dots-c_n \hat{y}(t-n|t-n-1,\theta)+\\
&+(c_1-a_1)y(t-1)+\dots+(c_n-a_n)y(t-n)+b_1 u(t-1)+\dots+b_n u(t-n)
\end{align*}
The problem is that if we are at time $t-1$ and we want to predict the value of $y(t)$ we need all previous input output samples, all the parameters $a_i,b_i,c_i$ (where $i=1,\dots,n$) and all the previous predictions. When we compute the prediction at the starting point we haven't all this information, so we must initialize the system and we will have a transient effect and for this reason the predictor will be optimal only asymptotically.

Since $C(z^{-1})$ is at the denominator in the expression of the predictor and it has to be a stationary process, so we need that all the roots must be within the unitary circle (those of $C(z^{-1})$ as well).

A rough way to start can be: start to consider the predictions from time $t=1$ (so after $n+1$ steps) and set to zero the previous predictions.

\item In general, the $\hat{\theta}$ minimizing $J(\theta)$ cannot be found analytically (no closed-form solutions available), so we are forced to apply iterative identification algorithms (e.g. Newton-Raphson algorithm).
\end{itemize}
\end{mdframed}


And this is the result:

Is it possible to avoid this behavior still using the mdframed package? I searched for similar questions but none of them received a proper answer (if not the advice to change package).

• "change the package" is imho the only right answer. I fighted once in project with the problem to get behaving breakable boxes with mdframed and since then only use tcolorbox for this task. mdframed hasn't been updated for 7 years now. Commented May 20, 2020 at 18:44
• Already Ulrike gave better suggestion, also the package framed can meet your requirement in a better way... Commented May 21, 2020 at 6:25
• Thanks for your feedback! Since I don't need fancy frames (at the moment) I decided to use the package framed to keep it simple. Commented May 22, 2020 at 12:27
• Commented Dec 20, 2023 at 2:05

\begin{figure}[H]

The [H] requires the float package, of course.
• This looks like a terribly convoluted way to just disable breaking for the theorem, for which a simpler way is to pass nobreak=true. Commented Dec 20, 2023 at 2:19