{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)

0
votes
0answers
4 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, ...
2
votes
1answer
8 views

algorithm, how to start line numbering at given number (using algorithm2e)

I wonder how to start a code at a specific number; this is necessary when the algorithm is broken over two pages. A small example that I would like to start at line 39 instead of line 1. Is there a ...
1
vote
1answer
24 views

Number the algorithms with itemize or other environment

I am trying to number the two algorithm environments and put some space between each other but I am just getting the numeration at the side? How can I manage it to get the number before the ...
0
votes
0answers
24 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
1answer
34 views

Wrong number when reference inside algorithm

\usepackage{algorithm} \usepackage{algorithmic} \begin{algorithm}[tb] \caption{Algorithm} \label{alg} \begin{algorithmic}[1] \STATE blalblabla \label{cond1} \STATE ...
1
vote
0answers
35 views

A library of common algorithms? [closed]

Is there a latex package, or other resource, which provides a library of common algorithms? The LaTeX wikibook discusses 4 different algorithm typesetting packages for LaTeX; but I'm not fussy as to ...
4
votes
1answer
38 views

Align equal sign in algorithm in vertical line

The Code described in [1] produces the following output : For the description of my algorithm I need the equal signs to be perfectly aligned in one vertical line but currently there is still a ...
0
votes
0answers
21 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 ...
1
vote
0answers
37 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?
4
votes
1answer
62 views

Inconsistent caption height in algorithm environment

I noticed that the height of the caption of the algorithm environment does not solely depend on the font size, but on the actual caption text as well: \documentclass{scrartcl} ...
1
vote
0answers
25 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?
1
vote
1answer
38 views

putting algorithm in box

Below is my code snippet. Please help me to put a framed box in my algorithm. \documentclass[journal,12pt]{IEEEtran} \usepackage{algorithmic} \usepackage{graphicx} \usepackage{algorithm} ...
3
votes
2answers
59 views

Having separate captions for algorithms inside a tabular

I have the following code: \documentclass[10pt,conference,compsocconf,letterpaper]{IEEEtran} \usepackage{algpseudocode} \usepackage{algorithm} \begin{document} \begin{algorithm*}%[H] ...
1
vote
1answer
40 views

Error in listofalgorithms, undefined control sequence in .loa file [closed]

I am trying to write a pseudo code in LaTeX, and want to list the algorithm in the \listofalgorithms. Using the following code, I can generate the pseudo code in pdf and also the algorithm is listed ...
4
votes
1answer
49 views

Define algorithmicx block without line numbers

I'm trying to define some sort of algorithmicx command to give me this: \Statex \textbf{Local State:} \Statex \hspace{\algorithmicindent} $v \gets []$ \Statex \hspace{\algorithmicindent} $h \gets ...
3
votes
2answers
75 views

Disable the last line at the end of algorithm

If I use the algorithm package as such \begin{algorithm}[h!] ...insert algorithm here... \end{algorithm} I find a line at the end of my algorithm. Without going into detail, I want a algorithm ...
1
vote
0answers
54 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 ...
1
vote
1answer
24 views

Problem with cross references in table and algorithm

I am having a problem with cross references, which I have not been able to solve. I have a table and an algorithm which cannot be referenced. However, the behaviour in both cases is different: when I ...
0
votes
0answers
16 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?
1
vote
2answers
60 views

Need help reformatting PowerPoint slide containing latex code

Consider the following PowerPoint slide: This was produced with the help of IguanaTex plugin, which allows you to generate pictures from latex snippets, and add them to your PowerPoint slides. ...
0
votes
0answers
26 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
14 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
12 views

algorithm not coming properly [duplicate]

I want to write an algorithm like this using \documentclass{clv2} but my pdf is not being generated because of nested loops.
2
votes
1answer
38 views

algorithm textsc and uarial package?

Is it possible to get a regular optic at the algorithm package when using the uarial package? I am using: %change font \usepackage{uarial} %set arial as default font for everything ...
0
votes
3answers
54 views

