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

learn more… | top users | synonyms

0
votes
0answers
16 views

Adding a 'break' command to algpseudocode pseudocode

I want to add a \Break command to algpseudocode, which will display the word 'break' in the same font as 'return' is displayed. I've read the algpseudocode manual, but it only seems to explain how to ...
4
votes
1answer
52 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 ...
3
votes
2answers
29 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 ...
2
votes
0answers
50 views

How to write the signature of a method in LaTex?

I'm writing an article in LaTex about programming and I need to write the signature of a C++ method using a specific format, only the statement of the method, not the body. for example: void ...
0
votes
1answer
59 views

Latex pseudo code

I'm thinking to present some pseudocode in an article by using Latex, and ideally I would like to have something similar to what is shown in the figure below. I searched and tried out some packages, ...
0
votes
1answer
47 views

Custom pseudocode style

I want to write a custom pseudocode in latex in a similar style as the exemple below: . I didn't manage to get what I want using existing pseudocode package, is there another way to get this kind of ...
0
votes
1answer
49 views

Replicate pseudocode

I was looking for some LaTeX code to replicate the result shown on the image below. This image is taken from the book "Temporal Verification of Reactive Systems - safety"
1
vote
0answers
78 views

Expression-oriented pseudo code [closed]

I'm looking for a package that lets me write pseudocode in an expression-oriented way. Expression-oriented is a programming style that heavily uses expressions, as opposed to statements. Functional ...
3
votes
1answer
88 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 ...
0
votes
0answers
65 views

How to make reference to a codebox?

I am using the clrscode3e package to typeset pseudocode and I want to make reference to the procedures in codeboxes to produce something like "Procedure InsertionSort". How to do that? For example, ...
2
votes
1answer
59 views

Bigger rows with fractions in pseudocode

I had previous question how to write pseudocode in latex. I would like to use fractions in pseudocode, but rows with fractions are a little small. Anybody know how to make rows with fractions a little ...
1
vote
1answer
111 views

Define function in pseudocode

Could you help me please how can I write a piece of pseudocode with function in latex? \begin{algorithmic} \STATE $\mathrm{maxWeight} \leftarrow \mathrm{value of e.weight where e has maximum ...
0
votes
0answers
15 views

how to align one sentence if it is too long when using algorithmic package [duplicate]

I am using the algorithmic package to program the pseudocode in latex. But there is a problem. If one \State is too long, the sentence will be aligned to the left. It looks ugly. See this figure. ...
0
votes
0answers
85 views

Including Mathematica Code, in book type document

I want to include some Mathematica code in my tex file. For that I'm using this solution. As an example: \documentclass[12pt,a4paper]{book} \usepackage{graphicx} \usepackage{bm} ...
1
vote
1answer
69 views

How to make my comments in the code grey in the latex doc?

I have to insert some mathematica code in my latex document. For that, I'm using the answer given here by user Ronny. Is it possible to add sth that would make my comments look grey in the resulting ...
1
vote
1answer
229 views

Pseudo code algorithm not showing in a frame

I am using this code to show a pseudocode: \usepackage{algorithm2e} ... \begin{algorithm}[H] \SetAlgoLined \KwResult{Write here the result } initialization\; \While{While condition}{ ...
4
votes
1answer
3k 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 ...
1
vote
0answers
271 views

Formatting - Algorithm

I have following pseudocode: I want to write it as an algorithm but not able to format it properly. Following is my attempt: \documentclass{article} \usepackage{algorithm,amsmath,algpseudocode} ...
22
votes
3answers
634 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 ...
3
votes
1answer
171 views

Package algorithm

I am using algorithm package in order to create a pseudocode. But I would like to modify the way it appears some lines. Here is my code: \documentclass[twoside,12pt]{book} \usepackage{algorithm} ...
2
votes
2answers
126 views

Complicated Pseudocode in Latex - Need assistance

I am trying to create a complicated pseudocode as shown below: My attempt: \documentclass{article} \usepackage{algorithm}% http://ctan.org/pkg/algorithm \usepackage{algpseudocode}% ...
0
votes
4answers
866 views

Formatting in Latex - Pseudocode [duplicate]

I am trying to create a kind of pseudocode in Latex resembling the one shown below . What I tried is: 1. Convert R to a binary region using the threshold $\theta_{0}$\\ 2. Assume N is the sum of ...
0
votes
1answer
129 views

Package algorithmicx choking on line numbers

I'm trying to compile the code from this answer: http://tex.stackexchange.com/a/1376/35161 I keep getting the following error: ! Undefined control sequence. \ALG@cmd@2@alglinenumber ...size ...
4
votes
1answer
2k 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 ...
4
votes
3answers
292 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} ...
2
votes
1answer
199 views

Beginner: problems with algorithmic, some commands not available?

I am a real beginner in latex, and now I am struggling with using the algorithm package and algpseudocode to write some code. What I did until now is: \usepackage{algorithm} ...
1
vote
1answer
157 views

Changing indentation of pseudocode including line numbers with algorithm and algorithmic

If I have pseudocode as shown below using the algorithm and algorithmic packages, is it possible to indent the pseudocode, including the line numbers, so that it lines up with the indentation of the ...
2
votes
1answer
203 views

Problem in Algorithm Code [closed]

I am trying to complete my research paper in LaTeX but getting following three errors. I have tried so many things from the internet but to no advantage. Could any one help me please? 1) File ...
4
votes
1answer
467 views

