{algorithm2e} is a package providing a floating algorithm environment with algorithmic keywords.

learn more… | top users | synonyms

8
votes
1answer
159 views

algorithm2e: Applying color to an entire line, excluding the line number

Consider the following MWE: \documentclass{article} \usepackage{xcolor} \usepackage[boxed, noline, linesnumbered]{algorithm2e} \begin{document} \begin{algorithm}[t] ...
2
votes
1answer
116 views

PDF reference links when using hyperref and (`ruled`) algorithm2e

I was testing some links within my produced PDF file and recognized that all of the links to an algorithm (from the algorithm2e package) will jump to the beginning of the algorithm with skipping half ...
3
votes
1answer
237 views

Algorithm2e does not allow nested if

I was trying to put a nested if in algorithm area like this: \If{$isContentMethod(\mathcal{M})$}{ $URI \leftarrow getURI(SubCG, \mathcal{M})$\; \If($URI \in ...
3
votes
1answer
191 views

Infinite loop with Algorithm2e

I'm using Algorithm2e and want a loop with no intial condition and no ending condition. Using Algorithmic, this can be achieved with \Loop ... \EndLoop, but I cannot find a similar loop for ...
3
votes
2answers
371 views

Two algorithm2e environments side by side

I want to get two algorithm2e environments side by side aligned at the top. I tried it with two minipages, but it does not work. How do I get them side by side in the normal text (not in a floating ...
8
votes
1answer
493 views

Algorithm2e caption above code

I can't seem to figure out how to place a caption at the beginning of an algorithm2e pseudo code. I know it's possible with the ruled environment, but I don't want those lines at the top and the ...
7
votes
1answer
710 views

How to use the algorithm2e package with IEEEtran class?

The IEEEtran documentation suggests that I should not use the floating algorithm environment of algorithm2e.sty. B. Algorithms IEEE publications use the figure environment to contain ...
0
votes
0answers
158 views

Big algorithm causing big mess

I am writing a document in which I needed to include the description of the Number Field Sieve (NFS) algorithm as mentioned in the book by Crandall and Pomerance. The algorithm's pseudo code is ...
4
votes
1answer
107 views

Tocloft customizations not working for algorithm's list

I have been fighting with tocloft to get it to apply some customizations across all the listings, but it seems that they only work for the default ones like "tocs", "lofs" and "lots". For the ones ...
2
votes
1answer
68 views

Equivalent to hypcap for [ruled]{algorithm2e}?

I just discovered the hypcap packages which improves the \ref link to point before the figures and tables instead of to captions. How can I do the same with my algorithms written with algorithm2e ...
7
votes
2answers
424 views

How to write pseudo code in other languages (Spanish)?

I'm using this code in LaTeX \documentclass[12pt,a4paper]{report} \usepackage[spanish]{babel} \selectlanguage{spanish} \usepackage{algorithm2e} %for psuedo code ...
1
vote
0answers
23 views

How to use dotted line to make indentation clearer in algorithmicx? [duplicate]

I wish to indicate clearly when a block starts and ends with "enclosing lines" in addition to the indentation. I understand that I can do it with algorithm2e like so \begin{algorithm}[H] \SetLine % ...
4
votes
1answer
315 views

Caption below boxed algorithm2e when used as a figure?

My desired output is similar to the example given in this answer, in that I want the caption below the algorithm and outside the box, except I want the algorithm included as a figure (so I use ...
0
votes
1answer
134 views

Algorithm2e Comment Lines w/out semicolons [closed]

For some reason even when I enable \DontPrintSemicolon there are still semicolons on lines with comments. This is in Algorithm2e version 3.9. \documentclass[12pt]{article} ...
0
votes
0answers
123 views

Macros like \TitleOfAlgo not recognised in algorithm2e v5.0

I cannot get any macros working from the algorithm2e package. My particular example is to do with the title. In reference to numbering / not numbering algorithms, page 20 of the algorithm2e package ...
3
votes
2answers
268 views

How to align text within an algorithm environment?

I wish to duplicate an effect I've seen elsewhere (image below) in which text not necessarily at the beginning of a line is aligned with text elsewhere. I don't know which environment is suitable, ...
2
votes
1answer
395 views

Trouble submitting paper to arXiv - amsart issues?

I just attempted to submit a paper to the arXiv. Unfortunately, they would not accept a .pdf and insisted on the LaTeX source code. I uploaded the LaTeX source code along with three figures in .pdf ...
6
votes
2answers
811 views

How to see the Steps number in an algorithm

In below algorithm I have used the package \usepackage[linesnumbered,ruled,vlined]{algorithm2e} 1) How do I see steps number after step 2? 2) Is there any command apart from ...
5
votes
1answer
664 views

Caption spacing using algorithm2e

I am trying to add some spacing above/below captions of algorithms using the algorithm2e package. Consider the following example: \documentclass[a4paper]{article} \usepackage{blindtext} ...
5
votes
1answer
743 views

Change line spacing in algorithm2e

I'm using the algorithm2e package. In one algorithm with several math formulae in consecutive lines I would like to increase line spacing. I've already searched algorithm2e's documentation but could ...
6
votes
2answers
5k views

How do remove equation number in an algorithm

Here is the code. Even I have used the command \nonumber still I can see the equation number \begin{document} \begin{algorithm} \DontPrintSemicolon % Some LaTeX compilers require you to use ...
6
votes
1answer
423 views

Issue with algorithm2e “input” alignment

If you look at the image below you will see that on the 4th line of the input, the alignment resets for some reason and I'm not sure why. Could someone show me how to fix this? ...
4
votes
1answer
84 views

Line in algorithm2e environment wrapping late

I am having a small issue where where the line Let $s$ be the highest-ranked student in $h$'s preference list which $h$ has not yet requested to be a resident\\ in my algorithm is wrapping a ...
2
votes
0answers
50 views

Nomencl and Algorithm2e Incompatibility [closed]

This code produces no errors and displays the nomenclature correctly. \documentclass{article} \usepackage{nomencl} \makenomenclature \begin{document} \nomenclature{$c$}{a constant} \printnomenclature ...
2
votes
1answer
127 views

Problem with references in classic thesis if algorithm2e package is used

If I use the algorithm2e package together with the linesnumbered option and the classicthesis package, references to a sub sub section are wrong. If I don't use the linesnumbered option, references ...
2
votes
1answer
334 views

How to remove the extra blank line in algorithm2e

I want to add a right aligned comment in LaTeX after \For command, but it adds an undesired blank line. Please help me. CODE: \For(\tcp*[r]{Incremental calculation of edges}){$i \gets 1$ ...
5
votes
1answer
208 views

Wrong line spacing when changing font size for caption of algorithm

I am using the algorithm2e package and want to change the font size for captions of figures as well as for captions of algorithms. The problem is that I get different line spacings for the two ...
1
vote
1answer
79 views

How to exclude some algorithms for \listofalgorithms

I tried with \captionsetup{list=no} but it doesn't work for the algorithm listing. Any ideas? I am splitting alg. over several pages using algorithm2e and don't want the captions of the split ...
7
votes
2answers
1k views

algorithm2e Command \algorithm already defined

I want to draw vertical line by using \SetAlgoLined, but LaTeX told me Undefined control sequence. Then I add \usepackage{algorithm2e} to the end of my preamble. Then it said Command\algorithmalready ...
0
votes
0answers
19 views

Broken algorithm reference number [duplicate]

My code is as follows: \documentclass[12pt,letterpaper]{book} \usepackage{graphicx} \usepackage[ruled,vlined]{algorithm2e} \usepackage{subfig} \begin{document} \pagestyle{plain} ...
3
votes
1answer
135 views

List of Algorithms: space between number and algorithm caption too small

I'm facing a problem with KOMA-Script and algorithm2e: algorithm captions in the list of algorithms collide with the numbers preceding them. See the image for an impression. How would I go about ...
3
votes
1answer
90 views

Indentation missing for algorithm package in documentclass{minimal}

I am trying to get write an algorithm in LaTeX for minimal document class. Unfortunately, the indentation is completely missing. Following is my sample code: \documentclass{minimal} ...
3
votes
1answer
160 views

Custom algorithm environment enumerated with algorithm2e and appearing in table of contents

I would like to have two environments sharing a counter and appearing in the same list. One of these environments is algorithm2e and the other is a simple frame for holding algorithms I want to ...
2
votes
1answer
1k views

algorithm2e, function, procedure, \par, error

This is fine: \documentclass{article} \usepackage[boxed]{algorithm2e} \begin{document} \begin{algorithm} $x \gets x$\; \caption{Identity} \end{algorithm} \end{document} But this, which ...
2
votes
1answer
1k views

Turn off line numbering in algorithm2e

I have the following preamble for algorithm2e: \usepackage[ruled,vlined,linesnumbered,resetcount,algochapter]{algorithm2e} I have many algorithms, in on of the algorithm as follows: ...
2
votes
1answer
474 views

Algorithm with chapter number

I want the algorithm to be prefix with chapter say in chapter 1, it should be 1.1, 1.2, for chapter 2, it should be 2.1, 2.2 But for my case, i only have 1,2,3,... across all chapters, how should I ...
0
votes
0answers
564 views

Centering of an Algorithm

My square box is unnecessary large. Also I want centering the algorithm to look it nice. How is it possible? My documentclass is elsarticle. \restylealgo{boxed} \begin{algorithm} \label{algo1} ...
1
vote
1answer
119 views

algorithm2e single-line control structures

I am using algorithm2e for formatting pseudo-code: is it possible to compress single-instructions control structure to one single line? For example I would like to modify this so that l.sort() ...
4
votes
1answer
133 views

Algorithms in front of the text!

I am writing a document using the book class. At some point, I need to place an algorithm in the text. I am using the algorithm2e.sty package to write my algorithms. So, I write ...
2
votes
0answers
86 views

Sigplanconf algorithm2e missing algorithm when figure

I am rewriting a paper, and stumble over this problem where algorithms are missing in my appendix. I was able to reproduce the problem. The following code only display 2 out of the 4 algorithms on ...
1
vote
0answers
34 views

algorithm2e problem [duplicate]

Source code I'm working on a LaTeX project which brings 5 files: cassio.bib: bibliography comandos.tex: a rich set of commands for easiness of typing tg.tex: document's source code tg.pdf: ...
4
votes
1answer
152 views

Alternative for SetKwInParam in algorithm2e

In recent versions of algorithm2e SetKwInParam no longer exists: REMOVE: - SetKwInParam has been deleted since not useful itself because of different macros which can do the same in a better and a ...
2
votes
1answer
796 views

Undefined control sequence \SetKwProg [closed]

The minimal (not) working example is \documentclass{article} \usepackage[algo2e,ruled,vlined]{algorithm2e} \begin{document} \begin{algorithm2e}[h] \SetKwProg{myproc}{Procedure}{}{} ...
4
votes
2answers
885 views

How to avoid the number line for comments under algorithm2e

In the declaration of the input and output data, I would like to add a comment in order to explain the kind of data. I use: \usepackage[ruled,vlined]{algorithm2e} My code is: \begin{algorithm}[!ht] ...
0
votes
0answers
347 views

algorithm2e indentation / line break

I have the following problem: I am writing a couple of algorithms using algorithm2e. I have a bunch of longer if statements and longer if conditions. The lines are broken, but the new lines are not ...
1
vote
1answer
95 views

How to define new loops in algorithmicx?

How can I define a new loop in algorithmicx? For example, code like this: ex1) PreLoop s do --statement1 --statement2 ex2) PostLoop s do --statement1 --statement2 Is it possible to define it ...
3
votes
2answers
625 views

algorithm2e with boxruled gives overfull hbox

I am using the algorithm2e package with the boxruled option to format my pseudo-code. However, I am getting an overfull hbox, which I suspect is due to margin/box conflicts. Does anyone have a fix ...
4
votes
2answers
456 views

How to avoid printing the algorithm number in algorithm captions?

I am using the algorithm2e package to write algorithms. However, when i write three algorithms one after another, the algorithms are automatically numbered 1,2 and 3 in the caption. I am using ...
1
vote
0answers
140 views

Text Wrap with algorithm2e [closed]

I'm using algorithm2e for algorithms and for some of the longer algorithms, (eyeballed at > 50% of a page) there is no other text on the page with just an embarrassing amount of white space above and ...
4
votes
2answers
295 views

How to use Nameref with Algorithm2e

As the title suggests, I'm trying to reference to an algorithm created by algorithm2e package. Here is a MWE: \documentclass[12pt,a4paper]{report} \usepackage[linesnumbered]{algorithm2e} ...