0

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

  • 1
    don't put them in \begin{figure} put them in \begin{equation} but using powerpoint generated png should be the absolute last option!!! – David Carlisle Jul 23 '18 at 21:31
  • Thanks! I agree. But I must have had an option to break the lines and indent each line as much as I wanted, in order to produce a readable formula, which I was not able to figure out how to implement. – AgvaniaRekuva Jul 23 '18 at 21:32
  • Using the figure environment to insert an image is not necessary in this case. \includegraphics can stand on its own, just like tabular doesn't need a table environment. – Werner Jul 23 '18 at 21:33
  • 1
    You're missing an opening { in the formula. Where should that be? – Werner Jul 23 '18 at 21:34
  • 2
    @AgvaniaRekuva: Perhaps you should post the question as to how to typeset the equation as you desire directly in LaTeX instead. – Peter Grill Jul 23 '18 at 21:34
2

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}
1

You can simply include the image within the equation, however it is probably easier to write the formulas directly in tex.

\documentclass{article}

\usepackage{graphicx}

\begin{document}

\begin{equation}
\includegraphics[width=.5\textwidth]{example-image}
\end{equation}

\end{document}

A short example how you could write multiline equations:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align}
 a  & = b \notag \\
        & - c
\end{align}


\end{document}
0

You can, with \includegraphics:

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx} 

\begin{document}

\begin{equation}
  \begin{matrix}\includegraphics[scale=0.8]{schoolgirlsnotebook}\end{matrix}
\end{equation}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.