Skip to main content

Questions tagged [algorithm2e]

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

Filter by
Sorted by
Tagged with
2 votes
1 answer
29 views

For and end for alignment in algorithmic

I have been writing my research and had to use a lot of algorithm inserts, and I haven't worked with it enough to solve this issue. My For and EndFor part don't seem to align no matter what. I tried ...
Ксения's user avatar
1 vote
1 answer
25 views

Text in math environment in algorithm2e has different typography when placed inside a for loop

The following MWE: % Created 2016-07-04 Mon 15:02 \documentclass[a4paper, 12pt]{article} \usepackage[T1]{fontenc} \usepackage{amsmath} \usepackage{amssymb} \usepackage{mathtools, nccmath} \usepackage[...
JKHA's user avatar
  • 527
4 votes
2 answers
64 views

Additional line created when using equations in algorithm2e

Consider the following example, placing equation*s inside of an algorithm environment: \documentclass{standalone} \usepackage{amsmath} \usepackage{algorithm2e} \LinesNumbered \begin{document} \...
hfhc2's user avatar
  • 894
1 vote
1 answer
31 views

How to fix numbering of an algorithm in algorithmc and algorithm environment?

I have some pseudocode for an algorithm, which appears okay (with some minor errors in compilation). But the biggest problem is that the numbering of the steps does not match the number of steps in ...
underdog987's user avatar
0 votes
1 answer
60 views

Reproducing Python/Programming Code Blocks with modification

I want to be able to reproduce this environment within the context of exam correction. One clue I found is the usage of the bclogo package. https://ctan.org/pkg/bclogo Howerver, I would like to ...
Mouadh Ben Salah's user avatar
0 votes
0 answers
31 views

problem with using algorithm2e after installing Texlive 2024

I installed texlive 2024 using this link on Ubuntu 2022.04 and added the latex folder to system paths I can compile the document when I do not use algorithm2e package. but unfortunately, when I want ...
Ali Ghazi's user avatar
0 votes
0 answers
25 views

Algorithm2e: Symbols look huge when written in \mathtt

I have some algorithms and I want to set variables in typewriter mode. Therefore I use \mathtt. But then I have the impression that symbols like >>Greater or equal<< look to huge. maybe ...
Lereu's user avatar
  • 471
1 vote
1 answer
25 views

algorithm2e does not set \texttt

I have algorithms that I wrote in algorithm2e. But I want the name of the function written in typewriter. As you see in the picture, this does not work, I get this strange font: Here is my MWE: \...
Lereu's user avatar
  • 471
0 votes
0 answers
32 views

convert pseudo code in algorithm2e style

If I want to write FOR each label, entities IN custom_entities: FOR each ent IN entities: span = create_span(doc, ent[1], ent[2], label) doc.ents = combine_entities(doc....
Encipher's user avatar
  • 548
3 votes
1 answer
60 views

ELSE if block after if statement on overleaf throws error

I want to implement a if else block like that if A if B if C else if D end if E end end end Where if C and if E has same indentation. if B under if A. if C and if E both are ...
Encipher's user avatar
  • 548
1 vote
0 answers
21 views

Algorithm2e does not respect text width when used with exam class [duplicate]

As you can see on the picture, the algorithm environment (from package algorithm2e) does not respect the text width when it is used inside exam questions. Actually, it exceeds the right margin: \...
Lava's user avatar
  • 11
1 vote
0 answers
41 views

Extra line with inline if and comment

I'm writing an algorithm with algorithm2e. I want to do an inline if with \lIf with a comment on the same line with \Comment*. \documentclass{article} \usepackage[vlined,boxed,linesnumbered]{...
JacopoStanchi's user avatar
4 votes
1 answer
145 views

How can I redefine the current label?

I'm having back reference issues when using an algorithm. Consider the following example \documentclass{article} \usepackage[algo2e,linesnumbered,algonl]{algorithm2e} \usepackage[backref=section]{...
walleye's user avatar
  • 113
2 votes
1 answer
46 views

How to align caption left in algorithm2e?

\documentclass{article} \usepackage{algorithm2e} \SetAlgoCaptionSeparator{.} \begin{document} \begin{algorithm} code\; \caption{I want to align this caption left} \end{...
Junee's user avatar
  • 31
0 votes
1 answer
69 views

How to make the multiple floating blocks not occupying the whole page while keeping the `\intextsep` rule?

I want the floating block used in algorithm2e at the page's top instead of the middle. Here is my sample code with this Tex SX link's help: \documentclass{article} \usepackage{lipsum,mathtools} \...
An5Drama's user avatar
  • 163
2 votes
1 answer
100 views

How to tune the multiline equation with the self-defined indentation?

I followed this QA link to left-align the equation and this to prefer using \hspace instead of \hskip: \documentclass[12pt,a4paper]{article} \usepackage{amsmath,mathtools} \usepackage[algosection, ...
An5Drama's user avatar
  • 163
2 votes
1 answer
75 views

How to set the KwProg arg font style with something like `\SetProgSty` in algorithm2e?

I followed some QA links like this in tex stackexchange and use this example tex code: \documentclass[12pt,a4paper]{article} \usepackage{amsmath} \usepackage[algosection, boxruled, linesnumbered]{...
An5Drama's user avatar
  • 163
0 votes
0 answers
20 views

ieee access algorithm2e line number problem [duplicate]

i have a problem with IEEE Access Templates for LATEX. When I write any algorithm, the line numbers start with -21. \documentclass{ieeeaccess} \usepackage{cite} \usepackage{amsmath,amssymb,amsfonts} \...
abrahamxyz's user avatar
1 vote
1 answer
72 views

indentation of long lines in algorithm2e and vertical spacing problem

After spending 2 hrs on this and trying all sorts of things, I give up. I am using algorithm2e and when I have long description lines, the new line gets shifted a little to the right. Also, even ...
Nasser's user avatar
  • 20.3k
1 vote
1 answer
103 views

Algorithm in box and settings

I'd like to restrict my algorithm in a box that it adapts at the lenght of the algorithm, as in this image Here the code \documentclass{article} \usepackage[italian]{babel} \usepackage[utf8]{inputenc}...
Puck's user avatar
  • 1,212
1 vote
2 answers
53 views

Algorithm2e, [italianokw] does not function. Why?

In my code below, the option [italianokw] of algorithm2e--package does not function. Why? (I am new in use of this package.) \documentclass{article} \usepackage[italian]{babel} \usepackage[utf8]{...
Puck's user avatar
  • 1,212
2 votes
1 answer
235 views

Package algorithm2e: Remove numbering from algorithm title

Consider the following minimal example: \documentclass[usenames,dvipsnames]{beamer} \usepackage[linesnumbered,boxed,ruled,vlined,resetcount]{algorithm2e} \begin{document} \begin{frame}[fragile] ...
Hilder Vitor Lima Pereira's user avatar
2 votes
1 answer
57 views

Overfull hbox in patched use of algorithm2e environment

I am using the algorithms environment from algorithm2e in a modified way with reduced width (following the solution here), see the MWE below. This generates an overfull box that I'd like to get rid of....
user279611's user avatar
1 vote
0 answers
54 views

Merge two algorithms style in the same file

Is it possible to put the two following algorithms in the same file. I tried several times but I did not succeed. Thanks for your help. \documentclass{article} \usepackage[T1]{fontenc} \usepackage{...
Nehme's user avatar
  • 63
0 votes
1 answer
88 views

Latex "algorithm2e" giving error while writing an algorithm in IEEEAccess template

I am trying to compile a tex file in overleaf, I am using IEEEAccess template to write the manuscript. When I compile the latex throws the error on the given algorithm script. I am showing the initial ...
Aavash Bhandari's user avatar
0 votes
1 answer
67 views

Problem with \SetAlgoLined in algorithm2e

I am very new to Latex. I have problem with \SetAlgoLined in algorithm2e. As seen from the picture, inside the while loop the line seem to be normal. I don't know why outside the while loop, the line ...
Chanun Asavasirikulkij's user avatar
0 votes
0 answers
57 views

Overfull \hbox problem in Algorithm caption of ACM template

I faced a problem that my overleaf report that 'Overfull \hbox (8.5pt too wide) in paragraph at lines 92--92' I used 'algorithm2e' package for ACM template. Here is the test demo I used: \...
yuyang sun's user avatar
0 votes
1 answer
68 views

Wrong anchor of algorithm2e with caption on top

I have the following MWE, where I use the package algorithm2e to print algorithms. However, I like the captions of the algorithms to be placed on the top (how to do this was already answered in this ...
KennyH's user avatar
  • 15
2 votes
2 answers
46 views

book and algorithm2e chapter name containing square brackets

Here a minimal example: \documentclass{book} \usepackage{algorithm2e} \begin{document} \chapter{Test [broken]} \chapter[]{Test [not broken]} \end{document} which produces for me: I am using ...
Arne's user avatar
  • 1,390
1 vote
0 answers
381 views

How to write pseudocode in LaTeX in Google Colab

I want to render in my colab some pseudocode, say: \documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm}[H] \caption{A simple algorithm} \begin{...
mCs's user avatar
  • 11
0 votes
1 answer
248 views

Multiple input line

Trying to obtain this Algorithm 1 : Name of algorithm Input: Input number 1 Input number 2 Input number 3 that extend the length desired so can it brought to ...
user529674's user avatar
1 vote
1 answer
40 views

Disable italics in algorithm2e program name

I want to disable globally the italics style in the program names. I have seen this post which is on a similar question, and which suggests to use \SetArgSty{upshape} to disable globally italics in if ...
JacopoStanchi's user avatar
5 votes
1 answer
204 views

How to make procedure name with underscore using `algorithm2e`?

Using answer given in Procedure name with small caps in algorithm2e shows how to make procedure name all small caps in algorithm2e. But I want to add _ between the names, as it is long name. Adding \_ ...
Nasser's user avatar
  • 20.3k
0 votes
1 answer
53 views

Unable to compile the sample code from the beginning of section 4 of the algorithm2e package manual

In trying to run a piece of code listed in the manual of the algorithm2e package, I got a compilation error. Could you please help me debug it? The manual is available on the package's CTAN page. The ...
Evan Aad's user avatar
  • 11.1k
1 vote
1 answer
74 views

Algorithm not showing in multicol

When I am in the multicol environment, my algorithms are not showing. The page is simply blank. Full TeX code available here: \documentclass[12pt,landscape]{article} \usepackage{multicol} \usepackage{...
Satya Vejus's user avatar
1 vote
1 answer
71 views

How to reference an algorithm created with algorithm2e using cleveref?

I am having issues figuring out how to reference an algorithm created with algorithm2e. For my figures, I use: \begin{figure} \includegraphics{...} \caption{Test Caption.} \label{fig:test_label} ...
Fabian's user avatar
  • 125
2 votes
2 answers
136 views

Different symbols around parameters of a function in algorithm2e

If I define a function as \SetKwFunction{Func}{func} in algorithm2e, \Func{a, b} prints func(a, b) by default. How can I make it print func[a, b] like in Wolfram or func a b like in Haskell? I ...
matj1's user avatar
  • 119
4 votes
1 answer
526 views

Margins in algorithm2e

I am more and more convinced that algorithm2e is badly designed, basically because it reinvents the wheel for quite a lot of things (e.g., captions). Alas, it's too late to switch. So here's my next ...
Bubaya's user avatar
  • 2,549
0 votes
1 answer
155 views

Background coloring in algorithm2e pseudocode in beamer

I tried to highlight parts of my pseudocode in algorithm2e with the following answer to a similar question: https://tex.stackexchange.com/a/51590/287916. I copied the code exactly the same and run it, ...
Michelle's user avatar
3 votes
2 answers
217 views

Different appearence of typewriter font in algorithm2e procedure

Let's say we have a procedure in which we want to iterate over an object whose data type we want to specify by writing it in texttt font. I tried \documentclass{article} \usepackage{algorithm2e} \...
Itoro Jóska's user avatar
1 vote
0 answers
147 views

Error converting Latex to HTML - package algorithm2e?

Update I've reduced the entire thesis down to an empty doc with the packages that I'm using. I've tried commenting out each of the packages one by one, and including them one by one, and the results ...
memo's user avatar
  • 111
3 votes
1 answer
353 views

Different color for algorithm2e keywords

My question goes in the same direction as this related one. I have already achieved some syntax highlighting in algorithm2e by redefining \KwSty, here is a MWE: \documentclass{article} % Math \...
rpanades's user avatar
  • 145
1 vote
0 answers
94 views

Algorithm2e does not properly indent inside algorithmic

I have the below MWE. The desired output is one tab indentation of lines. Do you see what is wrong? \documentclass{article} \usepackage[ruled,vlined]{algorithm2e} \usepackage{geometry,nccmath} \...
tcokyasar's user avatar
  • 233
2 votes
1 answer
40 views

Cannot call algorithm2e procedure relax()

I want to write a procedure called relax using the package algorithm2e. I tried \documentclass{article} \usepackage{algorithm2e} \begin{document} \begin{procedure} This procedure does something\; \...
Itoro Jóska's user avatar
3 votes
0 answers
56 views

Hide particular lines of algorithm2e code in beamer

I have a long algorithm that I present in my lecture and I want to distribute it over several frames to be able to slowly go through the details. I have the whole algorithm in an algorithm2e ...
Arne's user avatar
  • 1,390
0 votes
0 answers
95 views

Adding an algorithm in Latex changes the layout of my figures

I want to add an algorithm in my latex file. I add it by implementing the following: \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} ..... \begin{algorithm} \begin{...
henrirno's user avatar
2 votes
1 answer
149 views

Set the algorithm environment to normal spacing apart from other parts in the document

Throughout the document, I use \renewcommand{\baselinestretch}{1.5} for the entire document. Now I want to set only the algorithm environment in \usepackage{algorithm2e} to the normal spacing, what ...
Tab1e's user avatar
  • 153
1 vote
1 answer
105 views

Can anyone help writing the algorithm shown in the figure in LaTex?

I was trying to write the algorithm shown in 1 in LaTex. Below is the code that I tried. However, it returns no indentation as I needed. I appreciate the help. \documentclass[11pt]{article} \...
Jae H's user avatar
  • 81
0 votes
1 answer
165 views

Algorithmic: Numbering and Alignment

In algorithmic, how can we make "Input" to come aligned on the first line and reduce indent of table? \documentclass[a4paper]{scrartcl} \usepackage{amsmath,amssymb,amsfonts} \usepackage{...
pba's user avatar
  • 587
0 votes
0 answers
23 views

Writing a pseudocode in latex for safety analytics. Hwne I write statement foreach it is giving me error undefined control sequence. please help me

\documentclass[10pt]{article} \usepackage{fullpage} \usepackage{times} \usepackage{fancyhdr,graphicx,amsmath,amssymb} \usepackage[ruled,vlined]{algorithm2e} %\usepackage{tikz} %\include{pythonlisting} ...
sameen arshad's user avatar

1
2 3 4 5
15