Questions tagged [algorithm2e]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
27 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
  • 560
3 votes
1 answer
48 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
  • 560
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
34 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
128 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
1 vote
1 answer
38 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
  • 11
0 votes
1 answer
62 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} \...
zg c's user avatar
  • 63
2 votes
1 answer
95 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, ...
zg c's user avatar
  • 63
2 votes
1 answer
55 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]{...
zg c's user avatar
  • 63
0 votes
0 answers
19 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
31 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.7k
1 vote
1 answer
58 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,168
1 vote
2 answers
50 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,168
2 votes
1 answer
94 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
42 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
52 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
58 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
45 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
46 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
42 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
38 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,129
1 vote
0 answers
239 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
128 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
30 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
162 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.7k
0 votes
1 answer
48 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
  • 11k
1 vote
1 answer
44 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
60 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
102 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
  • 109
3 votes
1 answer
348 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,247
0 votes
1 answer
124 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
208 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
119 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
240 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
80 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
37 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
2 votes
0 answers
43 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,129
0 votes
0 answers
57 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
95 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
  • 123
1 vote
1 answer
97 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
137 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
  • 527
0 votes
0 answers
21 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 vote
1 answer
136 views

Add text after semicolon in algorithm2e

I have the following code: \documentclass{article} \usepackage[ruled]{algorithm2e} \begin{document} \begin{algorithm*} Set $a = 10$\; // \textit{$a$ denotes the amount of money} Decrease $a$ by $...
Alexi's user avatar
  • 211
1 vote
1 answer
157 views

inline \todo in algorithm results in overfull hbox

Feeding \documentclass{article} \pagestyle{empty} \usepackage{algorithm2e} \usepackage{todonotes} \overfullrule=2mm \begin{document} \begin{algorithm} \todo[inline]{Note} \end{algorithm} \end{...
user avatar
0 votes
1 answer
151 views

Remove extra blank line at the end of algorithm2e

Here's how to recreate the situation: \documentclass[preview]{standalone} \usepackage[ruled, vlined, linesnumbered, nofillcomment]{algorithm2e} \usepackage{algpseudocode} ... \begin{algorithm}[H] ...
zj_tw's user avatar
  • 5
2 votes
2 answers
420 views

How do we write if else if block with algorithm2e?

I have written the code for if else if block but I want nested if else if loop like If (flag) If (c1) then c2 Else If (c3) then c4 \documentclass{article} \usepackage[ruled, lined, ...
Anjali's user avatar
  • 21
0 votes
1 answer
87 views

Can't modify algorithm2e caption numbering

I want to change the numbering of one algorithm from Algorithm 5 to Algorithm 2.1. I've tried all these methods: Change caption number of an algorithm https://github.com/hadizadeh/Latex_algorithm No ...
zj_tw's user avatar
  • 5
0 votes
1 answer
45 views

Customizing pseudo-algorithms in algorithm2e package

If I have a pseudo-algorithm in Latex that looks like this: With source code below. \usepackage[ruled, vlined]{algorithm2e} \begin{document} \begin{algorithm}[H] \...
Parseval's user avatar
  • 103
1 vote
1 answer
52 views

How to remove the vertical space between the last line of code and the frame if the code is wrapped in `minted` within `algorithm`?

MWE: \documentclass{article} \usepackage{algorithm} \usepackage{minted} \newminted{python}{ } \begin{document} \begin{algorithm} \caption{Caption} \begin{pythoncode} x = 12 y = 3 print(x /...
Ryan's user avatar
  • 135
1 vote
1 answer
166 views

Algorithm in Beamer: all commands are in one line

I need the commands to be in separate lines (If, While, etc). I also tried to get rid of the number of the algorithm as suggested in other posts but the number is still there. Any help is appreciated! ...
Vika's user avatar
  • 341

1
2 3 4 5
15