0

I am trying to compile a .tex file in Overleaf, I am using the IEEEAccess template to write the manuscript. When I compile the LaTeX file, it throws the error on the given algorithm script. I am showing the initial page too, with the preamble.

The preamble:

\documentclass{ieeeaccess}
\usepackage{cite}
\usepackage[ruled,lined,linesnumbered]{algorithm2e}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{csquotes}
\usepackage{color}
\newcommand{\cb}{\textcolor{blue}}
\newcommand{\cred}{\textcolor{red}}
\newcommand{\cg}{\textcolor{green}}
\usepackage{amsthm}
\newtheorem{lem}{Lemma}
\newtheorem{definition}{Definition}

The script for the algorithm:

\begin{algorithm}[h!]
\SetAlgoLined
    \SetKwInOut{Input}{Input}
    \SetKwInOut{Output}{Output}
    
    \Input{$G =\left \langle N,E,W \right \rangle:$ graph network, $B\left(G_{i}\right):$ Set of boundary nodes, $E_{b}:$ Set of boundary edges}
    \Output{$G_{emb}:$ Embedded Graph Network}
    %initialize $Dist_{mat}\left(k,v\right) \leftarrow \emptyset$\;
    \protect Step-1: Compute the shortest path from each boundary node to another boundary node\\
    \ForEach{boundary node $n^{b}_{i} \in B\left(G_{i}\right)$}{
        \emph{SPList} $\left(B_{spf}\right) \leftarrow YenAlgorithm.runSP\left(G, srcVertex, destVertex\right)$
    
    }
    \KwRet{$\emph{SPList} \left(B_{sp}\right)$}
    \protect Step-2: Create an Embedded network by unifying the shortest-path list\\
    $G_{emb} \leftarrow \emptyset$ \tcp*{Create a new empty graph}
    \ForEach{$e_{ij} \in E_{b}$}{
        $G_{emb} \leftarrow \emph{addEdge}\left(e_{ij}\right)$
    }
    \ForEach{\emph{shortest-path} $\left(B_{sp}\right) \in \emph{SPList} \left(B_{sp}\right)$}{
        \If{$e_{ij} \in E_{b}$}{
            \If{$n^{b}_{i}.partitionId = n^{b}_{j}.partitionId$}{
                $G_{emb} \leftarrow \emph{addEdge}\left(e_{ij}\right)$}}
    }
    \KwRet{$G_{emb}$}
 \caption{Embedded Graph Construction}
    \label{alg:embGraph}
\end{algorithm}

The file compiles, however, the algorithm adds negative -2 in front of the line numbers.

The output of the algorithm

The errors are:

Argument of \relsize  has an extra }.
Argument of \relsize  has an extra }.
Argument of \relsize  has an extra }.
Runaway argument?
Argument of \@algocf@endoption has an extra }.

The errors are in the following lines:

Overleaf Script

How do I solve this issue? The .tex file compiles completely fine if I remove the algorithm part.

0

1 Answer 1

0

Solution: Just add these 3 lines of code in the latex file.

\RequirePackage{letltxmacro}
\LetLtxMacro{\LaTeXtextbf}{\textbf}
\LetLtxMacro{\textbf}{\LaTeXtextbf}

\documentclass{ieeeaccess}

Once I added these lines and compiled them, the algorithms were back to normal with the correct line numbers.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.