# Writing in-line equations on multiple lines using \displaystyle

I'm trying to write equations on multiple lines using \displaystyle. I can use \\ for line breaks but can't align or put horizontal space on the second line.

\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath,amsfonts,amssymb}

\begin{document}

\begin{itemize}
\item $\displaystyle (n+1)^2+5(n+1)+1 = n^2+2n+1+5n+5+1 \\ %\hspace{4em} %%& %\quad = n^2+7n+7$
\end{itemize}

\end{document}


Note that the equation is in-line and should start at the bullet point. I have made several attempts to indent the second line but the output always looks like

(Note that this is a MWE - the actual equation I'm typesetting is more complicated.) Is there a way to align the two lines of the equation at the = sign? This is indicated by the red arrow in the picture.

• Well, that's the cause for the align environment ;-) \begin{align} (n+1)^2+5(n+1)+1 &= n^2+2n+1+5n+5+1 \\ &= n^2+7n+7 \end{align} and its variants alignat and aligned etc. – user31729 Feb 6 at 9:39
• yes but I want the equation to start on the line with the bullet point, not after it – Medulla Oblongata Feb 6 at 9:41
• That's why I suggested aligned as well ... – user31729 Feb 6 at 9:42

Use aligned with top vertical alignment.

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{itemize}
\item \begin{aligned}[t] (n+1)^2+5(n+1)+1 &= n^2+2n+1+5n+5+1 \\ &= n^2+7n+7 \end{aligned}
\end{itemize}

\end{document}


I removed the packages that are unnecessary for the example; amsfonts is loaded by amssymb anyway.

Are you sure you want to continue using latin1 for your documents?

• No the latin1 isn't necessary. It's just part of one of the "quick start" templates offered by my Latex editor. – Medulla Oblongata Feb 6 at 9:48