command \u invalid in math mode

\begin{alignat}{2}
&\int (x-2)^2 dx\\
&\int (x^2+1)^2 dx\\
&\int(x+1)(x-1)dx\\
&\int (2x+1)(x^2-1)dx\\
&\int d(2x+1)\\
&\int d(x^3+2)\\
&\int x f(x)dx=x^3+3x^2-1,\,\,\, f(x)=?\\
&\int xf(x)dx=x^4-5x^2, \,\,\, f(1)=?\\
&\int f(x)dx=-2x^2+4x+c, \,\,\, f(3)=?\\
&\int \frac{d}{dx}\int x^3+2dx\\
&\int \frac{d}{dx}\int\frac{x^2+1}{x^3-2}dx\\
&\frac{d}{dx}\int d(x^3-2x+1)\\
&f(x)=\int d(x^2+1),\,\,\, f'(4)=?\\
&f(x)=\int (x^3-x+3)dx,\,\,\, f'(-1)=?\\
&f(x)= \int (6x^2-x+1)dx, \, x=2 \,\, olduğunda \,\, f(x)'in \,\, eğimi=?
\end{alignat}


When I run the code I get the error 'please use \mathaccent for accents in math mode. You can't use \spacefactor in math mode . Command \u invalid in math mode' How can I resolve this issue ?

• Welcome to the TeX.SE. What is your babel? Sep 16 '20 at 20:55
• do not use math italic for multi-letter words, if there are accented letters it gives errors but it looks bad in any case, use \textrm{olduğunda} Sep 16 '20 at 20:57

Text in formulas should be properly segregated.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[turkish]{babel}
\usepackage{amsmath}

\begin{document}

\begin{alignat}{2}
&\int (x-2)^2 \,dx\\
&\int (x^2+1)^2 \,dx\\
&\int(x+1)(x-1)\,dx\\
&\int (2x+1)(x^2-1)\,dx\\
&\int d(2x+1)\\
&\int d(x^3+2)\\
&\int \frac{d}{dx}\int (x^3+2)\,dx\\
&\int \frac{d}{dx}\int\frac{x^2+1}{x^3-2}\,dx\\
&\frac{d}{dx}\int d(x^3-2x+1)\\
&f(x)=\int (6x^2-x+1)\,dx,  &\quad& \text{$x=2$ olduğunda $f(x)$'in eğimi}=\text{?}
\end{alignat}

\end{document}


Don't forget \, before dx in integrals.

• thanks a lot mate Sep 16 '20 at 21:00
• Do you know also the turkish language :-)? :-) Sep 16 '20 at 21:03
• @Sebastiano - If you fire up Google Translate and enter a word of an unknown language into the left-hand box, the software tends to do a very good job identifying the language for you. In the present case, the presence of the letter "ğ" (with a u-shaped accent) pretty much is a dead give-away that the language is Turkish. (I learned from Google Translate this evening that "olduğunda" means "when" and that "eğimi" means "slope".)
– Mico
Sep 16 '20 at 21:13
• @Mico It is also true :-)....tomorrow I begin with the school....and my thoughts are often on Venus, or on Moon...:-) Sep 16 '20 at 21:15
• @Mico Yes; the “’in” suffix is another telltale. Sep 16 '20 at 21:16