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

learn more… | top users | synonyms

2
votes
1answer
28 views

Table of contents of algorithm and algorithm2e together

The contents of the algorithms thinks that an algorithm that uses algorithm is one algorithm and an algorithm that uses algorithm2e is another algorithm, not the second of what was imported with the ...
2
votes
2answers
38 views

Multiline statements and conditions in algorithm environment

I have an algorithm that I want to write in mathematical pseudo-code. However, some conditions and statements are very long, e.g. "if (a series of relations and constraints hold) do" or "X gets (a ...
2
votes
1answer
28 views

Remove vertical space after new chapters in listofalgorithms

When generating list of algorithms, the command \listofalgorithms automatically inserts a 10pt vspace after the last algorithm caption in a chapter. I need to remove this vertical space in such a way ...
0
votes
1answer
17 views

Error in Until section

I'm newbie for tex. I am writing an algorithm in tex, I need some help in troubleshooting the error. \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage{algpseudocode} ...
4
votes
1answer
62 views

End word is hidden in algorithm block

Suppose that i have this code: \usepackage[ruled,vlined]{algorithm2e} \begin{dcocument} \begin{algorithm}[H] \KwData{this text} \KwResult{how to write algorithm with \LaTeX2e } initialization\; ...
2
votes
1answer
57 views

How to change the caption of Algorithm

{\tiny \restylealgo{boxed} \begin{algorithm} %\centering{ \SetLine \KwIn{$A$. } \caption{} %} \label{algo2} \end{algorithm} } In the caption it is coming as "Algorithm 2:" Is it possible just ...
0
votes
0answers
36 views

Reference title does not show properly

My latex file works fine until I inserted an algorithm to the document. Then the tile of the bibliography did not show up properly. \documentclass[ijoc,nonblindrev]{informs3} ...
6
votes
1answer
133 views

{Begin End} does not show when writing algorithm in LaTeX

I am writing an algorithm in LaTeX using \usepackage[ruled,vlined]{algorithm2e} When running the code, the produced file does not show the word "end" that should appear automatically when using ...
12
votes
1answer
326 views

algorithm, algorithmic, algorithmicx, algorithm2e, algpseudocode = confused

I am getting confused about the package structure for writing simple "algorithms". There are too many options, and also got totally clueless about when to use what. Is there any definitive guidelines ...
5
votes
1answer
88 views

Making algorithm2e environments “overlay aware” in beamer

What is the right away to make algorithms overlay aware in beamer? When using algorithm2e in a beamer presentation, an algorithm on a frame with overlays can get more than one number. For example, ...
4
votes
1answer
83 views

How to typeset data structures with algorithm2e?

