I would like to use a equation
inside an algorithm. The following pseudo code generates a line number, which is not centered with the equation:
\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithm}
\begin{algorithmic}[1]
\State{}
\begin{equation*}
e=mc^2
\end{equation*}
\end{algorithmic}
\end{algorithm}
\end{document}
resulting in:
What I would like to have is something like:
Is there a possibility to center the line number vertically at the hight of the equation?
Thanks for your help 🙂
Best Answer
You can enclose the math environment in a
\vcenter
which itself has to been between dollars