Below a code containing an algorithm. I need to avoid numbering the line containing the if statement.
Code: Select all
\documentclass[12pt, a4paper]{report}
%%%%%%%%%%%%%% Debut du Rapport %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{minitoc}
\usepackage{glossaries}
\usepackage{subfigure}
\usepackage[pdftex]{graphicx} % to insert PostScript figures
\usepackage{rotating}
\usepackage{footnote} % for sideways tables/figures
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[chapter]{algorithm}
\usepackage{tabularx}
\usepackage{fancybox}
\usepackage{fancyhdr}
\usepackage{geometry}
\usepackage{float}
\usepackage[round]{natbib}
\usepackage{algorithmicx,tikz}
\usepackage{algcompatible}
\usepackage[compatible]{algpseudocode}
\floatstyle{boxed}
\renewcommand{\baselinestretch}{1.5}
\setlength{\evensidemargin}{3.5cm}
\setlength{\textwidth}{6in}
\setlength{\textheight}{8.9in}
\setlength{\topmargin}{-0.6in}
\setlength{\topmargin}{-0.2in}
\setlength{\headsep}{.4in}
\setlength{\footnotesep}{.2in}
\setlength{\parindent}{0.5cm}
%\nofiles
\citeindextrue
\pagestyle{empty}
\pagestyle{fancy}
\cfoot{}
\rfoot{\thepage}
\lhead{}
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\headrulewidth}{0pt}
%%%%Moi
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{4}
\setcounter{minitocdepth}{4}
\begin{document}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{%
\node[shape=circle,draw,inner sep=1pt] (char) {#1};}}
\algrenewcommand{\alglinenumber}[1]{\scriptsize\circled{#1}}% circled line numbers
\begin{algorithm}
\caption{My first algorithm}
\label{alg:algorithm1}
\begin{algorithmic}[1]
\Require
If there are multiple lines here, line's number will be wrong.
This error doesn't happen in package\{algorithmic\}
\Ensure
If I write $\setminus\setminus$ here, line's number will be wrong too.
\State State 1
\State State 2
\Statex State 3
\If{first condition}
\State x=2y+z
\EndIf
\end{algorithmic}
\end{algorithm}
\end{document}