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

learn more… | top users | synonyms

0
votes
0answers
19 views

Broken algorithm reference number [duplicate]

My code is as follows: \documentclass[12pt,letterpaper]{book} \usepackage{graphicx} \usepackage[ruled,vlined]{algorithm2e} \usepackage{subfig} \begin{document} \pagestyle{plain} ...
3
votes
1answer
118 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
80 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
127 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 ...
2
votes
1answer
1k 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
832 views

Turn off line numbering in algorithm2e

I have the following preamble for algorithm2e: \usepackage[ruled,vlined,linesnumbered,resetcount,algochapter]{algorithm2e} I have many algorithms, in on of the algorithm as follows: ...
2
votes
1answer
252 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 ...
0
votes
0answers
411 views

Centering of an Algorithm

My square box is unnecessary large. Also I want centering the algorithm to look it nice. How is it possible? My documentclass is elsarticle. \restylealgo{boxed} \begin{algorithm} \label{algo1} ...
1
vote
1answer
97 views

algorithm2e single-line control structures

I am using algorithm2e for formatting pseudo-code: is it possible to compress single-instructions control structure to one single line? For example I would like to modify this so that l.sort() ...
4
votes
1answer
124 views

Algorithms in front of the text!

I am writing a document using the book class. At some point, I need to place an algorithm in the text. I am using the algorithm2e.sty package to write my algorithms. So, I write ...
2
votes
0answers
77 views

Sigplanconf algorithm2e missing algorithm when figure

I am rewriting a paper, and stumble over this problem where algorithms are missing in my appendix. I was able to reproduce the problem. The following code only display 2 out of the 4 algorithms on ...
1
vote
0answers
31 views

algorithm2e problem [duplicate]

Source code I'm working on a LaTeX project which brings 5 files: cassio.bib: bibliography comandos.tex: a rich set of commands for easiness of typing tg.tex: document's source code tg.pdf: ...
3
votes
1answer
115 views

Alternative for SetKwInParam in algorithm2e

In recent versions of algorithm2e SetKwInParam no longer exists: REMOVE: - SetKwInParam has been deleted since not useful itself because of different macros which can do the same in a better and a ...
2
votes
1answer
595 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}{}{} ...
4
votes
2answers
589 views

How to avoid the number line for comments under algorithm2e

In the declaration of the input and output data, I would like to add a comment in order to explain the kind of data. I use: \usepackage[ruled,vlined]{algorithm2e} My code is: \begin{algorithm}[!ht] ...
0
votes
0answers
111 views

Some algorithm2e questions (line wrap, indentation, lists)

I already had a question about algorithm2e here: algorithm2e indentation / line break I have continued using algorithm2e, but I have multiple problems now: First, I need a finer control over the ...
0
votes
0answers
264 views

algorithm2e indentation / line break

I have the following problem: I am writing a couple of algorithms using algorithm2e. I have a bunch of longer if statements and longer if conditions. The lines are broken, but the new lines are not ...
1
vote
1answer
89 views

How to define new loops in algorithmicx?

How can I define a new loop in algorithmicx? For example, code like this: ex1) PreLoop s do --statement1 --statement2 ex2) PostLoop s do --statement1 --statement2 Is it possible to define it ...
3
votes
2answers
449 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 ...
4
votes
2answers
320 views

How to avoid printing the algorithm number in algorithm captions?

I am using the algorithm2e package to write algorithms. However, when i write three algorithms one after another, the algorithms are automatically numbered 1,2 and 3 in the caption. I am using ...
1
vote
0answers
125 views

Text Wrap with algorithm2e [closed]

I'm using algorithm2e for algorithms and for some of the longer algorithms, (eyeballed at > 50% of a page) there is no other text on the page with just an embarrassing amount of white space above and ...
4
votes
2answers
250 views

How to use Nameref with Algorithm2e

As the title suggests, I'm trying to reference to an algorithm created by algorithm2e package. Here is a MWE: \documentclass[12pt,a4paper]{report} \usepackage[linesnumbered]{algorithm2e} ...
4
votes
2answers
396 views

using standalone with algorithmicx or algorithm2e

I am trying to compile a standalone file containing pseudocode created with the algorithmicx package. According to algorithmicx crashes standalone it should work with the preview option set for ...
6
votes
2answers
544 views

Problem with algorithm2e and portuguese option

I have this little algorithm with two For statements and one if-else. I'm using the option portuguese on the preamble and here's the problem: instead of displaying the words "faça" and "fim" (do and ...
2
votes
1answer
342 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
490 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 ...
8
votes
1answer
3k 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 ...
4
votes
1answer
146 views

Algorithm2e - Permanent fix for no italics if-clause

I am using algorithm2e to create pseudocode for my document. However, it has it so that the conditions in if clauses are italicised. This solution suggests putting an \upshape in each if condition. ...
3
votes
1answer
163 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: ...
4
votes
1answer
279 views

algorithm2e: Exclude functions from \listofalgorithms

I'm using the package algorithm2e and create a list of algorithms with \listofalgorithms. My problem is that not only the algorithms (algorithm), but also the functions (function) are displayed in the ...
2
votes
1answer
524 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} ...
4
votes
2answers
1k 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$ ...
5
votes
1answer
628 views

algorithm2e and \algomargin with negative value

How can I use a negative length in \algomargin using algorithm2e? I get the unpleasant effect that the vertical lines and the caption are not moved accordingly, see for example: Note that this ...
9
votes
3answers
395 views

algorithm2e + cleveref: problem with wrong reference to line numbers

For some reason I do not understand, cleverefproduces wrong references to line numbers of listings produces with the algorithm2e package. I hope that I did not miss a simple solution ... My example ...
2
votes
1answer
449 views

No italics in algorithm2e if-clause

Why does algorithm2e typeset the variables anychange and done in italics, and how can I turn this off? How can I remove the semicolon after done in the until-clause? $\textsf{anychange} \gets ...
3
votes
1answer
3k views

Subroutine in algorithm2e

I am looking for a tiny example of writing in algorithm2e an algorithm using a subroutine. The algorithm is called algo, and it recursively calls a subroutine called proc. It should be something like ...
2
votes
1answer
193 views

verbatim environment inside algorithm2e

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

algorithm2e and Beamer - How to make algorithms wider with smaller font?

I would like to make the algorithm2e environments wider in a beamer document. Indeed I must you a \scalebox to see all of my algorithm. Is there a way to have wider algorithms with smaller size font ...
2
votes
1answer
759 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 ...
3
votes
1answer
1k views

Algorithm2e modify line numbers

I'm using the LaTeX algorithm2e package by defining \usepackage[ruled, linesnumbered, vlined]{algorithm2e} The linesnumbered argument adds lines numbers from [1,...,n] if we have an algorithm with ...
8
votes
2answers
423 views

algorithm2e noend option produces wrong label

I have a problem with the algorithm2e package. I want to reference the end of a block, e.g., a for-loop, in my text. Therefore, I place a label behind the closing bracket of the for statement. When I ...
3
votes
1answer
315 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} ...
0
votes
0answers
40 views

writing part of a pseudocode [duplicate]

I have a few pseudocode lines like for each item in list L if (item > 50)| (item > 50)|(item > 50) value=item break; Obviously, this is not the exact code :). If I use a package ...
2
votes
1answer
119 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 ...
1
vote
1answer
238 views

List of Algorithms header format [closed]

Does anyone know why the header of List of Algorithms is not equal to the format of List of Tables when both using with \listoftables or \listofalgorithms Here is a screenshot:
6
votes
1answer
4k 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 ...
2
votes
1answer
152 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}
4
votes
1answer
273 views

'List of Algorithms' title is not all in caps

In my dissertation, I have added a page for list of algorithms, using \listofalgorithms command. However, the title of the page is not in all caps ('List Of Algorithms'), while it's supposed to be in ...
2
votes
1answer
1k views

Float positioning [ht] not working for algorithm

I am using the package algorithm2e. I have a document with several algorithms. I use the float position option [ht], but all my algorithms are positioned at the end of the chapter; none at the ...
1
vote
1answer
272 views

Can not use float placement options with algorithm2e

I am using algorihtm2e and I am formatting a new command to align comments in the algorithms like in the answer of Align comments in algorithm with package algorithm2e. Now when I try to use ...