This is LaTeX code:
[latex]
S_n = \dfrac{n}{2}(a_1 + a_n)
[/latex]