# Indentation not aligning while using algorithm2e package

Below is my latex:

\usepackage[ruled,longend]{algorithm2e}
\begin{algorithm}
$I \gets \text{Images of objects' plane}$\newline
$Detector \gets \text{Define detector}$\newline
$Descriptor \gets \text{Define Descriptor}$\newline
\end{algorithm}


But the first line is un aligned

Line-ends within an algorithm environment under algorithm2e require the use of \;, not \newline.

\documentclass{article}

\usepackage{amsmath}
\usepackage[ruled,longend]{algorithm2e}

\begin{document}

\begin{algorithm}
$I \gets \text{Images of objects' plane}$\;
$\text{Detector} \gets \text{Define detector}$\;
$\text{Descriptor} \gets \text{Define Descriptor}$\;
\end{algorithm}

\end{document}


If you don't like the semicolons printed, then add

\DontPrintSemicolon


somewhere after loading algorithm2e.

• Would \DontPrintSemicolon remove all the semicolons in the text or just in the algorithm section? – paul-shuvo Feb 20 at 2:46
• @paul-shuvo: Just the semicolons associated with \; within the algorithm environment. – Werner Feb 20 at 2:47