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

learn more… | top users | synonyms

5
votes
1answer
50 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). ...
5
votes
1answer
76 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, ...
5
votes
1answer
60 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 ...
2
votes
1answer
65 views

How can I define a ForEach loop on the basis of the existing ForAll loop?

Is there a way to define new command in algpseudocode based on existing one? In particular, in my document I need to use both \ForAll and \ForEach commands. It turns out that just renaming \ForAll ...
0
votes
0answers
111 views

(WYSIWYG) tools for typesetting pseudocode in LaTeX?

Is there a simple tool (preferably WYSIWYG) that can be used to create pseudocode for LaTex documents?
3
votes
1answer
105 views

Infinite loop with Algorithm2e

I'm using Algorithm2e and want a loop with no intial condition and no ending condition. Using Algorithmic, this can be achieved with \Loop ... \EndLoop, but I cannot find a similar loop for ...
5
votes
1answer
92 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" ...
3
votes
1answer
144 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 ...
3
votes
1answer
217 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 ...
2
votes
2answers
502 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?
2
votes
1answer
324 views

Self-defined Width of the Pseudocode Box with algorithmicx?

This post has beautifully shown how to make the algorithm pseudocode box as wide as one column or two columns. I am now writing a pseudocode with many if layers. So a one-column box cannot suffice. ...
4
votes
1answer
352 views

Questions about algpseudocode

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 ...
3
votes
1answer
173 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 ...
3
votes
1answer
250 views

How to add lstlisting to Algorithms List

I have written a document where I use pseudo code to describe some general algorithms (with \usepackage{algpseudocode} ) which can be viewed at the begining after toc as „List of Algorithms”. I also ...
1
vote
1answer
45 views

Avoid multiple occurrence of a multi-page algorithm in the list of algorithms

I have a pseudocode which spreads in multiple pages. I tried \algstore and \algrestore (as advised in Algorithm over 2 pages) and it allows multiple pages but it causes problem with \listofalgorithms ...
4
votes
1answer
5k 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 ...
2
votes
1answer
149 views

Line break inside procedure's definition with algorithmicx

I don't know if this package is the best for my purpose, but I'm using algorithmicx (see here the documentation) to write algorithms (in pseudcode) inside my work. At now, I've just a problem: ...
2
votes
1answer
307 views

pseudocode: functions within nested frames

I want to render my algorithm in a way, that the reader can see the functions within an extra frame like this: For writing the pseudocode I would prefer the algorithmicx package. Any advice is ...
8
votes
1answer
3k 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 ...
3
votes
1answer
330 views

How to break a pseudocode box between two pages [duplicate]

I am using the method here to generate my pseudocode, however my code is long and after running the tex file, instead of breaking the code box into two parts, it moves the whole code to the next page. ...
3
votes
1answer
358 views

Switch statement in LaTeX using package pseudocode

I am using \usepackage{pseudocode} in LaTeX for writing pseudocode. How to write switch statement using this package? I write more 90% pseudocode using the package pseudocode. In function Validate i ...
0
votes
0answers
69 views

Convert a latex document with lots of equations and pseudocode to Microsoft Word [duplicate]

I have a nice latex document with a lot of mathematical equations and pseudoalgorithms. Now I need to work out this document with a colleague that can only use microsoft word. So I need to convert ...
1
vote
1answer
200 views

Word count excluding certain environments

I would like a way to get a word count while ignoring certain environments. The reason for this is that I have quite a bit of pseudocode enclosed within multiple verbatim blocks. Ideally, a solution ...
0
votes
0answers
40 views

writing part of a pseudocode [duplicate]

I have a few pseudocode lines like for each item in list L if (item > 50)| (item > 50)|(item > 50) value=item break; Obviously, this is not the exact code :). If I use a package ...
3
votes
1answer
196 views

Align pseudocode comments to the left

Writing comments in pseudocode, I wanted to insert comments which are not aligned to the right side of the line which is commented. This thread helped me a lot. However, I want comments to stand ...
3
votes
1answer
148 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 ...
4
votes
2answers
2k 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$ ...
5
votes
1answer
2k 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 ...
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" ...
5
votes
1answer
23k 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.
3
votes
1answer
275 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, ...
1
vote
1answer
418 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 ...
6
votes
1answer
236 views

Advanced conditionals

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 ...
6
votes
1answer
9k 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 ...
1
vote
1answer
409 views

Long code that needs to wrap

How would I enter this text on an 8.5x11 worksheet with 1.25inch margins all around so wraps around and does not extend onto the margins? Using normalsize text. SolverAdd ...
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 ...
0
votes
0answers
134 views

Using tabular to align pseudocode? [duplicate]

Possible Duplicate: Print programs with its proper syntax Line Breaks in Text Mode not Working I need to write some pseudocode. I tried using the algorithimic package, but it introduced ...
3
votes
1answer
687 views

Line Breaks in Text Mode not Working

This is a follow up from my previous question I am writing a large document in LaTeX, part of which is giving me much grief. Specifically, I have described an algorithm in several numbered steps. I ...
4
votes
4answers
7k 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 ...
4
votes
2answers
2k 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 ...
9
votes
2answers
11k 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$} ...
0
votes
2answers
2k views

Problems with formatting LaTeX document pseudo code, ending while loops

I am writing a LaTeX document for some pseudo code I have written. I have a bunch of while loops, but the way latex is formatting them, it looks like: while(x) while(y) while(z) whereas I ...
3
votes
0answers
572 views

Pseudocode, special formatting [closed]

I want to write an algorithm in LaTeX. It's not any programming language, it is pseudocode with a very mathematical style. Furthermore it is divided in a main function and some subfunctions. I also ...
2
votes
2answers
1k views

How to make really pseudo pseudocode

Is there a way to do really casual peudocode in Latex? By casual I mean pseudocode that's more like a list of plain English steps, with occasional conditional/looping operators. I've looked at the ...
5
votes
1answer
5k views

Adding comments to pseudocode

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 ...
6
votes
1answer
798 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, ...
11
votes
1answer
4k 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 ...
10
votes
5answers
3k 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 ...
7
votes
2answers
4k 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 ...
17
votes
3answers
3k 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. ...