Algorithm in document class clv2

How to write an algorithm in an article in \documentclass{clv2}, can anybody send me a working model with dummy algorithm, because I guess \caption is creating problem. I want to send it to ...
1
vote
0answers
21 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.
0
votes
0answers
21 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
39 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
1answer
66 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 ...
1
vote
0answers
40 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?
0
votes
0answers
16 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
44 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} ...
4
votes
1answer
34 views

Errors with the following algorithm -inputenc Error

\documentclass{article} \usepackage{algorithm,algpseudocode} \begin{document \begin{algorithm} \caption{PUML Algorithm} \label{PUML Algorithm} \begin{algorithmic}[1] \Procedure{Path\textendash Binary ...
3
votes
1answer
105 views

How to change font style of all algorithm/algpseudocode keywords?

In detail I want to change the font style of all keywords like If Return For to bold/sans serif, but only the keywords. MWE: \documentclass{article} \usepackage{algorithm} ...
0
votes
0answers
45 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 ...
2
votes
1answer
37 views

Help to write LWU-NN algorithm in Latex -whats wrongg with my code

Please can someone guide me as to how to write the algorithm attached in Latex I have tried and its giving me a lot of errors \begin{document} \usepackage{algorithm} \usepackage{algpseudocode} ...
2
votes
1answer
57 views

How to add borders to algorithms that put side by side

I put two algorithms side by side using the following code, however, there is no borders for them and the it is hard to identify the two algorithms. The codes: \documentclass{llncs}% ...
0
votes
0answers
52 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 ...
3
votes
2answers
65 views

Placing graphic and algorithm on same page

If I have the following LaTeX code, is it possible to combine both graphic and algorithm so that they are fixed to a common page? \begin{figure} [H] \centering{\includegraphics[scale=1]{Figure.png}} ...
0
votes
0answers
34 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} ...
4
votes
1answer
101 views

Remove the colon from line numbering in algpseudocode

Is there a way to remove the colon (:) from the line numbering in algorithms (using the algpseudocode package)? \documentclass{article} \usepackage{algpseudocode} \begin{document} ...
4
votes
1answer
82 views

Add lines to the bottom and top of algorithm

I am trying to write some psuedocode for my algorithm. Is it possible to add lines to the button and the top of the algorithm? If yes how? Code: \documentclass{article} \usepackage[]{algorithm2e} ...
1
vote
1answer
63 views

! Undefined control sequence. <recently read> \elf

I am trying to open an if statement after entering this if statement\eIf{$list size > 0$} at the position \elf{$stopAfterNext$ is not empty} but I am getting the error below. I can compile the ...
2
votes
1answer
20 views

Implementation of renewcommand in algorithms package

I am using the algorithms package, but am not being properly able to convert "Require" to say, something like "Parameters", using the \renewcommand macro. Can anyone please show how and in which part ...
1
vote
2answers
155 views

Add lines and line number to the pseudocode

I am trying to write some pseudocode. How can I add two line to the algorithm at the top and the bottom as well as adding line number. Code: \documentclass{article} %\usepackage{algorithmic}% ...
0
votes
0answers
28 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 ...
1
vote
0answers
34 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 ...
0
votes
1answer
84 views

How was this algorithm written?

The following algorithm appears on p. 152 of Boyd and Parikh's book Proximal Algorithms. I'd like to know how this was written in Latex, so that I can write my own algorithms in the same style. ...
8
votes
1answer
139 views

beamer - Mark several pseudocode block and insert comments near it

I try to use the answer proposed to this question: Mark a pseudocode block and insert comments near it But when I try to use it with several block, it does not work as perfectly as with only one ...
2
votes
1answer
86 views

Undefined control sequence and Something's missing perhaps a missing \item

I am using Windows 7 and getting a LaTeX Error in an algorithm; I am new to LaTeX and already spent a lot of time to figure this out but no luck. Could you please help me here? \begin{algorithm} ...