Questions tagged [algorithm2e]

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

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

avoid line numbering in a algorithm when closing tcolorbox and adjustbox

when closing the tcolorbox and adjustbox inside an algorithm, the lines of codes corresponding to their commands are displayed numbered. How can I prevent the 1 beside the caption (see the below ...
1
vote
1answer
22 views

Algorithm: make loop lines appear below the words

I am using the algorithm environment and I do not know how to make the lines for the loops under the corresponding word, not where I have them now. Here is my code: \documentclass{article} \usepackage[...
1
vote
1answer
22 views

Algorithm in `oframed` environment

\usepackage[ruled,vlined]{algorithm2e} \usepackage{framed} \setlength\FrameSep{5mm} \begin{document} \begin{oframed} Some text... \begin{center} \begin{algorithm} ...
2
votes
1answer
16 views

algorithm2e - Bug (?) with \SetKwSwitch

The following M(not)WE should work. Did I find a bug ? \documentclass{article} \usepackage{algorithm2e} \SetKwSwitch{Switch}{Case}{Other}{Switch}{:}{Case}{Other}{} \begin{document} \begin{...
0
votes
0answers
30 views

pseudocode Environment in Latex

I am trying to write the below algorithm in Latex but failed to get the symbols which are highlighted in red. Does latex support this symbol or I am making a mistake in the script? Example script: \...
0
votes
0answers
15 views

Align equation in algorithm

I am using algorithm2e to try and write an algorithm with an equation. So far we're looking at \title{AlgorithmTemplate} \documentclass[12pt]{article} \usepackage{fullpage} \usepackage{times} \...
0
votes
0answers
17 views

How to split algorithm2e?

Is there any way to split algorithm2e in two pages? I want it to be under the paragraph on page 1 and the rest of it on page 2. \documentclass{article} \usepackage{xcolor} \usepackage[linesnumbered,...
1
vote
1answer
34 views

algorithms in margin of tufte style book?

I would like to place an algorithm in the margin of a tufte style book. I am using algorithm2e. I have no idea how to do this, or if it is possible at all. Please help? Here is an example but it place ...
2
votes
1answer
26 views

algorithm2e get rid of newline after then

I'm having this code \documentclass[11pt,a4paper]{article} \usepackage[]{algorithm2e} \begin{document} \begin{algorithm}[H] \If{cond}{ stmt1\; }...
2
votes
1answer
29 views

algorithm2e fully justified input / output blocks

I would like to fully justify the input/output blocks in the algorithm2e environment. How can this be achieved? I cannot find anything regarding this matter in the documentation. To be precise, I ...
1
vote
1answer
49 views

Combining letters and numbers in numbering algorithms by using the algorithm2e package

For my Appendix section, I would like to reset the numbering of my equations and algorithms, and I would like to add the letter "A" just before the numbers. I do achieve this goal for my ...
1
vote
0answers
17 views

Is there a way to change the thickness of the lines from loop to loop in algorithm using algorithmic2e?

Let say I have the following algorithm \documentclass[12pt]{article} \usepackage{fullpage} \usepackage{times} %\usepackage{fancyhdr,graphicx,amsmath,amssymb} \usepackage[ruled,vlined,linesnumbered]{...
2
votes
1answer
33 views

tufte-latex: Full-width algorithm2e blocks

I'm using \documentclass{tufte-book} and trying to get a full-width algorithm environment (specifically, using algorithm2e). Minimum working example: \documentclass{tufte-book} \title{Full-width ...
2
votes
1answer
35 views

Central line number for large function with algorithm2e

I have an algorithm (using algorithm2e) where I need a big function, so I want to enter it as an equation. But the line numbering seems a bit weird, as it numbers an empty line. I want the number to ...
1
vote
0answers
12 views

Missing list of Algorithm in the content

The command in my tex \listofalgorithms is detected as unrecognized command. In the generated pdf file. The page of Algorithm is presented, while in the content, this page is skipped. So what can I do ...
3
votes
1answer
36 views

How to center the caption in a boxed algorithm?

I want to center the caption in the following algorithm by using the algorithm2e package. But I do not get it. The documentation tells me that \SetAlgoCaptionLayout{centerline} should work, but it ...
0
votes
1answer
30 views

why adding hyperref makes algorithm2e not span pages any more?

TL 2020. compiled using lualatex I have set up of the form \begin{algorithm}[H] .... \end{algorithm} \begin{algorithm}[H] .... \end{algorithm} \begin{algorithm}[H] .... \end{...
1
vote
1answer
36 views

Using algorithm2e, how to make IF condition 1 OR conditions 2 OR conditions 3 THEN

Using algorithm2e currently when I do this \If{ condition_1 OR condition_2 OR condition_3} But if the stuff between {} is too long, it wraps around and does not look good since there is no ...
1
vote
1answer
75 views

How to remove “then” after if statement in algorithm2e

I am trying to write a pseudocode and would like to remove the then statements showing up after if or else if statements. \documentclass[ijoc,nonblindrev]{informs3} \usepackage[linesnumbered,ruled,...
0
votes
2answers
64 views

How to remove the colon in the caption of `algorithm2e`

I am preparing a presentation, and I want the title of the algorithm without any numbering, and without any colons. I use the commands \renewcommand{\algorithmcfname}{} \renewcommand{\thealgocf}{} ...
0
votes
0answers
59 views

Algorithm2e with tufte layout: how to get full-width and margin floats?

I'm using the tufte-book layout, which provides marginfigure, figure and figure* environments to create floating figures which occupy either the margin only, the main text column only, or uses the ...
0
votes
1answer
34 views

Loops does not close at their right place

I am trying to write an algorithm on laTex, my problem is that for loops do not close at right place. I am printing output outside of loop but still it appears inside for loop \title{...
2
votes
1answer
40 views

Best way to write input section of algorithm

i have a problem to align the part regarding the parameter section. So far i have obtained such result: \documentclass[a4paper,parskip=half*,twoside,numbers=noenddot]{scrbook}\usepackage{textcomp} \...
1
vote
1answer
37 views

\listofalgorithms not working with algorithm2e in document class puthesis

I am using the algorithm2e package to add some algorithms to my thesis with the following line in my preamble: \usepackage[]{algorithm2e} However, I am unable to add the list of algorithms to my ...
3
votes
2answers
162 views

algorithm2e vertical line indentation

I really like the vertical line feature of algorithm2e, but I ran into trouble with it when I try to indent an if statement. I used the following code. \documentclass{article} \usepackage{amssymb,...
0
votes
0answers
20 views

Cref an algorithm with its caption [duplicate]

When I \cref an algorithm, it shows "algorithm 1". Is it possible to ref an algorithm with its numbering and caption? Like "algorithm 1 foo", where "foo" is the caption of algorithm 1. Thanks a lot
0
votes
1answer
14 views

Why are my “ends” not aligning while using algorithm2e?

I am using algorithm2e but my "end" are not aligning. Here is the output \begin{algorithm} \caption{UpdateRobotLocation} \label{alg:r2p} $robotLocation{\longleftarrow} robotLocation + ...
3
votes
2answers
158 views

Modifying the algorithm name in algorithm2e

I am using the algorithm2e package to generate pseudocode for a paper. The journal requires the format of "S1 Pseudocode", "S2 Pseudocode", etc. However, I am only able to generate the format as "...
0
votes
1answer
35 views

Change caption title “Algorithmus 1” in algorithm2e

Using \begin{algorithm} environment with only \usepackage{algorithm2e} in the preamble (and of course the usual packages for an article document), the environment by default titles the algorithm "...
-1
votes
1answer
39 views

what is wrong with my code

what is wrong with my code please do not closed my topic \documentclass[12pt,a4paper]{report} \usepackage[ruled,vlined]{algorithm2e} \usepackage{algorithmic} \begin{document} \begin{...
2
votes
2answers
38 views

How to write if and then in algorithm? [closed]

I want to write in this algorithm if after for. How can I do that? \begin{algorithm}[H] \caption{Algorithm Gaussian elimination with patrial pivoting} \SetAlgoLined \For{$i=1:1:n$}{ $p_{i} = ...
0
votes
1answer
58 views

Why is LaTeX failing to generate list of algorithms with algorithm2e? [closed]

I have 3 algorithms in my thesis (2 in appendix and 1 in a chapter). I have the package algorithm2e loaded in the preamble. I successfully generate a list of figures and list of tables, however, list ...
0
votes
1answer
33 views

Two captions for algorithm in algorithm2e package

In my thesis, I need to describe both algorithms and cryptographic games. Currently I am using the algorithm2e and the algorithm environment for both. Is there an option to specify dual captions so ...
1
vote
1answer
44 views

How to decrease right margin with algoritm2e?

I'm using algorithm2e and my lines are breaking too early. I would like to reduce the size of the margin on the right side, without affecting the left margin. I'm interested in doing it, because right ...
1
vote
0answers
17 views

Getting a long algorithm2e smaller by putting parts of it side by side

I'm currently trying to replicate this algorithm in algorithm2e: (Taken from https://sike.org/files/SIDH-spec.pdf) And I'm unable to find out how I can do something similar, as it would save me some ...
0
votes
1answer
18 views

How to change algorithm title format from point(.) to dash(-)

I am using package {algorithm2e} to write algorithm. Now I want to alter the algorithm title format with dash(-), for example, I am writing the first algorithm in chapter 3, so the title of this ...
2
votes
1answer
38 views

How to align algorithm2e with text outside?

I am having trouble aligning my algorithm with the text outside of it. Here is an example: \documentclass[11pt]{article} \pagestyle{empty} \oddsidemargin -0.25in \textwidth 7.0in \topmargin ...
3
votes
2answers
70 views

Indentation of line numbers while using equations within algorithm2e

I have written some algorithms using the package algorithm2e. Some of my algorithms also include aligned formulas. My problem is that line numbers below lines ending with equations have a larger ...
2
votes
0answers
22 views

Position of line numbers using algorithm2e and fontenc [duplicate]

I want to present an algorithm with the package algorithm2e. It mostly works fine, only the position of the line numbers are wrong. The numbers are printed within the margin of the page. I figured ...
0
votes
1answer
71 views

algorithm2e options algonl and boxed seem to clash

I'm using a solution suggested by C. Fiorio in Want Knuth style line numbering in algorithm2e algorithms. The suggestion was to use the algonl option for algorithm2e to achieve Knuth style algorithm ...
0
votes
2answers
51 views

Adjust caption of algorithm2e using own macro

I have a document with a few tables that have their captions formatted like this which I achieved using \usepackage[format=plain, justification=raggedright,singlelinecheck=true]{caption} \...
0
votes
1answer
27 views

Algorithm listing in wrong language and not numbered (a,b,c…)

I added \usepackage[ruled]{algorithm2e} to show pseudocode algorithms in my document. I also got an appendix, some figures and tables. In the end these should be listed. This works fine and its is ...
2
votes
1answer
86 views

Missing $ inserted, Missing \endgroup inserted

I am writing an algorithm in latex. I am getting some error. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \title{Demo} \author{Subhadip Patra } \date{March 2020} \...
1
vote
1answer
82 views

Changing the class to beamer does not specify the color dash line! How to fix the problem?

In this answer Changing the class to beamer does not specify the color dash line! How to fix the problem? \documentclass{beamer} \usepackage[utf8]{inputenc} \usepackage{xcolor} \usepackage[ruled,...
1
vote
2answers
94 views

What's wrong with `\string`?

I am using the algorithm2e package to typeset my algorithms. I want to be able to control the caption numbering style. More specifically, I want the caption number to be enclosed in curly braces and ...
1
vote
1answer
48 views

Flush right page numbers for list of listings and algorithms using tocbasic

Based on a previous question Extending table of contents dots up to large page numbers I have been using tocbasic and have some Roman pages. In all the list of somethings the Roman numbers are right ...
0
votes
1answer
40 views

Spacing between list of listings and algorithms and their reference numbers with tocbasic

Because of this answer to Extending table of contents dots up to large page numbers I am using tocbasic and would like to add more spacing between the reference numbers in the List of listings ...
0
votes
1answer
144 views

How to write an algorithm in algorithm environment in Latex?

How do I write the following algorithm/pseudocode in algorithm environment in Latex? train_ANN(fi,wi,oj) For epochs from 1 to N While (j<=m) Randomly initialize wi={w1,w2…..wn} ...
3
votes
2answers
75 views

How to note that a algorithm is done in \mathcal O (n)

I have an algorithm and I'd like to mark the time it takes to go through. The minimal working example is \documentclass[a4paper]{scrartcl} \usepackage[ruled,vlined]{algorithm2e} \begin{document} \...
1
vote
1answer
22 views

Indentation not aligning while using algorithm2e package

Below is my latex: \usepackage[ruled,longend]{algorithm2e} \begin{algorithm} $I \gets \text{Images of objects' plane}$\newline $Detector \gets \text{Define detector}$\newline $Descriptor \...

1
2 3 4 5
12