# Positioning equation and figure side by side fails [duplicate]

I have been trying to position an equation and a figure side by side for quite some time and an equation allways mooves down for some reason. Here is the code that i use. What am i doing wrong?

\par\smallskip\nointerlineskip
\noindent
\begin{minipage}[t]{0.5\textwidth}
\includegraphics[width=\linewidth,keepaspectratio=true]{./slike-v/taylor_1.pdf}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\scriptsize
$$\label{eA1} \begin{split} P_0 &= a_0\\ P_1 &= a_0+ a_1x\\ P_2 &= a_0+ a_1x+ a_2x^2 \\ P_3 &= a_0+ a_1x+ a_2x^2+ a_3x^3+\\ &\dots \end{split}$$
\null
\par\xdef\tpd{\the\prevdepth}
\end{minipage}

-

## marked as duplicate by yo', T. Verron, lockstep, Martin Schröder, zerothFeb 13 '13 at 11:40

\begin{minipage}[t]{0.5\textwidth}
\includegraphics[width=\linewidth,keepaspectratio=true]{./slike-v/taylor_1.pdf}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}


You have two half width minipages with a word space in between. Since a word space can not shrink to zero this can not fit on one line. You need a % here

\begin{minipage}[t]{0.5\textwidth}
\includegraphics[width=\linewidth,keepaspectratio=true]{./slike-v/taylor_1.pdf}
\end{minipage}%%%%%%%%%%%%%%%%
\begin{minipage}[t]{0.5\textwidth}


Compare the setting of

A
B


and

A%
B


minipage has no special layout rules, it is just treated as a big letter by the paragraph breaker.

You may also want to use [c] rather than [t] as otherwise the baseline of the equation will align with the bottom of the image, which may make the image seem too high.

-

center both minipages and do not forget the % between the two.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{amsmath}
\begin{document}
\noindent
\begin{minipage}{0.5\textwidth}
\includegraphics[width=\linewidth,keepaspectratio=true]{./slike-v/taylor_1.pdf}
\end{minipage}%%% to prevent a space
\begin{minipage}{0.5\textwidth}
\scriptsize
$$\label{eA1} \begin{split} P_0 &= a_0\\ P_1 &= a_0+ a_1x\\ P_2 &= a_0+ a_1x+ a_2x^2 \\ P_3 &= a_0+ a_1x+ a_2x^2+ a_3x^3+\\ &\dots \end{split}$$
\null
\par\xdef\tpd{\the\prevdepth}
\end{minipage}

\end{document}

-