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

learn more… | top users | synonyms

28
votes
2answers
707 views

What is Algorithm2e's problem with the letter Q?

No, seriously. The following LaTeX document is typeset with no issues: \documentclass{article} \usepackage{algorithm2e} \begin{document} \begin{minipage}{\textwidth} \begin{algorithm}[H] ...
15
votes
1answer
2k views

Background coloring with overlay specification in algorithm2e + beamer package

I want to highlight some portion of my pseudo codes in my slides during the course of presentation. It's easy in powerpoint and I've made a sample slide: However, I couldn't manage to get a similar ...
13
votes
1answer
2k views

Is it possible to have connecting loop lines (like algorithm2e) in algorithmic?

I am using the algorithmic package to typeset an algorithm. I would like to have connecting lines between the beginning and end of a loop or conditional like in the algorithm2e package. Is there an ...
11
votes
2answers
2k views

How can I put a curly brace inside an algorithm to group code lines?

I am using the algorithmic package (or even algorithm2e is fine). Is it possible to use curly braces to group some lines in the algorithm so as to be able to put an explanation to the right?
11
votes
1answer
993 views

cleveref and algorithm2e

I'm currently working on a document where I was using algorithm+algorithmic along with cleveref. With this everything worked perfectly. Now I had to replace algorithm+algorithmic with algorithm2e. ...
10
votes
1answer
407 views

algorithm2e with ruled but with customized rule thickness

I would like to present an algorithm in my work and I used the package algorithm2e. I wonder if there is a way to control hrule thickness with ruled option, so one can use thicker line pre-caption or ...
10
votes
1answer
1k views

titlesec, hyperref, algorithm2e, and \appendix

When I use titlesec, hyperref, and algorithm2e together, sections after an \appendix are not numbered properly. \documentclass{article} \usepackage{titlesec} \usepackage{hyperref} ...
9
votes
2answers
101 views

Incorrect reference to the equation number in algorithm2e

I want equation number in an algorithm with chapter number included. Here is my code. \documentclass{book} \usepackage{amsmath,amssymb,amsthm, latexsym,float,epsfig,subfig} ...
9
votes
3answers
456 views

algorithm2e + cleveref: problem with wrong reference to line numbers

For some reason I do not understand, cleverefproduces wrong references to line numbers of listings produces with the algorithm2e package. I hope that I did not miss a simple solution ... My example ...
8
votes
1answer
495 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
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] ...
8
votes
2answers
545 views

algorithm2e noend option produces wrong label

I have a problem with the algorithm2e package. I want to reference the end of a block, e.g., a for-loop, in my text. Therefore, I place a label behind the closing bracket of the for statement. When I ...
8
votes
2answers
3k views

Linebreak in Package algorithm2e

I'm using the algorithm2e package for pseudocode. I got some very long lines that needed to be wrapped. Is there a way to indent the following (breaked) lines and/or put a mark at the first line to ...
8
votes
1answer
3k views

List of Algorithms Using algorithm2e

According to the documentation, I can add an entry in the ToC for the list of algorithms created using the algorithm2e package by including dotocloa as a package option. When I do this I receive an ...
8
votes
1answer
4k views

What is the best looking pseudo code package?

I have stumbled across various pseudo code packages but can't seem to find that's simple and eye-candy and practical. What I'm looking for: Visually attractive structure (eye-candy) ( easy to look ...
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 ...
7
votes
1answer
3k views

Renaming Algorithm to Heuristic in algorithm2e package

I am trying to write some heuristics for a problem using the algorithm2e package. However as you may know, when you write : \begin{algorithm} \caption{Heuristic 1: Name of Heuristic} ... ...
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 ...
7
votes
2answers
901 views

Amsart with algorithm2e introduces extraneous text into pdf file with Texlive 2011

I just removed the default Ubuntu TexLive 2009 installation and installed TexLive 2011 using install-tl. However, now I am facing problems with the amsart and algorithm2e packages. Specifically, when ...
7
votes
2answers
3k views

Place four algorithms (algorithm2e) in a subfigure and arrange them in two rows and two columns

I want to arrange four algorithms set with the algorithm2e package in two rows and two columns, as shown in the figure below. I've tried the subfigure package and have also read several related ...
7
votes
1answer
711 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 ...
7
votes
1answer
1k views

How to split algorithm2e over two pages

I'm using algorithm2e package but my algorithm does not fit in only one page. Is there any way to split it over two pages, even if manually? If doing it manually, we can use two algorithm ...
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
2answers
812 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 ...
6
votes
1answer
106 views

