[Tex/LaTex] How to add figure and equation side by side

equationsfloats

There's a similar question posted here, but I need to have it as a figure element, not just an image. Also, the equation is not left-aligned(I think).
So far I've tried this

\begin{center}
\begin{minipage}[t]{.6\columnwidth}
\centering
\includegraphics[valign=t,width = 4cm]{images/box_axis.png}
\end{minipage}\hfill
\begin{minipage}[t]{.4\columnwidth}
\begin{align}
% \hfill
\begin{split}
p_c = (w/2, h/2)
\\
p_x = (w, h/2)
\\
p_y = (w/2, 0)
\end{split}
\end{align}
\end{minipage}
\end{center}

Which renders to

I want to have the figure with caption and equation on the right aligned.

Best Answer

Obviously I do not have your graphics, but this is what you can do.

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\begin{document}
\begin{equation}
\vcenter{\hbox{\includegraphics[width=4cm,height=4cm]{example-image-duck}}}
\qquad\qquad
\begin{aligned}
p_c &= (w/2, h/2)
\\
p_x &= (w, h/2)
\\
p_y &= (w/2, 0)
\end{aligned}
\end{equation}
\end{document}

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}
\begin{equation}
\vcenter{\hbox{\begin{minipage}{5cm}
\centering
\includegraphics[width=4cm,height=4cm]{example-image-duck}
\captionof{figure}{Some nice words about ducks and marmots.}
\end{minipage}}}
\qquad\qquad
\begin{aligned}
p_c &= (w/2, h/2)
\\
p_x &= (w, h/2)
\\
p_y &= (w/2, 0)
\end{aligned}
\end{equation}
\end{document}

enter image description here

If you want to align the equations vertically w.r.t. the figure without caption, you can use this.

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}
\begin{align}
\vcenter{\hbox{\includegraphics[width=4cm,height=4cm]{example-image-duck}}}
&\qquad\qquad
\begin{aligned}
p_c &= (w/2, h/2)
\\
p_x &= (w, h/2)
\\
p_y &= (w/2, 0)
\end{aligned}\\
\vcenter{\hbox{\begin{minipage}{4cm}
\captionof{figure}{Some nice words about ducks and marmots.}
\end{minipage}}}
& \notag
\end{align}
Another equation.
\begin{equation}
 E=mc^2
\end{equation}
\end{document}

enter image description here

As you can see, the positions of the equation numbers match. You can also put it in a figure environment but then the system will float (unless you take drastic measures).

Related Question