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

learn more… | top users | synonyms

3
votes
1answer
28 views

Algorithms disappear when I use multicols

This is my code: \documentclass[11pt]{llncs} \usepackage[utf8]{inputenc} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{dsfont} \usepackage{multicol} \usepackage{fixltx2e} ...
3
votes
1answer
60 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 ...
3
votes
1answer
391 views

Algorithm2e - Disabling line numbers for specific lines

The Algorithm2e package has specific options for disabling/hiding line numbering for the whole document or algorithm, and then enabling/showing them for specific lines. I want to do the inverse. I ...
3
votes
2answers
414 views

Two algorithm2e environments side by side

I want to get two algorithm2e environments side by side aligned at the top. I tried it with two minipages, but it does not work. How do I get them side by side in the normal text (not in a floating ...
3
votes
1answer
375 views

How to remove the extra blank line in algorithm2e

I want to add a right aligned comment in LaTeX after \For command, but it adds an undesired blank line. Please help me. CODE: \For(\tcp*[r]{Incremental calculation of edges}){$i \gets 1$ ...
3
votes
2answers
671 views

algorithm2e with boxruled gives overfull hbox

I am using the algorithm2e package with the boxruled option to format my pseudo-code. However, I am getting an overfull hbox, which I suspect is due to margin/box conflicts. Does anyone have a fix ...
3
votes
1answer
249 views

verbatim environment inside algorithm2e

I need to output Prolog style inside algorithm2e and It seems that I cannot use \verb inside algorithm2e. How can I use \verb or verbatim for only one line inside algorithm2e in Latex?
3
votes
1answer
373 views

How to remove newline character after case statement in algorithm2e?

I don't want any newline character after case statement. How can I do that? This is my code: \begin{algorithm}[t] \SetInd{0.5em}{0.5em} \KwIn{Data $\mathsf{D}$} \KwOut{List of Simple Hints} ...
3
votes
1answer
799 views

cleveref, hyperref and algorithm2e package produce wrong hyperlink (though correct page reference)

I'm using the packages as stated above in their latest version (also oberdiek-package is up-to-date). The following code produces the wrong pdf-link to a float environment (refers to the same page as ...
3
votes
1answer
32 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} ...
3
votes
1answer
139 views

List of Algorithms: space between number and algorithm caption too small

I'm facing a problem with KOMA-Script and algorithm2e: algorithm captions in the list of algorithms collide with the numbers preceding them. See the image for an impression. How would I go about ...
3
votes
1answer
92 views

Indentation missing for algorithm package in documentclass{minimal}

I am trying to get write an algorithm in LaTeX for minimal document class. Unfortunately, the indentation is completely missing. Following is my sample code: \documentclass{minimal} ...
3
votes
1answer
174 views

Custom algorithm environment enumerated with algorithm2e and appearing in table of contents

I would like to have two environments sharing a counter and appearing in the same list. One of these environments is algorithm2e and the other is a simple frame for holding algorithms I want to ...
3
votes
1answer
267 views

Implementing indent in algorithm environment

I am using the algorithm environment in the algorithm2e package. What I want is to able to indent various portions. I tried \indent but that is doing me no good. Here is the MWE: ...
3
votes
1answer
3k 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} ...
3
votes
1answer
1k views

hyphen in function name using algorithm2e package

I'm trying to put a hyphen into a function name using the algorithm2e package, though it doesn't seem to like it. Minimal example: \begin{algorithm} \SetKwFunction{NOHYPHEN}{NOHYPHEN} ...
3
votes
1answer
25 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
2answers
51 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} ...
3
votes
1answer
326 views

How to combine the listings and algorithm2e packages to be used with List of Listings

I want to make a "List of Algorithms and Listings" that contains both listings made with \begin{lstlisting}... (listings package) and algorithms \begin{algorithm}... (algorithm2e package). I also ...
3
votes
0answers
83 views

Object-oriented class typesetting? [closed]

I am looking for a way to beautifully typeset an OO class like : classname { properties: prop1 : integer prop2 : Node methods: someMethod() } With the look ...
3
votes
0answers
415 views

algorithm2e-like vertical lines for loops in listings package [closed]

Is there any way to set vertical lines for loops in pseudo-algorithms written with listings package, in an algorithm2e style? As an example, see here: http://csweb.ucc.ie/~dongen/LAF/Algorithms.pdf ...
2
votes
2answers
62 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 ...
2
votes
1answer
54 views

Remove “end” in algorithm2e

When I write \If{condition} { \textbf{return true}\; } The output is like below However, I don't want end line. If possible, I want like this: if condition then return true; Is ...
2
votes
1answer
2k views

algorithm2e, function, procedure, \par, error

This is fine: \documentclass{article} \usepackage[boxed]{algorithm2e} \begin{document} \begin{algorithm} $x \gets x$\; \caption{Identity} \end{algorithm} \end{document} But this, which ...
2
votes
1answer
189 views

Reduce the size of horizontal line

I want to reduce the size of horizontal line. \begin{frame} \restylealgo{boxed} \begin{algorithm}[H] \Setline \nl i\; \end{algorithm} \end{frame}
2
votes
1answer
39 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
32 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 ...
2
votes
1answer
75 views

Parameter section similar to Input and Output

