# How do I format the following equation in LaTex?

What packages and commands do I need to format the following equation into a LaTeX document (ignore the background, I just need the equation)

• Welcome to TSE. What did you try? Sep 20 at 20:43

The easiest way, I think)

 \documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{actuarialangle}

\begin{document}

$s_{\actuarialangle{n}i}=\frac{(1+i)^{n}-1}{i}$

\end{document}

• The screenshot you posted doesn't correspond fully to the code above. For one, the code uses s, but the screenshot shows S. In addition, the math mode in use the screenshot looks to be \displaystyle, whereas the code employs \textstyle. Please fix.
– Mico
Sep 21 at 20:10

Something like this perhaps

\documentclass{article}

\begin{document}

$s_{\smash{\overline{n}}\vrule\,i}=\frac{(1+i)^n-1}{i}$

\end{document}


A modification of https://tex.stackexchange.com/a/140172/4427

\documentclass{article}

\NewDocumentCommand{\annuity}{mo}{%
\hbox{%
\vbox{
\offinterlineskip
\mathsurround=0pt
\ialign{##&\vrule##\cr
\noalign{\hrule}%
&height 1pt\cr
$\scriptstyle#1\hskip\scriptspace$&\cr
}%
}%
\IfValueT{#2}{$\scriptstyle\,#2$}%
}%
}

\begin{document}

$s_{\annuity{n}[i]}=\frac{(1+i)^n-1}{i}$
$s_{\annuity{n}}\quad s_{\annuity{p}}$

\end{document}