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

7
votes
1answer
1k views

Line numbering in algorithmic

I want to change the first number of the line numbering in my algorithm, but how is it done? This is my example: \documentclass[12pt]{beamer} \usepackage{amsmath, amsfonts, amssymb, amsthm} ...
5
votes
2answers
202 views

3 Algorithms in the same column with algorithmic

I have 3 algorithms that I want to be displayed in the same column of a 2-column document. They are all slight variations of each other, so it is important that they be displayed right next to each ...
3
votes
1answer
925 views

Undefined control sequence when adding math comment to \WHILE

I'm pretty new to (La)TeX so please forgive me if this question is stupid :) I have an algorithm that is typeset with the algorithm and algorithmic packages. Then I have this in the algorithm: ...
1
vote
0answers
131 views

Package algorithmic [closed]

So my problem is whenever I try to use the algorthmic package, it gives me an error related to citations! And when I comment out the algorithmic block, everything works fine. I read somewhere that ...
5
votes
2answers
1k views

Can't manage to use algorithm packages

I'm trying to write some simple pseudocode but I just can't get it to work. It's pseudocode from another paper and I want to change it a little and put it in my paper. This is the pseudocode I want ...
1
vote
1answer
364 views

Add line before Begin algorithm 'Début' [closed]

This is a follow-up question to Option in the algorithm with Latex. This is my algorithm: \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm}[H] \caption{My algo} ...
7
votes
1answer
688 views

How to localize label using algorithm and algorithmic packages

I am writing a paper in Italian and I need to include pseudo code in my latex document so I am currently using the algorithm and algorithmic packages. At the top of every algorithm the label Algorithm ...
5
votes
2answers
485 views

Phantom malfunction in algorithm caption

I am trying to use \phantom in the context of an algorithm caption. I am using the algorithm and algorithmic packages. \phantom will work properly in normal text in my document, but not in a caption. ...
0
votes
0answers
38 views

Increase the indent in an algorithm [duplicate]

Possible Duplicate: Indenting lines of code in algorithm This is my algorithm: \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm}[H] \caption{My algo} ...
3
votes
1answer
2k views

Option in the algorithm with Latex

This is my algorithm: \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm}[H] \caption{My algo} \begin{algorithmic}[1] \STATE instruction 1 \STATE instruction 2 ...
1
vote
1answer
230 views

The option vlined with algorithm

Please i ask if it's possible to add the option: [vlined] withe the package \usepackage{algorithm} \usepackage{algorithmic} This is my example: \usepackage{algorithm} ...
1
vote
1answer
704 views

Increase Spacing in an algorithm

Please, how can i increase spacing in an algorithm, between instruction 1 et instruction 2 ? \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm}[H] \caption{My ...
5
votes
1answer
887 views

Package Algorithmic in French

I use \usepackage[section]{algorithm} \usepackage{algorithmic} to create an algorithm, I'd like to change "algorithm, begin, end while ..." to French. Is that possible? This is my example with ...
2
votes
1answer
262 views

Package algorithm to use

Please, what package can i use in latex to have the model of algorithm in the figure ?
1
vote
0answers
21 views

Translate the caption label “algorithm” in algorithm2e [duplicate]

Possible Duplicate: Renaming Algorithm to Heuristic in algorithm2e package i want to get the caption label "algorithm" translated into my language, so that the caption is like: Algorithmus ...
4
votes
1answer
211 views

Floatrow package causing missing algorithm lines

Hi I started using floatrow and noticed that it is breaking functionality of my algorithm code, both the algorithm header and footer have disappeared. Here is a picture of before and after: Here ...
3
votes
1answer
854 views

Generating a box inside algorithm in beamer

I would like to create two boxes (or two frames) and one arrow which goes from the center of right side of one box and do half a circle and point on the other box. Below is an example of code: ...
2
votes
0answers
263 views

\caption* does not work properly [closed]

I have a problem with using the command \caption* (from the caption package) together with the algorithm environment. Instead of parsing the \caption* as a single command, it is parsed like \caption ...
2
votes
1answer
1k views

Writing Pseudocode in LaTeX

I cannot seem to get any of the LaTeX pseudocode packages to work correctly on my computer. For example, if I run this block of code: \documentclass{article} \usepackage{algorithm}% ...
3
votes
1answer
182 views

Add label/link to a line of an algorithm

I am using the algorithmic package to write algorithms. I want to have a link to the line of the algorithm like I can do to formulas using \label and \ref.
5
votes
1answer
3k views

Indenting lines of code in algorithm

I am writting algorithm which has two stages. How can I indent code for stage one and for stage two? \begin{algorithm}[H] \caption*{my algorithm} \begin{algorithmic} \STATE \textbf{Stage one:} ...
2
votes
0answers
121 views

Is there an algorithm to determine the best layout and font size for a specific screen? [closed]

If I have a 4:3 7" tablet with a 200PPI screen (as an example), could you algorithmically make a TeX template that would be readable on the screen fullsize without zooming? It would be great if there ...
4
votes
2answers
677 views

program package ! Extra }, or forgotten \endgroup

