# Tagged Questions

{pseudocode} is a compact and informal description of a computer programming algorithm.

62k 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 ...
929 views

### How to write pseudocode similar to code presented in “Beautiful Code” by J. R. Heard

I came across an astonishing piece of text, which is called "Beautiful Code, Compelling Evidence" by J. R. Heard. I was wondering if there is a package or something that allows me to present my code ...
113k views

### How to write a not equal to sign in Latex pseudocode

How do I write not equal to sign (equivalent of != in C) in Latex pseudocode.
4k views

### Listings, Literate Programming, and Beautiful Typography

Now that I'm procrastinating with tweaking LaTeX, instead of finishing my Ph.D. thesis, I'm wondering what's the most beautiful way to typeset source code (C#, C++, LISP, XML, BNF) in LaTeX. Currently,...
7k views

### Bitwise operator in pseudo-code

I am translating a C++ program into pseudo-code using the algorithmicx package. Do you know how I can represent the C bitwise operator like the shifts (<< and >>) ? Until now I used power of 2 ...
27k views

### Beamer and pseudocode

I am preparing a presentation with beamer from a previous paper written in latex. I want to insert in a slide the pseudocode \begin{algorithm} \begin{algorithmic}[1] \FOR{$i=1$ to $N$} \FOR{$j=1$...
9k views

### Pseudo code to be spread over multiple pages?

I am writing pseudo code in the algorithmic environment. It is quite long and doesn't fit on one single page. Instead of it continuing on the next page, it is cut off. I tried inserting it into a ...
7k views

### How do I add a blank line in the algorithmic environment?

I'm trying to learn the algorithmic package for typesetting pseudocode. One problem I'm running into is that I can't figure out how to insert blank lines, to separate blocks of code. The usual \\ or ...
20k 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 ...
17k 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 ...
31k views

### do-while loop in pseudo code

The algorithmic package lets me make a while loop as \begin{algorithmic} \While{$u\neq v$} \State Something \EndWhile \end{algorithmic} which results in a while(u is not v) do ...
10k views

### What is the best looking pseudo code package?

I have stumbled across various pseudo code packages but can't seem to find that's simple and eye-candy and practical. What I'm looking for: Visually attractive structure (eye-candy) ( easy to look ...
5k 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" ...
23k views

### How do you add a comment to pseudocode in LaTeX?

Is there a special formatting to add comments to code? I mean I want to show comments in pseudocode that I write in LaTeX. this is code // this is comment part (the part that I want) Edit: To be ...
13k views

### Pseudocode: \Function vs. \Procedure?

The title says it all. What is the difference between a Function and a Procedure? When should I use which?
7k views

### Using Beamer to step through an algorithm written in pseudocode.

I am trying to create a beamer presentation in which I would step through an algorithm, highlighting the current line in the algorithm on each slide. I know it is possible to do with the semiverbatim ...
2k views

### Faulty right alignment for comments in algorithmic package

I'm trying to right align comments in a pseudocode environment using the algorithmic package. So I renewed the algorithmiccomment command. There's a different way to create comments for "normal" ...
12k views

I would like to find a pseudocode package that support the possibility to wrote a comment at the right side of a if and that it wont be between { } but rather at the right side of the page, after a ...
18k views

### How to format a pseudocode algorithm

I would like to know how to format a pseudocode algorithm like the one shown in the picture below. I would like to see an example of Tex/Latex code that would mimic the style, formatting and design of ...
8k views

### Undefined control sequence \State \For \While

I am trying to write a pseudo code in MiKTeX. I have used \usepackage{algorithm} \usepackage{algorithmic} but I get: Undefined control sequence' for every structure (\State, \While, \For, \If). ...
390 views

Is there some way to create more advanced conditional statements that can evaluate a logic expression and decide what to do based on the value of the expression? For example like in the following very ...
1k views

### Line numbers in pseudocode in figures - using lineno in figures

can someone show an example how to obtain line numbers in the alltt environment in figures, possibly using the lineno package? I've tried: \begin{figure}[h] \begin{alltt} {\linenumbers def insert(k, ...
6k views

### Putting pseudocode in a framed box

I added some pseudocode to my document in this style: \usepackage{algpseudocode} \begin{algorithmic}[1] \If {$i\geq maxval$} \State $i\gets 0$ \Else \If {$i+k\leq maxval$} \State $i\gets i+k$ \...
5k views

### How may I remove \EndIf and \EndFor in algorithmicx?

For space consideration, I wish to condense my pseudocode. I find it a bit annoying to me to always have a \EndIf or \EndFor at the end of every block, especially when inside the block only lies one ...
391 views

### How can I get straight quotes in pseudocode?

The quotes in pseudocode currently look like this: How can I get quotes that look more like a programming environment and less as if I just typed it with MS Word? MWE \documentclass{article} \...
5k views

I'm using the following packages: \usepackage{algpseudocode} \usepackage{algorithm} but I don't understand what package is algpseudocode, since I can't find the documentation. I have followed this ...
3k views

### Problems with \EndIf and \EndFor

I'm using the algpseudocode package and I want to write a pseudocode. This is my code \documentclass[conference]{IEEEtran} \usepackage[spanish, es-tabla]{babel} \usepackage{graphicx, times, amsmath, ...
89 views

### Should a code sample be followed by a punctuation to conform to the language grammar?

Let's say I have the following text: The first program a computer science student sees is usually program HelloWorld(output); begin WriteLn('Hello, World!'); end. or 10 PRINT "Hello ...
6k 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 \...
567 views

### How to export vector images from TeXworks

I use TeXworks to write pseudo-codes. How can I export the codes into a vector image such as in .emf? The image should have a size fit for the codes. For example, if the codes only takes half page, ...
76 views

### Program package confliction

I want to write pseudo-codes in my survey using program package. Since I'm writing in other languages rather than English, I have to alter the names of those environments, like theorem and proof, etc (...
9k views

### do-while loop in algorithm2e

I am using \usepackage[norelsize, linesnumbered, ruled, lined, boxed, commentsnumbered]{algorithm2e} \RestyleAlgo{boxruled} It seems that algorithm2e has the default repeat-until construct. But I ...
1k views

200 views

### Replicate pseudocode format

I have to include algorithms in a paper and they must appear as follows: [A] X ← X-1 Y ← Y+1 IF X ≠ 0 GOTO A so I am trying to replicate this exactly, exploring some new ...
112 views

### Forcing algorithm2e to typeset using Times New Roman

I am writing a book using a sans serif font, and I have a need for typesetting pseudocode. The pseudocode, however, is typeset with sans serif font as well, yet I need the Times New Roman for that ...
410 views

### Package to use for documenting a struct

There exists a number of pseudo-code packages for LaTeX. Can any of these describe things like a linked-list node in C: struct Node { Node* parent; // other stuff }; or do I have to invent ...
538 views

### algorithmicx or algpseudocode custom command indentation within a while loop or if statement

I have been trying all day to set-up the commands necessary to represent the Haggis pseudocode format using the algorithmicx package in Latex. I have managed to create the commands I need for the ...
3k views

### Reduce the line number font size of pseudocode?

I have learned from here on how to reduce the font size in the pseudocode. The last thing left for me is to reduce the line number font size as well. The following is my MWE, and it seems that \...
426 views

### Which pseudocode package produces this output?

I'm reading a computer science paper right now and I really like the way the pseudocode is displayed. I'm unsure, however, of what pseudocode package this is. Any help would be appreciated. An image ...
77 views

### Repeat block without until (or blank line) using algorithm2e

I'm trying to format a "repeat forever" block using algorithm2e. I've found the \Repeat command but this prints an until at the end of my block. I can hide the word until using: \SetKwRepeat{Repeat}{...