# $\rm\LaTeX$ align code is not working properly.

I had used the $$\rm\LaTeX$$ command \begin{align}...\end{align} but the equations are not perfectly aligned. This is the code I used

\begin{align} f(x)&=\lim_{n\to\infty} \frac{ax} {n}\left(\sum_{k=1}^n \frac{[k^2-e^{-x}+k-1]}{k(k+1)}\right)+\lambda\\ &=\lim_{n\to\infty} \frac{ax}{n}\left(\sum_{k=1}^n \frac{k^2+k-2}{k(k+1)}\right)+\lambda\\ &=\lim_{n\to\infty} \frac{ax}{n}\left(\sum_{k=1}^n 1-2\left(\frac{1}{k}-\frac{1}{k+1}\right)\right)+\lambda\\ &=\lim_{n\to\infty} \frac{ax}{n}\left(n+\frac{1}{n+1}-2\right)+\lambda\\ &=ax+\lambda \end{align}

What's wrong with the code? Or how can I fix it so that the equations are properly aligned?

• When I view the linked Answer on the main site, the equations appear properly aligned. I use Chromium on Linux (Fedora 31), and my Math Settings are Math Renderer HTML+CSS with Fast Preview enabled. – hardmath Jun 19 at 4:10
• Ok! I'm using mobile site. It might be because of that as the features are optimized on mobile site. – SarGe Jun 19 at 4:40
• I don't know what is causing the problem, but there are two potential issues: (1) you put the align environment into an inline math environment. Don't do this. MathJax detects \begin{align} and \end{align} all on its own; you don't need (or want) to put this environment into another math environment; (2) it is possible that the "responsive design" is causing problems---phone screens are quite narrow, and it may be that your lines are too long to render nicely on a phone screen. – Xander Henderson Jun 19 at 5:15