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

learn more… | top users | synonyms

2
votes
1answer
18 views

How to reinitialize the lines counter for algorithms?

I have four algorithms in a section but the problem is that the lines numbering doesn't start with 1 in each algorithm. For example, the first one is numbered from 1 to 11 but the second one start ...
1
vote
1answer
21 views

Reducing vertical space after algorithm2e

My document currently looks like this: As you can see, there is a very large vertical space between my text and the algorithm2e object. How can I reduce the spacing between these?
0
votes
0answers
22 views

No compilation errors but my pseudocode is not visible in the pdf file. I am using a two-column template

Are some packages incompatible with some templates? I am trying to write pseudocode using the algorithm/algorithm2e package. I am using a template downloaded from a latex templates website. ...
1
vote
1answer
29 views

if-elseif-else throwing errors

I am trying to create a if elseif else algorithm but not its throwing me errors. The errors say: !Argument of \algosec@Elseselfstrip has an extra }.<inserted text> but cant see that I have ...
1
vote
0answers
38 views

Latex algorithm else if

I am trying to add else if instead of else in the algorithm, but it is not working. I am using this package: \usepackage[ruled]{algorithm2e} Latex code: \begin{algorithm}[H] \While{true:}{ ...
1
vote
1answer
19 views

How to get a “tight” boxed algorithm with the algorithm2e package

I am using the algorithm2e package for my pseudo code since I like the like the options this package offers. However, the boxed option gives a text-width sized box and it doesn't look appealing to me ...
1
vote
1answer
46 views

Why second column in IEEE trans is not filling up? [closed]

I am trying to include my algorithm into one column of a two column format of IEEE trans. My code is: \documentclass[conference]{IEEEtran} \usepackage[algoruled,boxed,lined]{algorithm2e} ...
0
votes
1answer
67 views

How can I format this formula?

I am new to LaTeX. How to write this formula in a proper format as an algorithm? I cannot write this formula in proper format: if (some condition) P=P+(W$i$*((W-P)/W$i$)) end
0
votes
1answer
26 views

How to write in proper format of this code

I want to get the right hand side portion in a format. Here the format. Table[i, j] <-maximum { Table[i-1, j] AND Values[i] + Table[i-1, j – ...
0
votes
1answer
39 views

Compilation Error after running algorithm2e in document

This post is building of the solution posted here. When I try to put this code into my main code (or even \input the file, I get the error ! Argument of \reserved@a has an extra }. If I run the ...
2
votes
1answer
36 views

Switch numbering in Algorithm from \arabic to \arabic\alpha for specific lines

Switch numbering in Algorithm from \arabic to \arabic\alpha for specific lines In the code below, I wanted to change #3 to 3a and #4 to 3b. Then number 5 should be #4. Basically, I wanted to change ...
2
votes
1answer
47 views

Problem Splitting Very Long Algorithm on two or pages

In the example below, I have a very long algorithm, probably spanning 3 pages. I tried manually splitting the code up, but each time, a new algorithm number is generated. How do you maintain the ...
2
votes
1answer
91 views

Tikz node in algorithm2e preventing file from compiling

For some reason, I cannot find where I am going wrong. I put a tikz node in the algorithm2e environment and now the file cannot compile. I get the error Missing } inserted. I do not see where I am ...
2
votes
1answer
24 views

Cannot change fonts on Algorithms Table of Contents page

In the MWE below, I cannot change the font (and formatting) of the Table of Contents for the "List of Algorithms" page. As you will see, the font for the TOC is \sffamily, however, when I try the ...
0
votes
1answer
22 views

Apply background color in algorithm environment part 2

This question is building of the solution found here. I wanted to change the background color to blue or a user defined color \definecolor{mybluei}{RGB}{0,173,239}. However when I tried to implement ...
2
votes
2answers
47 views

Change Algorithm caption Label color to blue and bold italics

I wanted to know how to go about changing the algorithm caption label to blue and bold italics. I have so far been able to change the caption name to blue, but I have not been able to change the ...
1
vote
1answer
39 views

Apply background color in algorithm environment

I have not found a simple solution to have a background color in the algorithm environment. Can you help me put a background. Here is the code that I have so far: \documentclass{article} ...
1
vote
1answer
14 views

\For in Algorithm environment causing code to not compile

In the code below, when I use the \For statement, the code does not compile and gives the message: ! Missing \endcsname inserted. <to be read again> \ALG@currentbkock@0 Can ...
2
votes
2answers
19 views

How can I make the symbol \\ tiny in algorithm2e? [closed]

I would like to write a tiny comment in algorithm2e. I typed \tcp*[l]{ {\tiny Here is my comment.} } My problem is that the symbol // right before the comment is large. I tried to make it tiny but ...
1
vote
1answer
32 views

Cases inside an algorithm environment

I need to write an algorithm where multiple cases are handled. I have succeeded but the output shows a lot of vertical space below and above the cases statement. Anyone help me to fix this. I am using ...
3
votes
1answer
22 views

algorithm2e: How to define my own macros? +2

Just starting to play around with the algorithm2e package and I have difficulties to figure out the things I need. Here is my minimal working example: \documentclass[10pt,a4paper]{article} ...
2
votes
0answers
49 views

How to combine algorithm and algorithm2e in one document?

I got myself in big trouble and I can't get out of it. I use standalone package to combine different latex files into one. Each Latex file compiles OK on its own. When I combined them, I found a ...
0
votes
0answers
37 views

Formatting an algorithm with a nice presentation

I was reading this paper and I think is really nice the format how they present the algorithms, how can I do this? what packages are needed and the styles. Thanks in advance.
0
votes
0answers
25 views

How to write the algorithm with bold keywords and line numbers

I wish to write an algorithm like the following, with keywords bold and line numbers in each line. Could someone help on how to use latex to write this kind of algorithms?
2
votes
2answers
37 views

Help with algorithm2e formatting

recentely I've got into a bit more advanced LaTeX formatting, i.e algorithms. My package of choice is the algorithm2e package, but I'm having some difficulities operating it. So I've wanted to create ...
3
votes
1answer
60 views

In algorithm2e, how to force non-italic font in the condition block of While

I have this snippet: \documentclass[10pt]{article} \usepackage{amsmath} \usepackage[ruled,vlined,linesnumbered]{algorithm2e} \begin{document} \begin{algorithm} \While{$|\text{OPEN}| > 0$}{ ...
3
votes
2answers
38 views

parskip is shifting my algorithm

Problem: I am using parskip (only) to add customized space between paragraphs, but the package is shifting my algorithm content to the left. If there is another (clean) way to customize the space ...
1
vote
0answers
55 views

Problem with algorithm2e: \SetAlgoLined and \Indp not working properly together

Problem: I need to get something like this: But I'm getting this (note the vertical line): What I have: Here my code: \documentclass{report} ...
2
votes
0answers
69 views

How can I distinguish between error in code and bug in package? [closed]

I keep getting an error upon compilation, but cannot find an error, even with a tiny reproducible example (below). I am exporting from Emacs org-mode to LaTeX and then PDF, I am receiving the well ...
1
vote
0answers
55 views

Copied algorithm2e code renderes different

I'm writing a summary of my algorithms course and in order to insert new algorithms I use algorithm2e package. I am still learning the package features, so I tried to copy the code from latex ...
2
votes
1answer
41 views

Colored horizontal lines in algorithm2e

I'm trying to colorize the 3 horizontal lines appearing at the top and bottom of the algorithm below. I haven't been able to find similar issues in the internet. Could you please advise? ...
1
vote
1answer
33 views

How to insert a “continue” in while command of Algorithm2e

I read the documentation of the package algorithm2e to figure out how to insert continue command within a while loop, but I couldn't find any way to do it. Is there any work-around for this lack of ...
0
votes
0answers
23 views

Change the format of an algorithm from a table to any algorithm typesetting

I have been struggling to format the pseudocode of my algorithm from the current state (in a table) to the one provided by the algorithm package. After several tries with answers like: one, another, ...
3
votes
1answer
83 views

how to fit algorithm to line width in latex

the following algorithm exceeded the width of the column: \begin{algorithm}[!htb] \caption{........} \label{alg:BuildMG} %\algsetup{linenosize=\small} \scriptsize \DontPrintSemicolon ...
3
votes
1answer
27 views

SetKwInOut error

I'm having some problems with the algorithm2e package. Here's the code: \begin{algorithm} \caption{Tree merge algorithm\label{alg:merge}} ...
0
votes
0answers
19 views

Package order errors [duplicate]

I'm trying to use overpic, algorithm2e, empheq and tikz (mindmaps) packages together in a beamer presentation. Depending on the order I'm declaring my packages, it causes my environment to cause some ...
2
votes
1answer
41 views

Marking some lines of an algorithm with an asterisk, why it doesn't always work?

I'm working with IEEEtran and algorithm2e package. I have an algorithm with numbered lines. I am marking some lines with an asterisk before the line as follows: \documentclass[conference]{IEEEtran} ...
0
votes
1answer
21 views

How can I add a comments with the `algorithm2e` package?

I am using algorithm2e package to write an algorithm and I am trying to add line 3 and 4 in the code in the screen shot as comment with \tcc{} but without seccuss. How can I add a comments with the ...
0
votes
1answer
37 views

Algorithms: change the style of individual line numbers

I would like to change the style of individual lines in an algorithm. For example, I'd like surround key line numbers with a box, color them, or otherwise distinguish them. It is possible to change ...
1
vote
0answers
42 views

Caption and pseudo code in algorithm2e appears as boxes (not rendered)

I want to create a multi-language document using polyglossia in which Khmer is set to be a main language and English as another language. I also have khmer-gloss.ldf available so that Khmer font is a ...
1
vote
1answer
85 views

Is there a LaTeX to HTML tool that supports the algorithm2e package?

I'm a LaTeX beginner and I'm writing computer science documents. I carefully choose my algorithmic package considering the features I needed and that led me to pick algorithm2e (vlined and noend ...
1
vote
0answers
128 views

Genetic Algorithm pseudocode [closed]

Hi everyone, this is my first post, so apologise if not doing it properly. I need the following GA pseudocode (Photo) in LaTex, but couldn't do it very well. I really appreciate your help.
1
vote
2answers
21 views

Reference to a part of an algorithm

I would like to write about the analysis of an algorithm. Depending on some conditions multiple cases arise. I would like to reference the cases but not solely based on the line numbers. Essentially I ...
1
vote
1answer
41 views

How can I use an algorithm2e function macro inside an algorithm2e caption?

Algorithm2e lets you define functions using \SetKwFunction{Fn}{Function} which you can then reference anywhere in the document (not just in an algorithm environment) using e.g. \Fn (which will output ...
0
votes
0answers
51 views

Hanging caption with boxed algorithm2e

Along very similar lines to the question posed at Algorithm2e and hanging captions, I'm having problems producing captions for algorithm2e that have the same appearance as a figure caption (i.e. hangs ...
6
votes
1answer
96 views

shrink algorithm

I am writing a 2-column paper. I have 2 algorithms each within \begin{multicols} ... \end{multicols} environment. I want to scale each of them to half the size so that I can fit it side-by-side. How ...
0
votes
0answers
32 views

Is it possible to keep connecting loop lines in algorithm2e and to implement a page break?

I have to formulate many and long algorithms. My problem is that my algorithms are very long and need to break over pages. In order not to lose structure it would be very good to have those vertical ...
0
votes
0answers
22 views

How to change space below algorithm2e float

How can we change the spacing below the algorithm environment? Is there a possibility with the caption package? \documentclass[ 12pt, a4paper, twoside, titlepage, openright, ...
3
votes
1answer
82 views

Is it possible to change the box rule thickness of algorithm2e

Is it possible to customize the boxing rule width and color of an algorithm2e float? \documentclass{article} \usepackage{algorithm2e} \begin{document} % \RestyleAlgo{boxed} \RestyleAlgo{boxruled} ...
0
votes
1answer
68 views

indent somelines with the usepackage algorithm2e

I want to indent all lines after this line function(w,v with the usepackage algorithm2e. How can I get that to work? text \documentclass{article} \usepackage{german,t1enc} %pseudocode. ...