2

I am using algorithm2e package without any problem usually with "article" or some other document classes. But with acmart (sigconf) or elsevier's elsarticle styles, I am having the following indentation issues. I cannot identify the causes.

\documentclass[sigconf]{acmart}
\usepackage[linesnumbered]{algorithm2e}

\floatstyle{boxed}
\newfloat{algo}{h}{loa}
\floatname{algo}{{\textnormal{Algo}}}

\begin{document}

\begin{algo}
\SetAlgoLined
\SetAlgoNoEnd
\DontPrintSemicolon

\KwIn{triangular set $T=(p(x)^e)$}

\KwOut{Monic polynomial $h=y^k + h_{k-1} y^{k-1} +\cdots+ h_0$ in the Weierstrass factorization theorem}

$ (u p^e + v f_k=1) \leftarrow $ Extended Euclidean Algorithm of $p^e$ and $f_k$ in $k[x]$\;

$f_k^{-1} \leftarrow v$\; \tcp*[f]{inverse of $f_k$ modulo $p^e$}

$y^k = f g + r  \leftarrow$ Division of $y^k$ by $f$ following Corollary~1 (using $v$), up to precision $O(y^{k+1})$\;
\Return{$y^k -r$}
\end{algo}
\end{document}

enter image description here

1 Answer 1

1

You define algo to represent your algorithm (as a boxed float), but it doesn't have anything to do with algorithm2e and the formatting it provides. Instead, use the functionality provided by algorithm2e and use the appropriate float name - algorithm:

enter image description here

\documentclass[sigconf]{acmart}

\usepackage[linesnumbered,boxed]{algorithm2e}

\SetAlgorithmName{Algo}{Algo}{List of Algos}
\renewcommand{\AlCapFnt}{\normalfont}

\begin{document}

\begin{algorithm}
  \caption{A caption}
  \SetAlgoLined
  \SetAlgoNoEnd
  \DontPrintSemicolon
  \KwIn{triangular set $T = (p(x)^e)$}
  \KwOut{Monic polynomial $h = y^k + h_{k - 1} y^{k - 1} + \dots + h_0$ in the Weierstrass factorization theorem}
  $ (u p^e + v f_k = 1) \leftarrow $ Extended Euclidean Algorithm of $p^e$ and $f_k$ in $k[x]$\;
  $f_k^{-1} \leftarrow v$ \tcp*[f]{inverse of $f_k$ modulo $p^e$}\;
  $y^k = f g + r \leftarrow$ Division of $y^k$ by $f$ following Corollary~1 (using $v$), up to precision $O(y^{k + 1})$\;
  \Return{$y^k - r$}
\end{algorithm}

\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .