Questions tagged [algorithm2e]

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

Filter by
Sorted by
Tagged with
7
votes
2answers
283 views

What is the difference between float specifier [h] and no specifier []?

Not sure why but in my long document \begin{algorithm}[h] leads to the algorithm and all subsequent algorithms to being placed at the very end but \begin{algorithm}[] leads to the algorithm being ...
0
votes
0answers
23 views

algorithm2e procedure / function error: “end” block of procedure using \SetKwProg overflows to next column in 2-column page

While using algorithm2e package to write an algorithm having 2 procedures in a 2 column page, only the "end block (last line) of the procedure always flows to 2nd column. I have used this in the ...
0
votes
1answer
16 views

algorithm2e align environment takes too much vertical space

I want to use equations in an algorithm. For this I use algorithm2e and the align* environment. The result looks nicely, but sadly, the align* takes too much vertical space and thus the whole ...
0
votes
0answers
34 views

How to write title of chapter and algorithm in correct way?

I am writing PhD Thesis on overleaf but the title of the chapter being vanished whenever I insert the package \usepackage[ruled]{algorithm2e} for the algorithm and the algorithm appears in good ...
1
vote
0answers
37 views

How can I write the algorithm with cost and count using beamer?

I want to make a beamer slide to show the running time calculation of algorithms, as shown in the figure. I use algorithm2e.
2
votes
1answer
46 views

algorithm2e showing errors in IEEE Access format (“Argument of \@algocf@endoption has an extra }. } ”and “Paragraph ended before \@algocf@endoption”)

\documentclass{ieeeaccess} \IEEEoverridecommandlockouts \usepackage{cite} \usepackage{amsmath,amssymb,amsfonts} \usepackage{algorithm} \usepackage[ruled]{algorithm2e} \begin{document} \history{...
0
votes
0answers
9 views

How to include multiple label in algorithm2e and adjust numbering in a specific way?

Suppose I have the following LaTeX source: \documentclass[letterpaper,12pt]{article} \pagestyle{myheadings} %---------------------------------------------------------- % algorithm2e setup \usepackage{...
1
vote
1answer
20 views

Defining Polymorphic objects in algorithm2e

I'm currently writing my masters thesis and I'm using algorithm2e to write pseudocode. I regularly use SetKwData to display data types. However I would slighty like to change how this is displayed ...
0
votes
0answers
13 views

Multi-statement line

I want multiple statements to appear on the same line. In other words, for certain statements, I do not want a newline after the semicolon. \begin{algorithm}[H] $a \leftarrow 1$\; $b \leftarrow 1$\; \...
2
votes
1answer
39 views

Formatting a Pseudocode using Algorithm2e

I'm trying to format a pseudocode using the Algorithm2e package. The desired output has the following format: Here's the code I've tried to format this pseudocode: \usepackage[ruled,vlined]{...
1
vote
0answers
40 views

Left margin is unexpectedly reduced

\documentclass{beamer} \usepackage[ noend, boxruled]{algorithm2e} \begin{document} \begin{center} \begin{algorithm}[H] \SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output} ...
0
votes
0answers
30 views

Unwanted behaviour of \Procedure inside algorithmic

This is a sample of how a basic procedure block looks like which I took from here This is my MWE with all packages in my complete document. \begin{filecontents*}{example.eps} %!PS-Adobe-3.0 EPSF-3.0 %...
1
vote
1answer
26 views

Long algorithm exceeds one page using algorithm2e package in IEEE Access Class. How to fit this long algorithm?

\documentclass{ieeeaccess} %\usepackage{siunitx} \usepackage{graphicx %\usepackage{algorithmic} \usepackage[lined,boxed,ruled,commentsnumbered]{algorithm2e} \begin{document} \begin{algorithm} \tiny \...
1
vote
1answer
40 views

About algorithm package

I'm making an algorithm figure using \usepackage[ruled, lined, linesnumbered, commentsnumbered, longend]{algorithm2e} and \usepackage{algpseudocode}. \documentclass{article} \usepackage[ruled, lined, ...
0
votes
0answers
25 views

Algorithm2e counter

What is the algorithm counter for algorithm2e package?? For example, when I write \setcounter{algorithm}{0} it shows me the following error: No counter 'algorithm' defined. \setcounter{algorithm}{0} ...
2
votes
1answer
51 views

resize algorithm [closed]

I'm using the algorithmic package and was wondering if there is a way to resize/rescale the algorithm. Currently, for some reason, the algorithm exceeds the right margin of a letter size paper and I ...
2
votes
2answers
58 views

How to make the pseudo code more compact?

I wrote the following piece of pseudo code. It shows the result as shown in the figure below. I think there is too much white space above the horizontal line in the picture. I want to make them more ...
0
votes
0answers
48 views

Setting a breakablealgorithm environment for algorithm2e

9 years ago, someone called Werner proposed a brilliant solution (see the link) in order to make algorithms splittable between several pages, by means of the following environment: \makeatletter \...
0
votes
1answer
39 views

\linesnumbered in package algorithm2e: how to change font size of numbers indicating the lines?

I'm using algorithm2e package \linesnumbered in Overleaf, but font size of numbers indicating the lines in the algorithm is smaller than I expected. Is there any way to change the font size?
2
votes
1answer
36 views

Align algorithm lines on the equals/assignment symbol

I wish to align lines on my algorithm on a certain symbol. For instance: long_variable_name = k | long_variable_name = k variable = l | variable = l In terms of LaTeX I have the ...
0
votes
1answer
25 views

Reference Not Working for Algorithm (MWE included)

I am getting an error which I am not able to fix: referencing error of using an algorithm. I have tried putting label both in and below the caption but I keep getting '??' error when I refr to the ...
0
votes
0answers
62 views

Algorithms with Latex [duplicate]

I am a beginner in LaTeX language and I need to describe these algorithms with Latex. [![les algorithmes ][8]][8] [![les algorithmes ][9]][9]
1
vote
0answers
39 views

LaTex beamer: algorithm line number outside the box

I'm trying to put an algorithm in a beamer document (using the algorithm2e package). But the line numbers are being printed outside the box. Rest of the text is also printed somewhat left-shifted. The ...
0
votes
1answer
40 views

Using the same algorithm twice with no new caption number

I'm trying to do something similar to "Using the same figure twice with no new number", but with the algorithm2e package. Therefore I wrote the following code. \newcommand{\repeatAlgoCaption}...
0
votes
0answers
24 views

Caption of an algorithm in a justified mode

I have an algorithm written using the algorithm2e package and I would like to have the caption of the algorithm in a justified mode without using the captions package, since it controls captions of ...
0
votes
0answers
27 views

Problems with typing algorithm

The output file is not in a format I desired. Here are the problems: Algorithm output does not automatically continue to a new page when it has reached bottom margin. After one paragraph, algorithm ...
0
votes
1answer
29 views

How do I modify algorithmic \while command to type another word [duplicate]

How can I type another word for the statement \while in the pseudo-code? Normally, it writes, While *some termination condition* do and I want to change it to: DONGU: *some termination condition* ...
0
votes
0answers
24 views

How to center a long caption for an Algorithm

I am trying to center a caption above an algorithm in LaTeX. Here's what it looks like right now: with this corresponding code: \begin{algorithm}[!h] \caption{Pseudo code to get the predictions of ...
1
vote
2answers
58 views

line spacing in the list of algorithms(2e) disappears with newfloat option of minted

I noticed some really weird interaction between algorithms2e and the option newfloat of the minted package. \documentclass{book} \usepackage{algorithm2e} \usepackage[newfloat]{minted} \begin{...
1
vote
1answer
42 views

flalign in algorithm

This question is a bit related to the answer provided here: How can I use an align environment flush left? I use algorithm2e and mathtools to write an algorithm with an equation inside. I want it to ...
2
votes
1answer
205 views

Algorithm2e with ieeeaccess

I am using overleaf. When using the algorithm2e package, it gives me bold line numbers prefixed with a "-" symbol for each line. I want to have a line number in small fonts without the "...
1
vote
1answer
85 views

Hide horizontal line at the end of an algorithm2e algorithm

I am using the algorithm2e package to include a few algorithms in my document. A few of the algorithms are presented side-by-side, and I am not satisfied with how this looks with the bottom horizontal ...
1
vote
0answers
9 views

Capitalise cleveref reference of algorithm2e [duplicate]

I'd like to reference an algorithm from algorithm2e using hyperref and cleveref. The goal is that "Algorithm" is capitalised in the reference. Neither using the capitalise option nor ...
2
votes
1answer
53 views

Adding algorithm in manuscript LaTeX file

I am trying to write the algorithm in LaTeX File but it not able to indent properly. In below url of an image Here the While Loop is not getting an indented, same way for if-else. Any help will be ...
2
votes
1answer
74 views

algorithm2e with booktabs style and listing the algorithms in toc

I'm using the solution that @egreg provided on this answer, but I'm using the algorithm2e package instead of algorithms. I'd like to retain the design from booktabs but the command \listofalgorithms ...
0
votes
1answer
29 views

How to use \lIf and \lFor in one line for algorithm2e?

I'm using algorithm2e and am familiar with \lIf and \lFor to have no extra lines. But when I use both of them together, an extra blank line gets inserted. Is there a way to avoid that line? MWE ...
0
votes
1answer
30 views

The \caption command in an algorithm block gives this error: Missing number, treated as zero

I'm trying to write a caption to my algorithm in LaTeX, but something seems to not work. When I compile my code, I get some weird symbols in my caption, and a Missing number, treated as zero error. (...
2
votes
1answer
30 views

Avoiding indent in the new line when writing a long sentence in an algorithm

When writing a long sentence inside my algorithm, I am getting an indent in the new line. Is there a way to aviod this indent without creating a new number in this line? I am using the package ...
1
vote
1answer
48 views

Coloring the lines of an algorithm

I'm writing a report for a class project and I need to highlight several lines within some of the algorithms in the report. I managed to do so, but I don't like the solution I got. Here is a picture (...
2
votes
0answers
62 views

Compile error IEEE access template using algorithm2e package [duplicate]

I have been trying for a while to load the algorithm2e package to the IEEE ACCESS template. Whenever I use the following code, I am getting the error \usepackage{amsmath,amssymb,amsfonts} % \...
3
votes
2answers
89 views

\setparsizes and List of Algorithms

For some reason, in my work I have to reset the spacing of paragraphs with \setparsizes. This works quite well in the main part of the skript. But unfortunatley, it also effects the list of algorithms....
0
votes
0answers
160 views

I get the error “ You can't use `\prevdepth` in horizontal mode” while using `algorithm2e` package

I use a separate .tex file for every section in my document. One of these documents require an algorithm to be written. I use algorithm2e package to do so. Here is my MWE (algorithm is taken from this ...
0
votes
1answer
40 views

Change function prefix name in caption with algorithm2e

\SetAlgorithmName changes the prefix that comes in caption with \begin{algorithm}...\caption{lol...}\end{algorithm} from \usepackage{algorithm2e}. But how to change that prefix/name for functions? ...
2
votes
1answer
66 views

Algorithms in Elsevier's ifacconf.cls environment

The ifaccong.cls is located here https://www.ifac-control.org/events/resolveuid/b0e4734736878819db179d76290a8f78. How do I do algorithms in the ifacconf document class? Using algorithm2e package ...
1
vote
1answer
31 views

Why is my algorithm environment (algorithm2e) centered?

I have some Latex (below) which renders the algorithm environment with centered text: This doesn't match the wikibooks Latex documentation, which shows a left-aligned block. I'd rather not post all ...
0
votes
0answers
23 views

Write long algorithms in IEEE with 2 columns and separate their content in both columns

I was wondering if anyone would know how to fix the problem that given a very long algorithm and a text that has to be defined in two columns, how could I make that when the end of the column is ...
1
vote
1answer
53 views

The format of if-else in the function is wrong

When using latex to write pseudo-code, using loops in the function, the vertical line position is wrong. \usepackage[ruled,lined]{algorithm2e} \usepackage{algorithmicx} \usepackage{algpseudocode} \...
1
vote
1answer
84 views

Align leftarrows in Algorithm2e Package

I am trying to get multiple lines aligned inside an algorithm. So far, my code and outcome looks like this: \usepackage[german,onelanguage,linesnumbered,ruled]{algorithm2e} \documentclass[pdftex,...
0
votes
1answer
32 views

tufte-latex: Full-width algorithm2e blocks without minipage

I'm using an algorithm2e block in the tufte-latex book and I would like to try to make it full width. I know that the question has been asked here: tufte-latex: Full-width algorithm2e blocks but using ...
0
votes
1answer
38 views

Algorithm pseudocode is not executable in IEEE Transection Template. Snapshot of error is attached

\documentclass[journal]{IEEEtran} \usepackage[lined,boxed,ruled,commentsnumbered]{algorithm2e} \usepackage{algpseudocode} \begin{document} \begin{algorithm}%[H] \caption{%\textcolor{blue} {Pseudocode ...

1
2 3 4 5
13