Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex: Change the numbering style for algorithms [closed]

My problem is that I do not know how to change the numbering style for algorithms. I have created an algoritm and its number is "Algorithm 1", but I want to have "Algorithm N.1", where N is the number of current chapter.

Let assume I have something like below

\begin{algorithm}
    \begin{algorithmic}
        \FOR{$i = 1$ till end}
            \STATE do something
        \ENDFOR
     \end{algorithmic}
     \label{aForLoop}
     \caption{some caption}
 \end{algorithm}

Any help will appreciated.

like image 804
kokosing Avatar asked Dec 28 '22 05:12

kokosing


1 Answers

As in the documentation:

The numbering of algorithms can be influenced by providing the name of the document component within which numbering should be recommenced. The legal values for this option are: part, chapter, section, subsection, subsubsection or nothing. The default value is nothing which causes algorithms to be numbered sequentially throughout the document.

So, I think it will be enough determining the section value, like that:

\begin{algorithm}[section]
...

Didn't test, but should work.

like image 52
frarees Avatar answered Dec 31 '22 15:12

frarees