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

1
vote
0answers
20 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
204 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
796 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
240 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
949 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
167 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
118 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
643 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
135 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
1k 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
108 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
502 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
3k 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
2k 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
334 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
595 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
502 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 ...
4
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
976 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
278 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
1answer
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: ...
3
votes
2answers
8k 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 ...
7
votes
1answer
11k 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 ...
0
votes
0answers
25 views

algorithmic, text after algorithm appears before it [duplicate]

Possible Duplicate: How to influence the position of float environments like figure and table in LaTeX? I am using algorithmic package. I have description of an algorithm in ...
0
votes
0answers
78 views

Alignment of multiline STATE in algorithm [duplicate]

Possible Duplicate: Include a line break in algorithmic while maintaining indentation I am using the algorithmic package to insert an algorithm in my paper. I have a long sentence after the ...
8
votes
1answer
3k views

IEEE-Template: Algorithm over both columns

I'm currently working on a paper using the IEEEtran template. I do have a pseudocode I would like to put into this paper. In a former paper I saw that it is possible to put this algorithm in a box ...
1
vote
0answers
526 views

Problem using package 'algorithmic':: LaTeX-Result: 0 Error(s), 0 Warning(s), 0 Bad Box(es), 0 Page(s) [closed]

I am relatively new to LaTeX, and I am having problems with using the algorithmic package. Whenever I add the command, \usepackage{algorithmic} and try to build the document, the number pages ...
4
votes
1answer
4k views

Switch cases in algorithmic

How can I use switch cases in algorithmicx? For example a code like this: switch s do --case a ----assert(1) --case b ----assert(0) etc. Is is possible to define it as a command?
13
votes
1answer
2k views

Is it possible to have connecting loop lines (like algorithm2e) in algorithmic?

I am using the algorithmic package to typeset an algorithm. I would like to have connecting lines between the beginning and end of a loop or conditional like in the algorithm2e package. Is there an ...
1
vote
0answers
43 views

install package on linux [duplicate]

Possible Duplicate: Where do I place my own .sty files, to make them available to all my .tex files? I downloaded "algorithmicx" package and I want to add it to my latex search path on ...
5
votes
2answers
4k views

Horizontal line in Algorithmic Environment

I'd like to separate two sections in an algorithmic environment with a horizontal line, like: ------------- Algorithm 1: MyAlgorithm ------------- Part 1: Do some stuff ------------- Part 2: ...
5
votes
2answers
5k views

“For” loop without “do”; “if” statement without “then”

How can I get rid of the do in a for loop and the then in an if statement when typesetting algorithms using the algorithm and algorithmicx packages?
4
votes
1answer
2k views

Vertical lines for blocks of pseudocode [duplicate]

Possible Duplicate: Linebreak in Package algorithm2e Is it somehow possible to generate vertical alines that connect the start and end of a block in algpseudocode (as provided by the ...
7
votes
1answer
18k views

including algorithms in latex

I am using the \usepackage{algpseudocode} \usepackage{algorithm} packages and creating a sample algorithm using the \COMMENT, \IF, \ENDIF and \FOR constructs. When I compile this and view the PDF ...
11
votes
2answers
2k views

How can I put a curly brace inside an algorithm to group code lines?

I am using the algorithmic package (or even algorithm2e is fine). Is it possible to use curly braces to group some lines in the algorithm so as to be able to put an explanation to the right?
4
votes
1answer
2k views

Algorithms \And boolean operator casuing “Undefined Control Sequence” error

I'm writing some algorithms using the algorithmicx package. I'm trying to create an if statement with an And boolean operator but using \And is causing an Undefined Control Sequence error ...
4
votes
2answers
1k views

algpseudocode without visible EndIf

I have the following chunk of code \begin{algorithmic} \State $\mathit{FlatMask}(c)=0$ \If{$\mathit{Inc1}(c)>0$} \State $\mathit{FlatMask}(c)\;+\!\!=2(\mathit{Inc1}(c)-1)$ \EndIf ...