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

learn more… | top users | synonyms

1
vote
1answer
71 views

break a line of function in algorithm2e

I tried various ways to break a line of function but did not succeed. As you can see from the image, I was trying to break the line at the position of a function parameter. Can anybody please take ...
5
votes
1answer
139 views

How to reduce indentation size within loop of an algorithm

For the following algorithm, I get four spaces for each text line inside the loop. How can I get only two or three spaces? Some of my text lines go to next line. I want to save some horizontal spaces. ...
1
vote
0answers
157 views

when is Implementation of example into LATEX2e? [closed]

When the write into texwork the following : \begin{algorithm}[H] \SetAlgoLined \KwData{this text} \KwResult{how to write algorithm with \LaTeX2e } initialization\; \While{not at end of this ...
1
vote
0answers
34 views

Huge algorithm taking up space [duplicate]

I have an algorithm description that takes up an entire image. However, when compiling my latex document, the algorithm and subsequent images following it are pushed to the end of the document. I ...
3
votes
1answer
1k views

algorithm2e comment style

I wanted to know how to change the comment style in the algorithm2e package. I want to make my comments of a smaller font and a different color: \documentclass{article} \usepackage{color} ...
2
votes
1answer
56 views

Increase Vertical Line Length in Algorithm Block

I would like to increase the line length of the vertical line between the start and the end of the block in the following example using the algorithm2e package: \documentclass{article} ...
6
votes
2answers
263 views

Add text right below the algorithms

I try to add some texts used to illustrate the algorithms right below the bottom line of algorithms. \documentclass{article} \usepackage[ruled]{algorithm2e} \usepackage{amssymb} \usepackage{amsmath} ...
6
votes
1answer
1k views

Algorithm: write if-then-return or else-return in one line?

I can easily generate the following algorithm statements using algorithm2e package. As can be seen from the image, return statement (should hold for other statements too) will be placed in a new line ...
3
votes
1answer
209 views

How to control the caption of algorithm2e by captionsetup?

I want to change the appearance of the caption for algorithms written by algorithm2e package using the caption package. In captionsetup one can easily customize the caption depending on the float ...
4
votes
1answer
395 views

Splitting an algorithm across two columns

Consider the following short example, where a two column page is selected, and the algorithm is split across the two columns using a manual \pagebreak within the algorithm's code: ...
5
votes
1answer
571 views

Algorithm2e - Disabling line numbers for specific lines

The Algorithm2e package has specific options for disabling/hiding line numbering for the whole document or algorithm, and then enabling/showing them for specific lines. I want to do the inverse. I ...
1
vote
0answers
18 views

Indentation lines in algorithm package [duplicate]

I am using the algpseudocode and the algorithm2e package, and want the lines down below the indents like below (the example on the algorithm here). Does anyone know how to achieve this easily?
4
votes
1answer
249 views

Remove the rule below the algorithm title - using Algorithm2e

I'm using algorithm2e package. One of my algorithm does NOT need a title. If I simply do not type in \caption, there are still three rules.! I want to remove the second rule. Is there any way to do ...
1
vote
0answers
83 views

How to manually set a line number for end statement in algorithm2e?

I can manually set line numbers in an algorithm2e environment using the \nlset command (together with \LinesNotNumbered). However, I can't figure out how to make the same for lines with the end or ...
4
votes
1answer
59 views

How to make a hbox several lines under the specified place?

Recently I asked How to colourfuly highlight some lines of an algorithm using algorithm2e? I wanted to acheive this effect using the algorithm2e package: Thanks to JLDiaz's answer I know how to do ...
4
votes
1answer
84 views

Weird behaviour of \FuncSty in algorithm2e

I'm using the small capital font \textsc{MyAlgorithm} several times inside my algorithm2e environment as follows: \documentclass[a4paper, english]{article} \usepackage{amsmath} \usepackage{amssymb} ...
2
votes
1answer
333 views

How can I colourfuly highlight some lines of an algorithm using algorithm2e?

I am trying to achieve something like this: This image is linked from this answer. This answer also provides a solution and seems simpler. Both answers deal with the algorithmicx package however. ...
1
vote
0answers
18 views

Reference links to algorithm but shows? [duplicate]

I am using algorithm2e when I reference an algorithm it shows ?? which links to the correct algorithm, but it should show something like 1.1. Any suggestions as to how I can fix this? Here is an ...
8
votes
1answer
233 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
132 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
362 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
284 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
578 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
657 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 ...
8
votes
1answer
1k 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
182 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
129 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
72 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 ...
8
votes
2answers
654 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
466 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
168 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
150 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
492 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
535 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
1k 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
856 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
961 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 ...
7
votes
2answers
8k 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
716 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
95 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
57 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
148 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 ...
3
votes
1answer
447 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
243 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
88 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
2k 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
151 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
96 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} ...