[Tex/LaTex] adding an image as an equation with number

equations

I had troubles writing a dynamic-programming formulas using Latex (they were too long and I was not able to break them into lines and indent them adequately using Latex), which finally made we write them in PowerPoint and add them as PNG files using \begin{figure}[H].

All the formulas in the paper I am writing, are enumerated, i.e., they appear with a reference number that looks like (i), as I wrote them within an equation block.

The problem, of course, is that the dynamic-programming formulas that I included using figure blocks are not enumerated like the real LaTeX equations are.

Is there a way to make LaTeX wrap my figures with equation blocks, so that it also enumerates the image-based formulas?

Alternatively, is there a way to produce a LaTeX equation that looks like this? (Made this in PowerPoint and indented by separating into different objects that I could move to wherever I wanted):
enter image description here

Best Answer

Using a visual system to indent by dragging means it is impossible or at least hard to get consistent indentation throughout the document, for example here having cost to the left of the : makes it hard to see if the cost expression is in the scope of the for all i.

Using a bitmap format for moving the formula to tex makes the already poor typesetting much worse as bitmap formats really render poorly in pdf, especially if you zoom in or out.

You could use a setting such as the one below (if you really want grad and scaled to be italic, that could be arranged as well.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator\grad{grad}
\DeclareMathOperator\scaled{scaled}
\begin{document}
\begin{equation}
\begin{aligned}
  \forall i \colon{}&\mathit{MinIndices}[0] \leq i\leq\mathit{MaxIndices}[0]\\
&\mathit{cost}[0,i]=\lVert\grad(r[0:\mathit{Anchors}[0]])\\
&\quad-\grad(\scaled(w[0:i],\mathit{Lengths}[0]))\rVert
\end{aligned}
\end{equation}
\end{document}
Related Question