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

learn more… | top users | synonyms

2
votes
1answer
76 views

Write the else if block with algorithm2e

How can I write the else if block with condition with the usepackage algorithm2e? I want to write the following with the algorithm2e package: if(condition){ //code }else if(condition){ // code ...
1
vote
1answer
160 views

Algorithm2e writing simple pseudocode with multiple functions

I am new at algorithm2e and I'm really struggling with the most simple things. I would like to write an algorithm (pseudocode) with a few functions that call each other. For now, I have this minimal ...
2
votes
1answer
72 views

How to alter style of statement block line in algorithm environment of algorithm2e package?

I'd like to change the style of the line that runs along the side of a statement block in a pseudocode algorithm typeset using the algorithm environment of the algorithm2e package. Here's the initial ...
1
vote
1answer
93 views

! Undefined control sequence. <argument>

but it has a error. please help me. \documentclass{article} \usepackage[ruled,lined]{algorithm2e} \usepackage{xepersian} \settextfont[Scale=1]{XB Niloofar} \setdigitfont{XB Niloofar} ...
1
vote
0answers
53 views

How to make the fully justified code at line-breaks?

I have a problem for using algorithm2e package. I am writing a algorithm just like \begin{algorithm} \caption{RM-MEDA} \label{alg1} Initial a population $Pop(0)$ and compute the $F$ ...
3
votes
1answer
86 views

algorithm2e - override defaults

I'm using using algorithm2e package with the following settings: \usepackage[ruled,vlined,linesnumbered,noresetcount]{algorithm2e} But for some subset of algorithms in the same document, I want to ...
2
votes
1answer
56 views

Changing algorithm2e keywords fonts

A journal has asked me to change the font of my algorithm to Courier New. I'm able to change all except the keywords (if, then, else, etc.). My best solution looks like this: \documentclass{article} ...
0
votes
0answers
29 views

How can I set the font for loops in algorithm2e?

Consider the following listing with algorithm2e. I want the font in the if-clause at the bottom to be in typewriter or the same font used in the loop bodies, and the list for the for-loops as well. I ...
1
vote
0answers
34 views

Indent the block with the algorithm2e usepackage

How can I indent the pseudocode block after this line function Karatsuba(p,q)? \documentclass{article} \usepackage{german,t1enc} \usepackage{lipsum} \usepackage{fancyhdr} \pagestyle{fancy} ...
1
vote
1answer
534 views

Can be used only in preamble occurs when using \usepackage command

Whenever I am trying to use the subfigure or the algorithm2e package using \usepackage command, it is showing LaTeX Error: Can be used only in preamble. What is the problem and how to get rid of ...
0
votes
0answers
30 views

Use chapter numbering style for algorithm2e in beamer

I have a document with several chapters and different algorithms, using algorithm2e and the option algochapter. Now I'm doing a presentation using beamer, however beamer doesn't support chapters. The ...
0
votes
1answer
86 views

How to write algorithm without numbering in latex

I am looking for the way to write a algorithm as: (without numbering). Please help me to write it in latex. Thanks in advance Algorithm: Input: A, B,C. Initialize \alpha, \beta,u Employ the A While ...
3
votes
1answer
83 views

How to mark line numbers of an algorithm with asterisk? [closed]

I'm working with IEEEtran and algorithm2e package. I have a pseudocode with numbered lines. I want to mark some of my line numbers (not the lines themselves) with an asterisk mark. How can I do that? ...
0
votes
0answers
87 views

How to present an algorithm in the middle of page

Is it possible to present the algorithm in the middle of page with smaller box? {\tiny \begin{center} { \RestyleAlgo{boxed} \SetAlgoCaptionSeparator{} \begin{algorithm} %\SetLine \KwIn{An empty array ...
2
votes
2answers
50 views

Which arguments does SetArgSty configure in algorithm2e

From the documentation of algorithm2e I was expecting \SetArgSty to change the style of arguments from functions in my pseudocode, not some arguments from the keywords algorithm2e uses. So if/for/etc ...
4
votes
1answer
84 views

Why SetKwData defined macro for algorithm2e doesn't work in caption?

I defined a macro with \SetKwData command from algorithm2e but it doesn't seem to be working in the caption. My code: \documentclass[10pt,a4paper,twoside]{report} ...
1
vote
1answer
122 views

Reset the default font and style for algoritm2e

I'm using a (required) template with a sans serif font, however I would like to maintain the default font for algorithms. I'm using pseudocode with variables with more than one letter, so I defined ...
2
votes
1answer
83 views

algorithm title, which is unnumbered, is not in place

The code \begin{algorithm} \SetAlgoLined \TitleOfAlgo{SA} \BlankLine \KwData{Movie} \KwResult{Classification} \BlankLine \Begin { \textbf{call Function 1: S}\\ \textbf{call Function 2: St}\\ ...
1
vote
0answers
140 views

Problem with list of algorithms using algorithm2e and classicthesis

I am using classicthesis to write my master thesis. I use the algorithm2e package to write down my algorithms. The problem I face is related to the table of content. For tables, contents, figures ...
1
vote
2answers
73 views

add line number to the algorithm2e [duplicate]

How can I add line number to my algorithm? I want to write line number in the front of the algorithm line. How can I get that with the \usepackage[ruled]{algorithm2e}? Code: \documentclass{article} ...
0
votes
0answers
43 views

How to align function arguments in algorithm2e environment

In the "algorithm2e" environment, when a function call spans multiple lines, I would like to have its arguments aligned, like so: MyFunction(long_arg_name0, long_arg_name1, ...
1
vote
1answer
195 views

Horizontal spacing in caption in algorithm2e

In algorithm2e, how can I shift the caption to the left? There is a small space that I need to remove. Here is my code: \documentclass[letterpaper]{article} ...
3
votes
1answer
56 views

Preventing algorithm2e linebreaks

I want to include inline code examples such as if i < n then i++ and else i--. I'm using the following LaTeX: \documentclass{article} \usepackage{algorithmic} \usepackage{algorithm2e} ...
3
votes
1answer
65 views

Repeat block without until (or blank line) using algorithm2e

I'm trying to format a "repeat forever" block using algorithm2e. I've found the \Repeat command but this prints an until at the end of my block. I can hide the word until using: ...
1
vote
0answers
20 views

How to align algorithm with text [duplicate]

I am using the algorithm2e package for a paper, and I am using it as follows: \usepackage[ruled,linesnumbered]{algorithm2e} Everything works OK, however, when I added the linesnumbered directive ...
2
votes
0answers
259 views

Using special characters with lstlisting

I am using the Algorithm2e package to use code in my LaTeX document. However, the code contains special characters such as à, é, è etc. Those characters causes errors such as Unicode character x not ...
2
votes
2answers
121 views

\Titleofalg with algorithm2e package

The following code gives me an error and I am not sure why: \documentclass{beamer} \usepackage{default} % typesetting of algorithms \usepackage[vlined,linesnumbered]{algorithm2e} ...
0
votes
1answer
110 views

Writting Recursive algorithm (LCS) using algorithm2e package similar to the one shown in attached image [duplicate]

I want to write this algorithm (recursive) in latex but I don't know how to do it. I have attached image of the algorithm. Please help me with the code. I am using algorithm2e package. Thanks!!
0
votes
1answer
735 views

How to remove vertical lines representing a block in algorithm2e

\begin{algorithm} \SetNoLine \DontPrintSemicolon % Some LaTeX compilers require you to use\dontprintsemicolon instead \KwIn{A finite set $A=\{a_1, a_2, \ldots, a_n\}$ of integers} \KwOut{The largest ...
3
votes
1answer
420 views

\Fn ! Undefined control sequence

Under Ubuntu 15.04, I want to use algorithm2e to write pseudo code, when I copied an example from the documentation, TeXStudio displays error indicating that the command \Fn is undefined. I thought ...
2
votes
2answers
158 views

new caption type in captionof

\captionof command from caption package allows caption for various floats. However we cannot use it to typeset an algorithm caption like: \captionof{Algorithm}{<Caption text>}. I tried the ...
2
votes
1answer
321 views

Why does't the \SetAlFnt work in the algorithm2e?

I want to use the \SetAlFn to change the font size of the algorithm, but it doesn't seem work at all. Here is my code. \documentclass{article} \usepackage{amssymb} \usepackage{graphicx} ...
1
vote
1answer
77 views

How to put two algorithm2e (one is large and one is small) side by side by using minipage or subfigure?

I have two algorithms wrote by the algorithm2e package. One of them is large and the other is small. My try is here: %\documentclass[runningheads,a4paper]{llncs} \documentclass{article} ...
6
votes
1answer
132 views

Algorithm2e: What is the recommended method to change the caption of ONE algorithm?

I want to read the caption of one of my algorithms typeset by algorithm2e to read Listing instead of the default algorithm. What is the recommended/best way to achieve this? I actually have a ...
1
vote
0answers
48 views

Underline entire line in algorithm2e

is there a way to underline entire line of code in algorithm2e? Including keywords like for each etc.
2
votes
0answers
45 views

Underline line numbers in algorithm2e

is there a way to underline specific line number? For example I have lines 1,2,3 and 4, and I want number 2 to be underlined. Thanks alot
3
votes
1answer
87 views

What are these algorithm2e empty warnings?

I am using the algorithm2e package in my paper and for some reason TexStudio is reporting these 2 warnings from algorithm2e.sty which don't have any message or line number. When I enable the Issues ...
1
vote
0answers
31 views

Latin characters in algorithm2e package [closed]

I am trying to write algorithms using the algorithm2e package and I am experiencing some problems with latin characters like ěéáž and so on. Is there a way to write these? Typesetting always ends with ...
2
votes
1answer
294 views

Table of contents of algorithm and algorithm2e together

The contents of the algorithms thinks that an algorithm that uses algorithm is one algorithm and an algorithm that uses algorithm2e is another algorithm, not the second of what was imported with the ...
3
votes
2answers
1k views

Multiline statements and conditions in algorithm environment

I have an algorithm that I want to write in mathematical pseudo-code. However, some conditions and statements are very long, e.g. "if (a series of relations and constraints hold) do" or "X gets (a ...
2
votes
1answer
95 views

Remove vertical space after new chapters in listofalgorithms

When generating list of algorithms, the command \listofalgorithms automatically inserts a 10pt vspace after the last algorithm caption in a chapter. I need to remove this vertical space in such a way ...
0
votes
1answer
42 views

Error in Until section

I'm newbie for tex. I am writing an algorithm in tex, I need some help in troubleshooting the error. \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage{algpseudocode} ...
4
votes
1answer
226 views

End word is hidden in algorithm block

Suppose that i have this code: \usepackage[ruled,vlined]{algorithm2e} \begin{dcocument} \begin{algorithm}[H] \KwData{this text} \KwResult{how to write algorithm with \LaTeX2e } initialization\; ...
2
votes
1answer
300 views

How to change the caption of Algorithm

{\tiny \restylealgo{boxed} \begin{algorithm} %\centering{ \SetLine \KwIn{$A$. } \caption{} %} \label{algo2} \end{algorithm} } In the caption it is coming as "Algorithm 2:" Is it possible just ...
6
votes
1answer
748 views

{Begin End} does not show when writing algorithm in LaTeX

I am writing an algorithm in LaTeX using \usepackage[ruled,vlined]{algorithm2e} When running the code, the produced file does not show the word "end" that should appear automatically when using ...
35
votes
1answer
8k views

algorithm, algorithmic, algorithmicx, algorithm2e, algpseudocode = confused

I am getting confused about the package structure for writing simple "algorithms". There are too many options, and also got totally clueless about when to use what. Is there any definitive guidelines ...
6
votes
1answer
367 views

Making algorithm2e environments “overlay aware” in beamer

What is the right away to make algorithms overlay aware in beamer? When using algorithm2e in a beamer presentation, an algorithm on a frame with overlays can get more than one number. For example, ...
4
votes
1answer
383 views

How to typeset data structures with algorithm2e?

The question How to typeset data structures? gives create answers for how to type set simple data structures with the lstlistings package. In particular, I like the following look (taken from Mico's ...
1
vote
1answer
76 views

How to customize the caption as a figure number in the algorithm2e package

I want to show the algorithm as a figure and cite that figure using the figure number anywhere in the page. Below is the code: \documentclass[a4paper,11pt]{report} ...
2
votes
1answer
270 views

Display the algorithm number based on the chapters

I have to number the algorithms based on the chapters that they appear. I have used the command \listofalgorithmes. But still I have the issues. Please refer to the attached codes and figures ...