0
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage[noend]{algpseudocode}
\usepackage[linesnumbered,ruled]{algorithm2e}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

\title{AlgorithmTemplate}
\usepackage{fullpage}
\usepackage{times}
\usepackage{fancyhdr}
\include{pythonlisting}

\begin{document}


\title{Title}

\author{

}



\maketitle

\begin{abstract}
\end{abstract}

\begin{IEEEkeywords}
Keys
\end{IEEEkeywords}

\section{Introduction}
Ref~\cite{case2016analysis}.


\begin{algorithm}
\SetKwInOut{Input}{Input}
\SetKwInOut{Output}{Output}

\textbf{Data}: \\

\For{$\omega = 1,2, \cdots, N$}{
Vectors $Z_n=(z_{1},\cdots , z_{n})$:
$x = y + z$

\If{$\tau \in \{\chi\}$ in $\sigma$}{       
}

}
\Output{Score}
\caption{Algo}
\end{algorithm}



\bibliographystyle{IEEEtran}
\bibliography{Ref}

\end{document}

I have the following problem in the algorithm as I want to group statements under Vectors and I don't want to number the "if" statement as it's part of group under Vectors below,

enter image description here

This is what I want,

![enter image description here

Avv
  • 157
  • 3
  • There is also https://tex.stackexchange.com/questions/223353/algorithm2e-package-edit-the-line-numbers which does something very similar to the proposed duplicate. – Marijn Apr 14 '21 at 12:32
  • 1
    The answers you've shared hide the lines rather than not count them. The result in OP's case would be lines 1 2 3 7. The last end would be 7 and lines 4 -6 would be hidden. We want the counting to stop and resume on the last end. Also, they are with algorithm2e rather than algorithmicx, So I voted to keep open – Elad Den Apr 14 '21 at 14:46
  • 1
    UGH just noticed OP was using algorithm2e... Still not the answer he was looking for though – Elad Den Apr 14 '21 at 14:57
  • 1
    I've tried this answer https://tex.stackexchange.com/a/153906/90297 , but it also numbers the first end. If you could go with no ends, then that's fine, or find some way to redefine nonl in the end block somehow – Elad Den Apr 14 '21 at 15:59
  • @EladDen you are right, the proposed duplicates did not take automatically generated 'end' lines into account. I added a new answer to the first duplicate for this case, so this question can be closed while still helping the OP. – Marijn Apr 15 '21 at 12:19
  • @EladDen. Thank you very much. – Avv Apr 15 '21 at 18:15
  • @Marijn. Thank you. – Avv Apr 15 '21 at 18:15
  • @Marijn. Thank you very much. My second issues remains as I want to group $x=y+z$ within $Vectors Z_n=(z_1,\cdots , z_n)$ block and also the $if$ statement, can you please show how to do that? – Avv Apr 15 '21 at 18:26
  • You could introduce a new, empty 'keyword' for this. For example \SetKwFor{ExtraGroup}{}{}{} outside of the algorithm, which creates a new command \ExtraGroup with two arguments, the first line and the body, so in this case \ExtraGroup{\emph{Vectors} $Z_n$}{$x = y + z$\; etc}. You need the \emph to cancel out the default formatting for the first command argument. – Marijn Apr 15 '21 at 21:34

0 Answers0