I took the STY files(elsarticle.zip) from the following link - http://www.elsevier.com/wps/find/authorsview.authors/elsarticle#models I am using program package and I want to include the keywords in ...
3
votes
1answer
144 views

Runaway argument in algorithm

\begin{algorithm} \caption{Partial Sum Update Algorithm}\label{alg:usline} \begin{algorithmic}[1] \State $\mathcal{N}^*\gets$ bitreverse$(\mathcal{N})$ \If{$i(s)=0$}\Comment{The $s^{th}$ LSB in the ...
8
votes
1answer
2k views

Adjust the indentation whithin the algorithmicx-package when a line is broken

I have this code \documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm} \caption{Minimal Working Example for my Problem} ...
1
vote
1answer
110 views

Order of `float` and `caption` packages in preamble

I am using float and caption packages in my document, and also packages like tabularx, listings, algorithm... that (as far as I know) define floating elements or elements that have captions ...
2
votes
1answer
3k views

Functions with no parameters in algorithmicx

I am trying to write an algorithm using algorithmicxand I need to put a function with no parameters. I use \Function {foo}{} latex produces: function FOO However I need: function FOO() ...
4
votes
2answers
5k views

customizing the algorithmic package: break and loop labels

I would like to add two customizations to the algorithmic package: introduce a new break command and have the possibility to provide labels to the LOOP so that break {label} is clear to which loop is ...
6
votes
1answer
2k views

Creating sub-algorithms in latex using the algorithm package

I want to do something like this (see image below) where I can describe my algorithm in smaller steps or "phases" as this person calls them. I've used the algorithm and algorithmic package before but ...
6
votes
1answer
546 views

Reference algorithmic line numbers using cleveref

consider the following example: \documentclass[a4paper,final]{report} \usepackage{cleveref} \usepackage{algorithmic} \Crefname{ALC@unique}{Line}{Lines} \begin{document} Tests: ...
11
votes
1answer
5k views

algorithm numbering

I am having trouble numbering and referencing algorithms. I want to have the references labeled by the chapter, then within the chapter, such as: First algorithm in chapter 1 - Algorithm 1.1 ...
5
votes
1answer
4k views

How to change listing caption?

I have some listings that contain pseudo-code of algorithms. And I use this: \lstset{caption={Descriptive Caption Text},label=DescriptiveLabel} to add captions to them. My problem is that the ...
12
votes
2answers
1k views

Coloring lines in an algorithm

I am using Beamer for creating a presentation and I am trying to highlight some lines in an algorithm. I am actually using algcompatible. I found a solution here and created a couple of new commands ...
8
votes
2answers
3k views

Which package to use for writing algorithms?

I am looking for a package that will allow me to write pseudocode of algorithms. The pseudocode may include mathematical symbols, like \forall, \in and subscripts. But I would like also to "talk" ...
3
votes
1answer
346 views

