n = 0 (slider from 0 to 50, step 1)
L = Sequence((Simplify[(-1)^(k)] / Simplify[(2 * k)]! * x^(Simplify[(2 * k)])), k, 0, n / 2)
p = Sum(L)
m = 9 (slider from 1 to 10, step 1)
transformation(x) = If[x ≥ 0, floor(x / 2) + 1]
terme = Min(transformation(n), transformation(m))
lastsign = If(IsInteger[transformation(n) / 2], "", "+")
last = If(transformation(n) > terme, LaTeX[lastsign + (Element[L, floor(n / 2) + 1])], "")
p_{t} = If(terme > 1, Sum[L, terme], p)
f(x) = cos(x)
ellipsis = Text(If[transformation(n) - 1 > terme, "+-\;...", ""])
Text1: "\textcolor{#3333FF}{" + (LaTeX[f]) + "}≈" + (LaTeX[p_{t}]) + "" + (LaTeX[ellipsis]) + "" + (LaTeX[last]) + ""