How to define frequently used variables in pseudocode?

To generate the above pseudocode, I used the following code: \begin{algorithm} \caption{sample}\label{sample} \begin{algorithmic}[1] \Require $\mathbf{D} \in \mathbb{R}^{M \times N}$ \State ...
0
votes
0answers
22 views

Latex - after pseudocode =0 is added [duplicate]

I have some problems with using pseudocode in LaTeX. After I build the file =0 is added at the end of the file. Any suggestion how can I fix that? \documentclass{article} ...
1
vote
0answers
110 views

Algorithm Environment

I want to write an algorithm into my paper but it is just a pseudocode and none of the fancy if-then loops etc. Instead, I want it to look something like Algorithm 11.1 here: What environment ...
3
votes
3answers
189 views

Help me compile this code

\documentclass{article} \usepackage{amsmath} \usepackage{algorithm2e} \begin{document} \begin{algorithm} \caption{CAS}\label{CAS} {$\sum^{N_{C}}_{i=1}$$L_C$} $\gets$ position of ...
0
votes
0answers
12 views

Referring to a correctly-styled pseudocode procedure name from the main text [duplicate]

I'm using the recommended algpseudocode package, and have defined a procedure inside an algorithmic environment that I would like to refer to from the main text. Inside this environment, ...
2
votes
2answers
385 views

Undefined Control Sequence \For, \state, or \EndFor

I want to write this algorithm but the error Undefined Control Sequence \For, \state, or \EndFor pops up. \documentclass[titlepage,oneside,12pt]{article} \usepackage[]{algorithm2e,algpseudocode} ...
1
vote
1answer
301 views

Pseudocode in LaTeX [duplicate]

\documentclass{article} \usepackage{amsmath} \usepackage[noend]{algpseudocode} \usepackage{algorithm} \makeatletter \def\BState{\State\hskip-\ALG@thistlm} `\makeatother \begin{document} ...
1
vote
1answer
164 views

How can I compile this successfully?

I have to use algpseudocode package to improve my paper look like more professional But I can't compile successfully. \usepackage{amsmath} \usepackage{algorithm} \usepackage[noend]{algpseudocode} ...
3
votes
1answer
243 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 ...
2
votes
1answer
103 views

Disable Algorithm Label

I am using the \usepackage{pseudocode} in this code \documentclass{article} \textwidth=4.5in \textheight=7.125in \usepackage{pseudocode} \begin{document} \renewcommand{\thepseudocode}{} ...
6
votes
1answer
3k 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
1k 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
81 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
152 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 ...
1
vote
1answer
205 views

(WYSIWYG) tools for typesetting pseudocode in LaTeX? [closed]

Is there a simple tool (preferably WYSIWYG) that can be used to create pseudocode for LaTex documents?
3
votes
1answer
607 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 ...
7
votes
1answer
1k 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
1k 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
2k 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 ...
3
votes
2answers
6k 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
1k 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
3k 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 ...