Algorithm2e and hanging captions

I'm having issues trying to make the captions in Algorithn2e hang, as in the table caption pictured below. I plan on using them together with arsclassica/classicthesis, but it seems neither of these ...
6
votes
1answer
566 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 ...
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? ...
6
votes
2answers
709 views

Problem with algorithm2e and portuguese option

I have this little algorithm with two For statements and one if-else. I'm using the option portuguese on the preamble and here's the problem: instead of displaying the words "faça" and "fim" (do and ...
6
votes
2answers
3k views

multiple algorithm2e algorithms in two column documents

I tried this example Place four algorithms (algorithm2e) in a subfigure and arrange them in two rows and two columns on two column documents. It doesn't work. The error message is ! LaTeX Error: [H] ...
6
votes
2answers
163 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
4k views

How to adjust line numbers of algorithm2e package?

When using line numbers in the algorithm2e package, the line numbers are placed left of the text block, not directly below the text. See page 5 of the algorithm2e manual. Is it possible to place them ...
5
votes
2answers
2k views

“\Ualgocf@original@chapter” undefined when using algorithm2e with natbib

Is it possible to just use plainnat without using the package natbib? When I do so, multiple author references don't work too well. I get [author et al (year)auhtor1, author2 and author3] when ...
5
votes
2answers
656 views

Algorithm2e - Unwanted semi-colon

With the following code, I have an unwanted semi-colon at the end of the loop condition. Here is MWE. \documentclass{article} \usepackage[lined]{algorithm2e} \begin{document} ...
5
votes
1answer
2k views

Latex : algorithm not display under correct section

I'm using the algorithm2e package to put algorithm in my Latex documents. In my document, I have something like this : \section My algorithms \subsection Algo 1 code for first algorithm ... ...
5
votes
2answers
3k views

How to typeset gotos and labels using LaTeX pseudocode environments?

Is there any way to typeset gotos and labels using LaTeX pseudocode environments (algorithmic, pseudocode, clrscode, algorithm2e, etc.)? Automatic and correct indentation of labels would also be ...
5
votes
2answers
44 views

Use algorithm2e inside tcolorbox

I use the algorithm2e package to typeset algorithms. Now I would like to put a tcolorbox around an algorithm. My first approach looked like this: \begin{tcolorbox} \begin{algorithm} $a ...
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
2answers
2k views

Mutliple inputs with line breaking

I am trying to write an algorithm with multiple inputs in algorithm2e. The result I would like to have is something like Algorithm ------------------- Input: Input number 1 Input number 2 ...
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 ...
5
votes
1answer
102 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. ...
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 ...
5
votes
1answer
802 views

algorithm2e and \algomargin with negative value

How can I use a negative length in \algomargin using algorithm2e? I get the unpleasant effect that the vertical lines and the caption are not moved accordingly, see for example: Note that this ...
5
votes
1answer
763 views

Create separator lines for algorithm captions in algorithm2e

How I can generate separator lines for captions as follows in algorithm2e? Algorithm 1: Generate Separator Line
5
votes
1answer
1k views

How to customize the number in the caption of an algorithm in algorithm2e

In algorithm2e, if you use the "ruled" option, the caption of algorithms are automatically numbered. E.g. if you write 2 algorithms in one document, the first one will be titled Algorithm 1 and the ...
5
votes
0answers
55 views

Review of algorithm-related packages? [duplicate]

Possible Duplicate: Print programs with its proper syntax Where can I find (if it exists) an updated review of the most relevant packages for handling with algorithms (pseudocode or code ...
4
votes
2answers
1k views

ending statements in algorithm2e environment

I am using the package algorithm2e. Is there a way to end with period instead of semicolon, or end with simply newline? I don't like the semicolons on the sentences. If I just try putting a period it ...
4
votes
2answers
2k views

Changing label name for algorithm

I have this algorithm: \begin{algorithm} \captionsetup[algorithm]{name=MegaAlgorithm} \DontPrintSemicolon \KwData{$G=(X,U)$ such that $G^{tc}$ is an order.} \KwResult{$G’=(X,V)$ with $V\subseteq U$ ...
4
votes
1answer
2k views

Frame for pieces of algorithms

I would like to put frames around pieces of algorithms like in the following picture. If the background of the rectangle can be changed, it would be nice. Here is the LaTeX code used for the ...
4
votes
2answers
2k views

LaTeX: UTF8 and algorithm2e clash

I have this input file in utf8 encoding: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{algorithm2e} \begin{document} \begin{procedure} foo \caption{ö()} \end{procedure} ...
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} ...