I would like to create a "Parameter: ..." section, similar to the "Input: ..." and "Output: ..." sections in my algorithm description. The parameters are global, user-defined constants, known before ...
2
votes
1answer
52 views

Increase Vertical Line Length in Algorithm Block

I would like to increase the line length of the vertical line between the start and the end of the block in the following example using the algorithm2e package: \documentclass{article} ...
2
votes
1answer
260 views

How can I colourfuly highlight some lines of an algorithm using algorithm2e?

I am trying to achieve something like this: This image is linked from this answer. This answer also provides a solution and seems simpler. Both answers deal with the algorithmicx package however. ...
2
votes
1answer
953 views

Line of dots in the \listofalgorithms

I've been working with the ToC, LoF, LoT and more recently with the LoA (List of Algorithms) of my dissertation. I'm using the tocloft package so I can set their styles the way I want. My first ...
2
votes
1answer
807 views

Export algorithm as pdf

I use algorithm2e package for my algorithms and want to export my algorithm as pdf and could not find a way to do it. Is there any way to do this? The reason is that I use a style file provided to me ...
2
votes
2answers
1k views

Is it possible to change the way a list of algorithms is generated to include the word “Algorithm” before each element in the list?

I've tried using both algorithm2e and algorithmic to generate a list of algorithms, but they both do it this way: List of Algorithms 1 BFS ..... 1 2 DFS ..... 2 ... When I'd like to it to be: ...
2
votes
1answer
33 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
34 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 ...
2
votes
1answer
35 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 ...
2
votes
1answer
124 views

PDF reference links when using hyperref and (`ruled`) algorithm2e

I was testing some links within my produced PDF file and recognized that all of the links to an algorithm (from the algorithm2e package) will jump to the beginning of the algorithm with skipping half ...
2
votes
1answer
70 views

Equivalent to hypcap for [ruled]{algorithm2e}?

I just discovered the hypcap packages which improves the \ref link to point before the figures and tables instead of to captions. How can I do the same with my algorithms written with algorithm2e ...
2
votes
1answer
444 views

Trouble submitting paper to arXiv - amsart issues?

I just attempted to submit a paper to the arXiv. Unfortunately, they would not accept a .pdf and insisted on the LaTeX source code. I uploaded the LaTeX source code along with three figures in .pdf ...
2
votes
1answer
134 views

Problem with references in classic thesis if algorithm2e package is used

If I use the algorithm2e package together with the linesnumbered option and the classicthesis package, references to a sub sub section are wrong. If I don't use the linesnumbered option, references ...
2
votes
1answer
572 views

Algorithm with chapter number

I want the algorithm to be prefix with chapter say in chapter 1, it should be 1.1, 1.2, for chapter 2, it should be 2.1, 2.2 But for my case, i only have 1,2,3,... across all chapters, how should I ...
2
votes
1answer
854 views

Undefined control sequence \SetKwProg [closed]

The minimal (not) working example is \documentclass{article} \usepackage[algo2e,ruled,vlined]{algorithm2e} \begin{document} \begin{algorithm2e}[h] \SetKwProg{myproc}{Procedure}{}{} ...
2
votes
1answer
434 views

Colors in Pseudocode matlab style

How do I get colours and more control over spacing in the algorithmic package like this: I tried this which looks good, but has numbers: \begin{enumerate} \item Create the cumulative sum of ...
2
votes
1answer
760 views

Restyling the caption in an algorithm created with algorithm2e

In the caption of an algorithm created with algorithm2e, \documentclass{article} \usepackage[ruled]{algorithm2e} \begin{document} \begin{algorithm}[H] \caption{Caption.} pseudocode ...
2
votes
1answer
682 views

Disable line numbering of specific lines

Is there way how to turn off numbering of lines for specific line in algorithm2e? I need bold : after keyword. So I tried redefine these macros: \renewcommand{\KwIn}[1]{\textbf{Input:} #1} ...
2
votes
1answer
1k views

How to break lines in conditions using algorithm2e?

I am trying to (partially) reproduce the algorithm displayed in Figure 4 from NetFlow: Information Loss or Win? My problem is with the multi-line conditions present in the "IFs". I want them to be ...
2
votes
1answer
142 views

How to change the order of algorithm number and name in algorithm2e?

I have to write an algorithm in Hungarian, where the caption must look like: 1.3. Algoritmus: caption of alg instead of the usual style Algorithm 1.3: caption of alg. Until now I had no ...
2
votes
1answer
763 views

Putting multiple algorithm2e procedures in figure

I want to put some algorithm2e procedures into a figure like: \begin{figure} \begin{procedure} some code \; \caption{abc (n).} \end{procedure} \begin{procedure} some code \; \caption{abc (n).} ...
2
votes
1answer
779 views

algorithm2e and enumerate

I would like to put one algorithm inside one enumerated list like in the following code. \documentclass[10pt,a4paper]{article} \usepackage[utf8x]{inputenc} \usepackage{ucs} \usepackage{amsmath} ...
2
votes
1answer
160 views

How to put a reference into nlset command of algorithm2e package

I would like to provide an alternative version of only some part of already existing algorithm, using the algorithm2e package. My source looks like: \begin{algorithm}[t] \dots \; ...