TeXForm handling of derivative higher than two
Somewhat hacky:
TeXForm[y'''''[t] + 2 x'''[t] - y'[t] == x[t] /.
Derivative[k_Integer][f_] /; k > 2 :>
Superscript[f, Symbol[StringJoin[ConstantArray["′", k]]]]]
(* 2 x'''(t)+y'''''(t)-y'(t)=x(t) *)
An alternative to transforming an expression before applying TeXForm is to modify the TraditionalForm formatting rules for Derivative:
Derivative /: MakeBoxes[Derivative[n_Integer?Positive][h_],TraditionalForm] := SuperscriptBox[
MakeBoxes[h,TraditionalForm],
StringJoin@ConstantArray["\[Prime]",n]
]
Then, TeXForm will use this new FormatValue:
TeXForm[y'''''[t] + 2 x'''[t] - y'[t] == x[t]]
2 x'''(t)+y'''''(t)-y'(t)=x(t)
and ToString[.., TeXForm] as well:
ToString[y'''''[t] + 2 x'''[t] - y'[t] == x[t], TeXForm]
2 x'''(t)+y'''''(t)-y'(t)=x(t)