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

learn more… | top users | synonyms

5
votes
2answers
228 views

Algorithm with beamer package causing nightmares

I have an algorithm which works well with \documentclass[twocolumn]{svjour3}. Now I have to present the paper and I would like one slide to be that algorithm, so I do: \documentclass{beamer} \...
1
vote
1answer
16 views

How to show substeps in an algorithm environment

I would like to automatically show substeps such as 1.1. However, I can only do this manually. \begin{algorithm} \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} Precomputation of ...
-2
votes
0answers
40 views

I want to write a Pseudo code in latex please help me [closed]

% n is the total number of snake control points Index arithmetic for the snake control points is modulo n Initialize the parameters alpha, beta and gamma do % Main loop that moves the snake points to ...
4
votes
2answers
41 views

How to fit an algorithm into a template?

My aim is to fit this long single-line algorithm into a double column page lay out, just as it is shown in the below, in 3 different lines, but I cannot use \State and I do not know why and how can I ...
1
vote
1answer
19 views

Indentation comments algorithm2e

I am trying to use algorithm2e for my pseudocode. I am having a weird behavior with the comments. I want them to appear right after the code, on the right, while there seems to be a random (quite ...
6
votes
1answer
49 views

algorithm2e and xeCJK cause TeX capacity exceeded on texlive2016

My document cannot be compiled after I updated texlive on my Mac to version 2016. It works fine on texlive 2013. Here is an example: \documentclass[12pt]{report} \usepackage[vlined,linesnumbered,...
2
votes
1answer
25 views

Not A Member sign in math mode in algorithm2e

For the below algorithm, i get the erorr ! Extra }, or forgotten $. \egroup l.759 } I think having another prantes in the if condition is also another problem, that I do not know how to cope with. ...
2
votes
1answer
29 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
30 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
28 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. http://www....
1
vote
1answer
31 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
62 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
27 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
50 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} \usepackage{...
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 – ...
2
votes
1answer
40 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
49 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
101 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
30 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
27 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
60 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
57 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} \usepackage{...
1
vote
1answer
19 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
24 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
35 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
24 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
77 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
45 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
29 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
51 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
70 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
40 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
72 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} \usepackage[linesnumbered,ruled,vlined,spanish,...
2
votes
0answers
71 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
69 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 wikibook....
2
votes
1answer
47 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
43 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
24 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
107 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 \SetKwInOut{...
3
votes
1answer
33 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}} \SetKwData{H}{H}\SetKwData{M}{M}\SetKwData{C}{C}\...
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
48 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
25 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
48 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
44 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
106 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
163 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
23 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
50 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
59 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 ...