How to get proof rules with pseudo-code in them?

I wish to typeset some deduction rules for Hoare logic as sequents with the pseudo-code using the algorithmic package. I have tried using \frac{}{}, but then e.g. if then else gets flattened. I have ...
1
vote
1answer
1k views

Using < > symbols inside algorithmic [duplicate]

Possible Duplicate: Why do the less than symbol (<) and the greater than symbol (>) appear wrong as upside down exclamation or question mark? I have the following code ...
6
votes
1answer
4k views

vertical space after algorithm

I am using the usual algorithm package for a paper. However, LaTeX puts too much vspace below algorithms. I have already reduced \floatsep, \textfloatsep and \intextsep but it does not seem to help. ...
3
votes
1answer
633 views

Pseudocode overflow out of column

I am writing pseudocode using the algorithmicx package in IEEEtran class (double column). My problem is, some of the statement in the code are quite long which I expected to wrap to next line. ...
5
votes
1answer
4k views

label in algorithmic

if I have this code \begin{algorithm} \label{alg:the_alg} \begin{algorithmic}[1] \STATE operation 0 \STATE operation 1 \end{algorithmic} \end{algorithm} I can make a reference to ...
1
vote
1answer
543 views

Algorithmic package for loop and comment at the same line

I want to have the following output using algorithmic package: for i = 1 : z do // number of rows x = 1 end for I use the following tex code: \begin{algorithmic} \FOR{$p=1:r$} // number of ...
5
votes
1answer
2k views

put two algorithm side by side

I want to put two algorithm side by side to gain place in the document, but when I use \documentclass{llncs} instead of \documentclass{article}, the following code does not work (errors): ...
3
votes
1answer
1k views

How to insert algorithm inside multicols environment [duplicate]

Possible Duplicate: Placing figures inside a two-column document Here is my MWE: \documentclass{article} \usepackage{multicol} \usepackage{algorithm} \usepackage{algpseudocode} ...
4
votes
1answer
1k views

Formatting algorithms to gain place in the document

I have two algorithms in a latex document using a class document of one column. The first algorithm take almost one page, and the second one is on the next page. Is there ant way to format this to ...
8
votes
1answer
2k views

Translate “Algorithm” in the caption

This is my code \begin{algorithm} \caption{Funkcija ACO} \label{alg:aco} \begin{algorithmic} \STATE{do something} \end{algorithmic} \end{algorithm} it produces a caption like this ...
2
votes
0answers
284 views

Drawing to indicate algorithms [closed]

I'm looking for one good drawing so as to symbolise algorithms. The idea is to use this drawing like one symbolic icon. Have you some ideas ?
5
votes
1answer
4k views

Algorithm Caption

I want algorithm to NOT show the number in caption. How can i do that? Below is the code: \begin{algorithm} \begin{algorithmic} \caption{ My Algorithm} \IF \ELSE \end{algorithmic} \end{algorithm} ...
6
votes
2answers
2k views

Algorithms package ignores caption package

I'm using the algorithms package in my document to get a floating environment for algorithms to live in. \usepackage{algorithm} I'm using the caption package to make the captions on my figures ...
14
votes
1answer
3k views

Mark a pseudocode block and insert comments near it

I am currently working on a LaTeX beamer presentation where I have to explain an algorithm. So I wrote this algorithm with \usepackage{algorithm,algpseudocode} This is the current algorithm: ...
5
votes
2answers
9k views

How to format for loop

I want to write a 'for' statement, but unsure how to do this with LaTeX. What I am trying to do is: for k = 1, k++, while k < i What is the proper (or at least a decent way) to write this in ...
8
votes
1answer
12k views

Algorithm and IEEEtran

I'm trying to write an algorithm in a IEEEtran LaTeX template and it doesn't work in any way. \usepackage{algorithm} \usepackage{algorithmc} %\begin{algorithm}[H] \begin{algorithm*} \caption{ASGP ...