{algorithms} is about the presentation, numbering, and layout of algorithms or pseudocode in documents. Popular packages are algorithms, {algorithmicx}, {algorithm2e} and {listings}. For questions about the specific package, use the appropriate tag instead.

learn more… | top users | synonyms (1)

2
votes
2answers
29 views

Help with algorithm2e formatting

recentely I've got into a bit more advanced LaTeX formatting, i.e algorithms. My package of choice is the algorithm2e package, but I'm having some difficulities operating it. So I've wanted to create ...
1
vote
1answer
53 views

how to insert protocol in Lyx?

I know how to insert "algorithm" in Lyx. But how to insert "protocol" as shown in the following figure?
2
votes
0answers
142 views

How to set algorithm width to avoid overfull \hbox problem

I wrote the following latex text, but the log shows an error that overfull \hbox(10.0pt too wide) detected. I am sure that the algorithmic part exceed the width limit. Even if I type a few words, the ...
2
votes
0answers
229 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
0answers
471 views

Algorithm keeps appearing on the last page of my latex document

I am writing an algorithm with the algorithmic environment and Latex keeps pushing it on the last page, no matter what I do, this is just a short example. \documentclass[a4paper,10pt, twoside]{book} ...
2
votes
0answers
103 views

How to complete the algorithm using algorithm2e

I wanted to write this flowchart using \usepackage[linesnumbered,ruled,vlined]{algorithm2e} However, I couldn't get what I want, please refer to my code in below \begin{algorithm} ...
2
votes
0answers
95 views

The algorithms' captions appear in the list of abbreviations

I have a problem with the list of abbreviations. The problem is that the algorithms' captions appear in the list of abbreviations! I use the loabbrv package for the abbreviations, and by the command ...
1
vote
0answers
41 views

No algpseudocode-package in TeXstudio

I am using TeXstudio for writing my thesis. I am tying to use the algpseudocode-package, but it says that the package isn't found. Here is the screenshot of the error that I am getting:
1
vote
0answers
31 views

Multiple conditions in a “If” algorithm