The question How to typeset data structures? gives create answers for how to type set simple data structures with the lstlistings package. In particular, I like the following look (taken from Mico's ...
0
votes
0answers
43 views

How to fix undefined control sequence in algorithm2e?

% !TEX program = xelatex \documentclass{article} \usepackage[ruled,vlined,algosection]{algorithm2e} \begin{document} \begin{algorithm}[htbp!] \SetKwProg{add}{add}{(a,b)}{} ...
1
vote
1answer
25 views

How to customize the caption as a figure number in the algorithm2e package

I want to show the algorithm as a figure and cite that figure using the figure number anywhere in the page. Below is the code: \documentclass[a4paper,11pt]{report} ...
2
votes
1answer
55 views

Display the algorithm number based on the chapters

I have to number the algorithms based on the chapters that they appear. I have used the command \listofalgorithmes. But still I have the issues. Please refer to the attached codes and figures ...
2
votes
1answer
64 views

Algorithm2e package edit the line numbers

I need to remove the line numbers only below Step 1 and continue it after Step 2 and skip numbering infront of cc in Step 2. Please refer to the attached figure and the latex code. How I can do ...
2
votes
2answers
57 views

Insert a lstlisting inside an algorithm2e

I would like to be able to present a C++ code snippet. I would like for this snippet to be captioned, referenced, and included in the Table of Algorithms generated by the algorithm2e package. This is ...
2
votes
1answer
88 views

How to scale algorithm to fit in one frame and centered in the frame at same time?

Originally, the algorithm is too long to fit in the frame. If I use the \scalebox{0.8}{}, it can fit in the frame but doesn't look like to be centered in the frame. Here is the code and output. First ...
1
vote
1answer
60 views

How to align the image and algorithm in the frame?

The following is the code and its output. The output doesn't look well. If they are both aligned horizontally by their left and then centered in the frame, it will looks better. But how? (The image is ...
0
votes
1answer
71 views

How to display the algorithm2e at the center of the frame in the beamer?

I want to display my algorithm in the center of the frame like the sentence hello world in the code. Here is my code and the output: \documentclass{beamer} \usepackage{algorithm2e} \begin{document} ...
3
votes
1answer
78 views

Why does the \LinesNumbered command not work of the algorithm2e package in beamer frame?

I want to add line number from the fourth line, but the \LinesNumbered command doesn't work at all. \documentclass{beamer} \usepackage{algorithm2e} \begin{document} \begin{frame} ...
2
votes
1answer
43 views

Problems with algorithm2e and \If

I have tried to solve this problem following this tutorial, but with no success. I was using \If and \EndIf and now I have switched to \eIf but with no success. I'm using \; at the end of each line to ...
4
votes
1answer
69 views

Missing end statement in algorithm2e environment

I used \SetKwProg{myproc}{Procedure}{}{} for starting my pseudo-code with Procedure keyword. But its end statement (the last end in pseudo-code) is not appear in the result pdf. So how can i bring it? ...
3
votes
1answer
57 views

Procedure name with small caps in algorithm2e

I know that procedure in algorithm2e only allows captions like \caption{ProcedureName()}. However, I'd like my procedure to appear in small caps: \documentclass[12pt,a4paper]{article} ...
0
votes
0answers
17 views

Replacing 'Algorithm' keyword in caption of algorithm2e environment [duplicate]

I want the following to appear: ------------------------------------ Policy 1: APolicy ------------------------------------ while not-an-end-of-doc do read-line; print-line to stdout; end ...
4
votes
1answer
91 views

How to change algorithm caption to figure caption ouside of the box?

I'm using IEEEtran with \usepackage[boxed,linesnumbered]{algorithm2e}. I have one pseudocode/algorithm. My caption inside the algorithm environment appears as "Algorithm 1". Since I only have one ...
0
votes
1answer
563 views

error: breqn.sty and algorithm2e.sty not found

I've installed MikTex 2.9 for Windows 7, 64 bit. While trying to compile my Tex, I receive the following errors: LaTeX Error: File breqn.sty' not found. LaTeX Error: Filealgorithm2e.sty' not found. ...
2
votes
1answer
99 views

Defining a new keyword in algorithm2e

I'm trying to define a new keyword for my algorithm: \documentclass{article} \usepackage[]{algorithm2e} \begin{document} \SetKw{kwInit}{Init:} \begin{algorithm} \kwInit{$\alpha_n=1$ for all $n$} ...
1
vote
1answer
121 views

Pseudo code algorithm not showing in a frame

I am using this code to show a pseudocode: \usepackage{algorithm2e} ... \begin{algorithm}[H] \SetAlgoLined \KwResult{Write here the result } initialization\; \While{While condition}{ ...
4
votes
1answer
1k views

do-while loop in algorithm2e

I am using \usepackage[norelsize, linesnumbered, ruled, lined, boxed, commentsnumbered]{algorithm2e} \RestyleAlgo{boxruled} It seems that algorithm2e has the default repeat-until construct. But I ...
5
votes
2answers
159 views

How to switch off “figure” in algorithm2e only in certain cases?

Suppose the following situation. Algorithm2e should have the global option "figure", i.e. an algorithm is included in Figures. However we need to switch off this property only in certain cases (to ...
1
vote
0answers
134 views

Publication style for Algorithms

I want to make own paragraphs for algorithms by numbering them appropriately. I do not need any fancy things - white background, no borders and black font are ok. I am trying to write in Springer ...
2
votes
1answer
53 views

Change style of specific algorithm with algorithm2e

I have the following LaTeX code \documentclass{article} \usepackage[ruled]{algorithm2e} \begin{document} \begin{algorithm} do something\; \caption{Algorithm #1} ...
4
votes
1answer
92 views

Numbering Procedure and Algorithm Independently in algorithm2e

I want to use algorithm2e to generate two procedure and two algorithm. The procedure and algorithm may be interleaved with one another, and both procedure and algorithm have their independent counter ...
5
votes
1answer
224 views

How to add Function body to Latex algorithm pseudocode

Does anyone know How to add Function body to Latex algorithm pseudocode? Thanks in andvance! Here is my code: \usepackage[vlined, ruled, boxed]{algorithm2e} \begin{algorithm} \KwData{model ...
2
votes
1answer
180 views

Procedure numbering in algorithm2e

When I use the package algorithm2e, I find the algorithms can be easily numbered, but the procedure cannot. How can I number the Procedures in algorithm2e, like Procedure 1, Procedure 2, ... %% ...
2
votes
1answer
85 views

algorithm2e labelformat and size of list of algorithms

I use algorithm2e to put algorithms in my documents, and I use \listofalgorithms to have a list of my algorithms in the table of contents but I noticed that their title size are a bit different: "List ...
4
votes
1answer
118 views

Multicols not breaking procedures in algorithm2e

I'm having a problem with the package multicol. I'm trying to split an algorithm into two columns. In particular, this algorithm is made up by two procedures. Unfortunately, in this particular case, ...
4
votes
2answers
120 views

Conditions in algorithms are underlined

I'm using algorithm2e for typesetting pseudocode. Generally I find it easy to use, however, I cannot seem to find the setting that underlines the conditions in my while and for loops and ...
2
votes
1answer
309 views

Side-by-side algorithms in two columns paper

I am trying to put two algorithms side-by-side on a page so it is easy to compare their differences. I am using the acm template, algorithm2e package and minipage environment. but I get this error: ...
2
votes
0answers
104 views

subcaption package changing algorithm2e caption position

I have a project which makes use of the subcaption and algorithm2e packages. For whatever reason, the subcaption package is causing the captions in the algorithms to be misplaced. Here we have a MWE ...
3
votes
1answer
242 views

How to have the algorithmicx comment symbol in algorithm2e?

I want to know how can I have the nice ▷ $\triangleright$ comment symbol of algorithmicx in algorithm2e?
2
votes
1answer
56 views

How to resolve the error: “Missing { inserted.” inside an algorithm2e

When I use ShareLatex or MikTex to compile the following LaTeX code: \begin{algorithm} \uIf{$|F_d(D'(C_{\hat{i}})) - F_d(D(C_{\hat{i}}))| > \sigma$ OR numSeqNoise > $\mu$}{ ...
3
votes
2answers
86 views

Make listofalgorithms (algorithm2e) inside a section instead of chapter

I'm writing my thesis and I have a few algorithms (using algorithm2e) that I want to list in my appendix, but I don't want to start a new page. Also my listoffigures currently creates a section, not a ...
3
votes
1answer
709 views

\caption outside float. Algorithms

I'm sorry if this is repeated but I'm not able to find my answer. I am using the following code. But I receive the error: ! LaTeX Error: \caption outside float. \usepackage[algo2e]{algorithm2e} ...
2
votes
1answer
79 views

Exclude functions and procedures completely from list of algorithms in algorithm2e

I'm referring to this answer of the question on 'how to exclude functions from \listofalgorithms in algorithm2e'. The solution provided in the answer just omits the word function within the list of ...
2
votes
1answer
211 views

Available width inside algorithm2e

I wanted to use an environment inside an algorithm2e and it turned out, that it is too wide. I tried to draw some boxes to see the width, and it turned out that \textwidth is too large inside the ...
2
votes
2answers
188 views

Missing $ inserted. <inserted text> on a math algorithm

I've made the following pseudocode: \documentclass[]{article} \usepackage[]{algorithm2e} \begin{document} \title{Title} \author{Author} \date{Today} \maketitle \begin{algorithm}[H] pseudoalgoritmo ...
5
votes
3answers
219 views

Aligning in- and out-text for algorithms

I use the algorithm2e package to typeset algorithms with custom keywords for input and output. When using \SetKwInput{KwInput}{Input} to define the keywords, colons are added but input and output are ...
2
votes
1answer
254 views

Algorithm2e comment line alignment problem

I would like to align a comment within the algorithm environment of algorithm2e in such a way that each line of a multi line comment is left aligned. See the following MWE. In this MWE the second and ...
3
votes
2answers
205 views

break an long line in an algorithm

I have a long line in an algorithm and want to break it into two lines. For similar case in equations, split can be used. How do I do this within an algorithm? \documentclass{article} ...