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:

    \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:
    In this case the optimal predictor is a dynamic system itself:
    When we apply the operator $z^{-1}$ we obtain the previous prediction:
        \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)
    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).

And this is the result:

enter image description here

enter image description here

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).

Thanks in advance for your help!

  • 3
    "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. May 20, 2020 at 18:44
  • Already Ulrike gave better suggestion, also the package framed can meet your requirement in a better way...
    – MadyYuvi
    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.
    – Stefano
    May 22, 2020 at 12:27

1 Answer 1


You can otherwise simply put it inside a


The [H] requires the float package, of course.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .