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

learn more… | top users | synonyms

4
votes
1answer
33 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? ...
0
votes
1answer
59 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. ...
9
votes
2answers
5k 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 ...
3
votes
1answer
25 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} ...
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 ...
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 ...
5
votes
2answers
4k 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$ ...
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
2answers
4k views

Align comments in algorithm with package algorithm2e

I am using the package algorithm2e. When using comments like this \documentclass[11pt,a4paper,twoside,openright]{book} \usepackage[algochapter,linesnumbered,ruled,lined,boxed]{algorithm2e} ...
4
votes
1answer
47 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
0answers
54 views

Springer style for Algorithms in publication

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
36 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
49 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
87 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
137 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 ...
4
votes
1answer
49 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 ...
2
votes
1answer
31 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} ...
8
votes
2answers
5k 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 ...
4
votes
1answer
91 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 ...
13
votes
1answer
3k 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 ...
2
votes
1answer
57 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
36 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
83 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, ...
2
votes
1answer
60 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
139 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
63 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 ...
2
votes
1answer
208 views

\begin{algorithm} unrecognized

I have used these two packages for creating algorithm \usepackage{algorithm2e} \usepackage{algorithmicx} But \begin{algorithm} shows as unrecognized command. Even \For, \While are shown as ...
3
votes
1answer
98 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
44 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
1answer
56 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
325 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
61 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
98 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 ...
5
votes
1answer
3k 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 ... ...
2
votes
2answers
102 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
154 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
105 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
96 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} ...
4
votes
2answers
163 views

Removing italic formatting from if statement

I would like the if statement to have "current stage" in serif and "satisfies" as normal text. The following code produces both with italics: \documentclass{article} \usepackage{algorithm2e} ...
1
vote
0answers
48 views

make latex to automatically choose the placement of algorithms

I have several algorithms written down in a single file and would like latex to spread them across the document to save spaces. For example an algorithm can be just 3 or 4 lines and another can be 20 ...
4
votes
1answer
195 views

Adding a blank line in algorithm2e

Is there any way to add a blank line in algorithm2e? I have the following document: \documentclass{article} \usepackage[linesnumbered]{algorithm2e}% http://ctan.org/pkg/algorithm2e \begin{document} ...
3
votes
1answer
130 views

Formatting keywords, data in algorithm2e

I am just wondering if there is a way to reference the keyword data outside the algorithm in algorithm2e package. For example, given the example in algorithm2e, if I want to reference \KwData{this ...
5
votes
2answers
102 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 ...
2
votes
1answer
61 views

Algorithm2e caption separator with language package options

Please see the difference in the style of the caption separator. In the first example the : is typed directly after the word Algorithm 1. In the second MWE with language option german (also french or ...
3
votes
3answers
172 views

Help me compile this code

\documentclass{article} \usepackage{amsmath} \usepackage{algorithm2e} \begin{document} \begin{algorithm} \caption{CAS}\label{CAS} {$\sum^{N_{C}}_{i=1}$$L_C$} $\gets$ position of ...
1
vote
0answers
85 views

algorithm2e with RevTex

Note: I have seen the previous answer to this problem here and it doesn't work for my purposes. I suspect that others are in the same boat. I'm writing a paper for which the publisher requires the ...
4
votes
1answer
116 views

Adjusting the caption of an algorithm2e code

I'd like to typeset the caption of an algorithm environment such that it is bold, fills the available width of the paper, and neither the caption nor the line numbers encroach into the margins. In ...
2
votes
2answers
105 views

Align the word input of algorithm2e with a tabularx table

I'm referring to this post. I like the idea from 'a different ben' of the tabularx table inside the \Input command. But I would like to have the word Input: at the top, on the same line as the first ...
3
votes
2answers
65 views

= in algorithm when using hebrew and algorithm2e

For some reason an = sign appears at the beginning of every line in an algorithm block when using hebrew and algorithm2e. Removing hebrew removes the line. For example: \documentclass{article} ...
1
vote
1answer
98 views

Problem with caption, hyperref and algorithm2e

I'm trying to mix the caption, hyperref, and algorithm2e packages, but I am having some issues. Here is a MWE. \documentclass[12pt]{book} \usepackage{float} ...