I've done a lot of searching in google but not found any answer to my question. I'm searching for a way to write this in latex : if ( (t<-3) || ...
1
vote
0answers
7 views

Getting Error in writing algorithm in latex

I am facing error saying "! Missing number, treated as zero.\ALG@b@2@ELSE@0 \ELSE" in writing the following algorithm in Latex.I can't understand what is the problem. \begin{algorithm}[H] ...
1
vote
0answers
49 views

Help identifying LaTeX code-style feature

The document below uses a feature I can't quite identify to display monospaced code-style font sections: Does anyone know how to achieve this effect?
1
vote
0answers
31 views

Put two algorithms in the same page one after the other

I want to put two algorithm on the same page and be able to change the size of two of them at the same time as they are in a box. I thought about \minipage but I am not sure how exactly I can do it.
1
vote
0answers
52 views

Typesetting algorithms in LaTeX like Kleinberg and Tardos 'Algorithm Design'

Is there any LaTeX package for typesetting algorithms in the style Kleinberg and Tardos uses in Algorithm Design?
1
vote
0answers
46 views

Typesetting algorithms: Taking the n argmax feature indices

I'm trying to typeset a simple greedy algorithm in LaTeX. My main question is how to correctly typeset "storing the indices of the best T values". Algo, simple and short: There is a matrix of ...
1
vote
0answers
63 views

Error with algorithm and algorithmic packages

I have the following problem that involves the algorithm and algorithmic packages with the garamondx font. This is a minimal example: \documentclass[letterpapet,10pt]{article} \usepackage{garamondx} ...
1
vote
0answers
80 views

Too long algorithm

I would like to know how it is to write a long algorithm beyond the edges of a page, knowing I used algorithm and algorithmic packages?
1
vote
0answers
92 views

Creating sub-algorithms

I want to have two algorithms together that I can refer to as 1a and 1b (rather than seperately as Algorithm 1 and 2). So very similar to how subfigures work. Is this possible using any of the ...
1
vote
0answers
349 views

Publication style for Algorithms

I want to make own paragraphs for algorithms by numbering them appropriately. I do not need any fancy things - white background, no borders and black font are ok. I am trying to write in Springer ...
1
vote
0answers
93 views

make latex to automatically choose the placement of algorithms

I have several algorithms written down in a single file and would like latex to spread them across the document to save spaces. For example an algorithm can be just 3 or 4 lines and another can be 20 ...
1
vote
0answers
155 views

Algorithm Environment

I want to write an algorithm into my paper but it is just a pseudocode and none of the fancy if-then loops etc. Instead, I want it to look something like Algorithm 11.1 here: What environment ...
1
vote
0answers
197 views

algorithm2e with RevTex

Note: I have seen the previous answer to this problem here and it doesn't work for my purposes. I suspect that others are in the same boat. I'm writing a paper for which the publisher requires the ...
1
vote
0answers
341 views

Reduce space below an algorithm

I am using the algorithm package for my algorithms in the paper. I find that the space below the algorithm is very large after generating a PDF, so I want to shrink the space. Firstly, I come to add ...
0
votes
0answers
26 views

Formatting an algorithm with a nice presentation

I was reading this paper and I think is really nice the format how they present the algorithms, how can I do this? what packages are needed and the styles. Thanks in advance.
0
votes
0answers
15 views

How to add line numbers to my Algorithm in Latex

I am writing an algorithm in LaTeX. I am already using the following packages for algorithms: \usepackage{algorithmic} \usepackage{algorithm} \usepackage{amsmath} i am also using the \STATE tag. i ...
0
votes
0answers
18 views

How to write the algorithm with bold keywords and line numbers

I wish to write an algorithm like the following, with keywords bold and line numbers in each line. Could someone help on how to use latex to write this kind of algorithms?
0
votes
0answers
20 views

footnotes just after algorithm

I am trying to add footnotes at the end of an algorithm environment (not at the end of the page). I found this post where this is done but there are no numbers to refer to the footnote. So if I want ...
0
votes
0answers
22 views

Change the format of an algorithm from a table to any algorithm typesetting

I have been struggling to format the pseudocode of my algorithm from the current state (in a table) to the one provided by the algorithm package. After several tries with answers like: one, another, ...
0
votes
0answers
22 views

Adding brace next to column in beamer and writing text in a box

I am creating a presentation in Beamer. I would like to achieve the following: Please guide on how that can be achieved. Also I would like to this if an algorithm is written in the bigger box.
0
votes
0answers
16 views

Procedure numbering in packages algorithm and algcompatible

When I use both packages algorithm and algcompatible, I find the algorithms can be easily numbered, but the procedure cannot. How can I number the Procedures in algorithm, like Procedure 1, ...
0
votes
0answers
34 views

Approaches to automatically scale figures

I am trying to come up with a general rule of thumb to scale figures such that their vertical size and horizontal size does not exceed a certain limit (assume 300pt). The monkey patching way to do ...
0
votes
0answers
28 views

List of algorithms not working with amsbook document class

I am using \listofalgorithms in a document with \documentclass{amsbook}. It seems the two clash for some reason. When I run pdflatex, I get the following error message: (./main.loa ! Undefined ...
0
votes
0answers
32 views

How to illustrate vector operations in algorithm environment?

Is there a nice standard way to represent a vector, and things like vector creation, and operations like push_back, or add in the algorithm environment?
0
votes
0answers
21 views

Indentations in Algorithm floats in LYX

I am using LYX and I'm trying to enter algorithms in an algorithm float. Is there a way to have indentation?
0
votes
0answers
48 views

Adding keywords to an algorithm in LYX

I am using the method explained in this post to add algorithms in LYX. I wonder if it is possible to add new keywords like (Input, Output, ...) so they appear in bold. I use Algorithm-Style Package ...
0
votes
0answers
25 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 ...
0
votes
0answers
42 views

How can very long algorithms be automatically split over multiple pages with a specific layout?

My question is related to this other question just published I have the same problem and I solve with your solution, removing {algorithm*} environment (which is a floating box, and boxes never ...
0
votes
0answers
67 views

How to insert a subscript in algorithm

I'm writing a pseudocode by algorithm package. Now I want to write a variable using a subscript: I would write something like var\ped{e} where var is the name of the variable and e is the subscript. I ...
0
votes
0answers
24 views

Why is this algorithm badly outlined?

I have the following algorithm in Latex using the algorithm and algorithmic package: \begin{algorithm} \caption{Play-N-Games algorithm} \label{alg:play} \begin{algorithmic} \State $Agent\gets Make ...
0
votes
0answers
70 views

Algorithm indent problem with sig-alternate document & algorithm(ic) package

Can anyone tell me why the indention of the algorithm does not work? I have the following code: \begin{algorithm} \caption{STEP 1} \begin{algorithmic}[1] \REQUIRE Something \FOR{\textbf{each} ...
0
votes
0answers
64 views

algorithms package, science packages and related configuration problems

I am new to Ubuntu and new to LaTeX and now I need to modify a .tex file. I use Texmaker. It said that the algorithmic.sty is missing, so I installed the texlive-science packages. But when I did, I ...
0
votes
0answers
58 views

Force algorithm description, title and first function on the same page

I have an algorithm I want to describe. It's composed of several short functions, and while there are too many of them to fit them all on a same page, I want a clean solution to get each function to ...
0
votes
0answers
49 views

The conflict between floatrow and algorithm packages

I was trying to use floatrow package to enable the subfigures. However, it seemed to damage the format of my algorithm a bit: \documentclass[11pt]{iopart} \usepackage[utf8]{inputenc} ...
0
votes
0answers
30 views

individual algorithm environment with continuous numbering with normal algorithms

i am searching an algorithm environment in Latex. Im familiar with listings, algorithm and so on. But I want to create smth that looks like this: Initial step. Do the initial step General step. Do ...
0
votes
0answers
26 views

combining pictures and algorithm in two columns document

I tried a lot to prepare such a following format for my paper but it always put algorithm in a separated place. here is \begin{algorithm*}[] \KwIn{$L_1$, $L_2$ } \Return{$F$} ...
0
votes
0answers
29 views

How to write “for” block with counter by Algorithmic package

How can I write a code like below using algorithmic package for (int i = 0; i < node.children; ++i) ..... I can't use foreach or forall because in a point inside the loop I should decrement i ...
0
votes
0answers
16 views

How can I include specific lines of pseudocode from a file?

In my document, I use the listings package to include listings from separate files: \lstinputlisting[firstline=6, lastline=11, firstnumber=6]{myprogram.c} (This shows the lines 6 to 11 from the ...
0
votes
0answers
21 views

Algorithm formatting

\begin{algorithmic} \For{$i,j\gets 0, 255$} \State $j\gets (j + key [i mod keylen] + S[i] ) mod 256$ \EndFor \end{algorithmic} I want to print j= (j + key [i mod keylen]+s[i]) mod 256 My code ...