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

3
votes
1answer
14k views

Smaller font size of the algorithm description?

\small or other tag seems can not change the font size of the line number. The package I use is \usepackage{algorithmic}.
5
votes
1answer
8k views

Recursive algorithms with the »algorithms« package?

I need to write a recursive algorithm, using the algorithms package. I thought of writing something like this: \begin{algorithmic} \IF {$x=1} \RETURN 1 \ELSE \RETURN recurse$(x-1)$ \ENDIF ...
2
votes
1answer
2k views

Adjust spacing of algorithm float caption

Background Using the algorithm package to display source code listings. Problem The LaTeX (LyX) code (test.lyx) is at: http://pastebin.com/QRWDhA7E An example graphics (query.png) file is at: ...
9
votes
1answer
9k views

How to add unnumbered lines in an algorithm?

I am typesetting algorithms with the algorithm package, and I would like to add unnumbered lines in them. Is there a way to create a \State* command, the same way there is an equation* environment? ...
4
votes
1answer
330 views

Adding a label on a margin (instead of line number) in latex algorithmic package

I would like to mark (e.g. with a *) a line in a pseudo-code typeset with the algorithmic package. I would like the label to appear on the left margin, instead of the line number. Is that possible? I ...
2
votes
1answer
68 views

Adding a label on a margin (instead of line number) in pseudo code

I would like to mark (e.g. with a *)a line in a pseudo code typesetted with the algorithmic package. I would like the label to appear on the left margin, instead of the line number. Is that possible?. ...
1
vote
1answer
227 views

What is the best way to typeset an algorithm with several procedures?

The title question sums it all.
7
votes
1answer
4k views

Hide closing statements for algorithms

I would like to generate an algorithm with the algorithmic package which does not show the annoying closing statements when I typeset it. I have done this before but have now forgotten how to do it. ...
13
votes
1answer
1k views

cleveref and algorithm2e

I'm currently working on a document where I was using algorithm+algorithmic along with cleveref. With this everything worked perfectly. Now I had to replace algorithm+algorithmic with algorithm2e. ...
0
votes
2answers
615 views

Package for displaying source code [duplicate]

Possible Duplicate: How best to include programming source code in LaTeX documents? What is a good way to display program source like c++/lisp code in a latex document?
8
votes
1answer
6k views

Set width of algorithm environment (preferably document wide)

Looking for a way to set the width of an algorithm environment, preferably document wide (as opposed to per-algorithm). Thought it should be fairly easy, but couldn't find a particularly good ...
1
vote
1answer
562 views

Apply a vertical rule beside graphics within Algorithm floats

Background Using LyX to write a book. The source code listings shown in the book are graphics. The graphics should have a vertical rule beside them. But only graphics that are embedded within an ...
4
votes
1answer
3k views

Override \centering to left justify an image

Background Dozens of source code snippets inserted into a document as images inside of Algorithm floats. Other images are screen captures, inserted as Graphics floats, to make a distinction. All ...
4
votes
2answers
2k views

Customizing “Algorithmic” or generating output of the same style

The algorithmic sample code that I am using is something like this: ‎\begin{algorithm}[h]‎ \caption{Caption Here‎.} \label{alg:Name} ‎‎ \begin{algorithmic}[1]‎ ‎\REQUIRE‎ ‎\ENSURE‎ ...
7
votes
3answers
7k views

Rename “Algorithm” to “Listing”

Background Syntax-highlighted source code image listings are being used as Algorithm floats with the lst: prefix for captions. Problem The following LaTeX code in the preamble renames the caption ...
18
votes
2answers
7k views

Floating an algorithm?

I'm typesetting an algorithm using the algorithmx package as follows: \begin{algorithm} \caption{\textsc{Whatever}} \begin{algorithmic}[1] ... \end{algorithm} However, I would like it to ...
6
votes
2answers
3k views

Number Algorithm floats with dependency (subalgorithms environment)

What I have: 3 algorithms, like so: \begin{algorithm} \caption{Caption One} ... \label{alg:one} \end{algorithm} \begin{algorithm} \caption{Caption Two} ... \label{alg:two} \end{algorithm} ...
6
votes
2answers
544 views

Which package for In-line and float algorithms?

I am using LyX to describe algorithms. A common scenario is that I have a snippet of pseudo code (in a float, for example) and a block of text which makes references to keywords in that pseudo code. ...
5
votes
2answers
3k views

algorithm package: Comment on “for” loop does not work?

It seems that \COMMENT in the algorithm package is broken. It gives an error when used in a FOR or FORALL line, so the first comment gives a compilation error: \begin{algorithm}[ht] \caption{My ...
9
votes
1answer
3k views

algorithmicx no listofalgorithms in contents section

I'm using algorithmicx to define some algorithms. It looks great, but I have one problem. When I use \listofalgorithms a page is created with the captions and links to the algorithms. However, there ...
3
votes
2answers
377 views

Is \algorithmicand a standard command in the algorithmic package?

I have a tex file created by someone else which redefines commands of the algorithmic package to translate them to the Portuguese language. For example: ...
1
vote
1answer
281 views

Create a keyword using the newalg package and algkey

I'm using the newalg package to typeset some algorithms, and I'd like to be able to typeset a keyword using the algkey macro. the problem is that I can't get it to work. Here's what I'm trying to do: ...
5
votes
1answer
442 views

Best solution to present school computing algorithm

I need to typeset some computing class algorithms like: Repeat Accept Roll_Number If (the Roll Number has already been added to the absent list) then Prompt”You have already added the roll number ...
80
votes
5answers
55k views

What is a good package for displaying algorithms?

I found this page with some examples: http://en.wikibooks.org/wiki/LaTeX/Algorithms_and_Pseudocode I'm wondering which one to use. Any suggestions? I'm using other packages too so whichever is less ...