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

learn more… | top users | synonyms

3
votes
1answer
128 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
45 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
90 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
16 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 ...
1
vote
0answers
81 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
214 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
32 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
37 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
63 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
78 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
63 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
166 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
56 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
135 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
119 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
64 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
96 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}{} ...
5
votes
1answer
836 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
383 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
72 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
89 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
133 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
281 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
464 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
634 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
788 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
2k 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
679 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
1k 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
220 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 ...
4
votes
1answer
360 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
52 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 ...
6
votes
1answer
9k 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
216 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
364 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
5k 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
466 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
458 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
70 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
263 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
42 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
267 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
173 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
3k 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
4k 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
3k 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" ...
8
votes
1answer
38k 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
328 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, ...