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

1
vote
0answers
105 views

How to convert latex algorithm2e into msword format [closed]

I need to write below latex algorithm using windows words, How I can do that? \documentclass{article} \usepackage[linesnumbered,ruled,vlined]{algorithm2e}% http://ctan.org/pkg/algorithm2e ...
1
vote
1answer
38 views

Justifying code according to corresponding elements indentation [duplicate]

How do I justify my comments as to inner for loop indentation in the below code: \documentclass[a4paper]{article} \pagestyle{empty} \usepackage{algorithm} \usepackage{algpseudocode} ...
4
votes
1answer
139 views

Algorithmic: Put If and EndIf into same line

I use the algorithmic package to create a pseudo-code-source in latex. I have a source with many short if-statements. The fact that the END (from EndIf) is put in a new line every time leads to a ...
0
votes
1answer
223 views

How to properly format pseudocode (algorithm) in LNCS (Lecture Notes in Computer Science)?

I know that when I need to paste the source code, I should use \verb or \verbatim. But how about pseudocode\algorithms? Should I use \verb or \verbatim as well? Can't really find any official Springer ...
4
votes
1answer
174 views

Can the coding style of the algorithm environment be modified?

I'm using the packages \usepackage{algpseudocode} \usepackage{algorithm} to produce a pseudocode of the following algorithm: \begin{algorithm} \centering \caption{Octree based search ...
2
votes
3answers
68 views

Place two algorithm into two column

I have single column page. I would like to add my two algorithm into two column. How can I do this? My algorithms are below. \begin{algorithm}[h] \caption{Resolve 1} \begin{algorithmic} \scriptsize ...
6
votes
1answer
257 views

How to align comments in algorithm code?

I will to align comments in another column, package algorithm. (Similar question: Faulty right alignment for comments in algorithmic package), but I will to become that result: ...
6
votes
2answers
122 views

Remove top rule from algorithm package

How can I remove only the top rule, which is above the caption, from the algorithm package? So not the two rules which are above and below the algorithm. I borrowed the mini example from: ...
3
votes
0answers
109 views

Object-oriented class typesetting? [closed]

I am looking for a way to beautifully typeset an OO class like : classname { properties: prop1 : integer prop2 : Node methods: someMethod() } With the look ...
7
votes
2answers
123 views

algorithm with partial borders/frames

I use the algorithm float environment for pseudocode and want some algorithms to span two pages. That works fine with \algstore and \algrestore. However, I would like to omit these borders at the end ...
0
votes
0answers
98 views

What package(s) are recommended for making algorithm block diagrams in LaTeX?

I am in the process of writing a conference paper for IEEE, and I was wondering what packages might be recommended for making good looking (but simple) block diagrams for algorithms? I am relatively ...
0
votes
0answers
36 views

What´s the easy way to put algorithms? [duplicate]

I was trying with algorithm2e , and I had a little problems, LATEX is so complicated and so tedious. The results are excelent, but... the time and effort is BIG BIG! What´s the easy way to describe ...
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}{} ...
1
vote
0answers
57 views

Reduce space below an algorithm

I am using the algorithm package for my algorithms in the paper. I find that the space below the algorithm is very large after generating a PDF, so I want to shrink the space. Firstly, I come to add ...
3
votes
1answer
132 views

How to write sentences in an algorithm in latex?

Hi I am trying to write an algorithm which looks something like the image below: I was wondering how to write the "Step 1 (Update)" and also the rest of the line which says "When an edge e...." ...
6
votes
1answer
91 views

What conventions or packages are appropriate for formatting records, algebraic data types in LaTeX?

LaTeX formatting practice is well-established and well-supported by existing packages for three common cases relevant in computer science: Source code listings Established, conventional mathematical ...
3
votes
1answer
27 views

can not reference a state in algorithm

I have the following code that generated error ! LaTeX Error: Something's wrong--perhaps a missing \item. l.193 \STATE \label{alg:line3}Sort NGs in CDR in ascending order based o... ...
3
votes
1answer
298 views

flow chart page size issue

I have been doing this since from last month. I want to draw this flow chart using \documentclass[a4paper,11pt]{report} but if I use above configuration (which I want to use) the flow chart does ...
2
votes
0answers
65 views

How to complete the algorithm using algorithm2e

I wanted to write this flowchart using \usepackage[linesnumbered,ruled,vlined]{algorithm2e} However, I couldn't get what I want, please refer to my code in below \begin{algorithm} ...
1
vote
1answer
47 views

Possible to put an algorithm inside a \begin{itemize}?

Is it possible to put an algorithm inside a \begin{itemize} as one of the \items?
6
votes
2answers
104 views

Text below line at end of algorithm?

I am using the algorithm and algpseudocode packages. When I define an algorithm it ends with a horizontal line. I would like to have some text below this horizontal line explaining some special case ...
5
votes
1answer
197 views

Still some of the flows missing in the flowchart

I have posted this question few days back but still I can't complete the algortihm. This is the uncompleted work done so far \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} ...
1
vote
1answer
141 views

Code is a mess because I cannot indent inside a for loop in my algorithm

I have a for loop in my algorithm and I can't get latex to properly indent the pseudocode inside it. It's just a mess at the moment, it won't even put the code in the for loop on separate lines. ...
3
votes
1answer
113 views

Rename algorithm caption

How to rename algorithm caption name from Algorithm to some name. This is my code: \documentclass[oneside,a4paper , 12 pt, titlepage]{book} \usepackage{algorithmicx} \usepackage{algorithm} ...
3
votes
1answer
118 views

Reduce vertical space after list of algorithms' title

I would like to control the spacing after and before the list of algorithms title to fit all the algorithms in one page. ...
3
votes
1answer
382 views

How to use latex commands to draw a flowchart

I have to write a flow chart given by figure below I have used the packages, \usepackage{tikz} \usetikzlibrary{shapes,arrows} But I couldn't get what I want. I hope some LaTeX experts here can ...
5
votes
1answer
57 views

Referring to correctly-styled algpseudocode procedure name in document

Given an algorithm written in algpseudocode: \documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm} \caption{Part 1} \begin{algorithmic}[1] ...
6
votes
1answer
1k 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). ...
3
votes
1answer
133 views

Algorithm : Command \end{list} invalid in math mode

I just started with Latex and I struggle a little bit with algorithm. Here is the algorithm, I try to show. But on the line of the first ENDFOR, I have this error Latex Error: Command \end{list} ...
3
votes
1answer
331 views

Why this 'Perhaps a missing \item' error with the algorithmic package?

I am trying to imitate an example I found in the LaTeX wikibook to write my own algorithm using the algorithmic package. I can't understand it clearly, though, and I am getting errors all the time. ...
5
votes
1answer
157 views

How to reduce indentation size within loop of an algorithm

For the following algorithm, I get four spaces for each text line inside the loop. How can I get only two or three spaces? Some of my text lines go to next line. I want to save some horizontal spaces. ...
2
votes
1answer
115 views

latex line number in algorithm starting with 9? [closed]

I feel confused why the line numbers in the algorithm I created all starting with 9? The code is as followed: \documentclass{sig-alternate-2013} \begin{algorithm} \caption{Generating Test Cases} ...
3
votes
2answers
100 views

Fixing the location of the appearance in algorithmicx environment

I'm trying to force an algorithm to stay between two paragraphs, but after compilation, it shows up in the next page. My algorithm takes more than half a page and is something like: ...
13
votes
1answer
29k views

Write pseudo code in latex

I am trying to write pseudo code in my paper. Here is the snippet and image like what I want. Can some one please help me to format it. \begin{algorithm} \caption{Euclid’s algorithm}\label{euclid} ...
5
votes
1answer
240 views

change “Algorithm 1:” to “Algorithmus:” in algorithm package

I am using the algorithm package and I need my algorithm to be labeled as "Algorithmus: XYZ" instead of "Algorithm 1: XYZ" where XYZ is my caption for the algorithm.
1
vote
1answer
501 views

Writing algorithms in pseudocode in latex

Why if I write : \State \textbf{upon event $< Init >$ do} \For{\textbf{all $n$} $\in N$} \State $value[r]=0$; \EndFor I have this output: but I want: How ...
4
votes
1answer
2k views

algorithm2e comment style

I wanted to know how to change the comment style in the algorithm2e package. I want to make my comments of a smaller font and a different color: \documentclass{article} \usepackage{color} ...
4
votes
1answer
239 views

Change algorithmicx caption name

I am trying to change the Caption name of Algorithmicx but it doesnt work. This what i include to use it. %pseudocode \usepackage{algorithm} \usepackage{algorithmicx} \usepackage{algpseudocode} ...
0
votes
0answers
23 views

Create an indent in an algorithm (without using the algorithm environment) [duplicate]

So I'm trying to create an indent in an algorithm, but I'm not familiar with the \begin{algorithm} environment, so I would just like to do it in a math environment. I'm trying to create an indent, but ...
5
votes
1answer
475 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, ...
1
vote
3answers
252 views

Aligning Equations in LaTeX

I was trying to align the following equations but alas. Could someone guide? \begin{flalign} x \in A \cap (B \cup C) & \Rightarrow (x \in A) \lambda \Big( (x \in B)\vee(x \in C) \Big) & \\ ...
5
votes
1answer
141 views

Customizing some aspect of algorithmic environment

I'm using the algorithmic environment for typesetting algorithm in my document, but I'd like to customize some aspect and fix problems. I'm using the algpseudocode package with noend option, but it ...
7
votes
1answer
232 views

How to remove end-if in algorithms

I am writing an algorithm in latex, but there are lots of end-if and end-whiles in my algorithms which makes it un-professional and ugly. Is there a way to remove them from output of latex? ...
0
votes
0answers
45 views

Increase algorithm distance to margin

I've been using \vspace to increase or decrease the vertical distance of figures to the margin, but I found out it doesn't work inside and algorithm evironment. Is there an alternative or workaround ...
6
votes
2answers
513 views

How to make “for all xxx do” appear on one line?

This is an example \documentclass[12pt,oneside,a4paper,onecolumn]{article} \usepackage{graphicx,color,setspace,hyperref} \usepackage[left=1.5in,top=1.25in,bottom=1.25in,right=1.25in]{geometry} ...
4
votes
1answer
291 views

Algorithm input in a box

I am trying to write pseudo code \documentclass[a4paper]{article} \usepackage[english]{babel} \usepackage[utf8x]{inputenc} \usepackage{amsmath} \usepackage{graphicx} ...
7
votes
1answer
162 views

Description of algorithm in words

I would like to write an algorithm in a very verbose matter. I want to write a couple of for loops and the rest is pretty much text. I include here the code I am using with algpseudocode imported as ...
6
votes
1answer
1k views

Algorithm: write if-then-return or else-return in one line?

I can easily generate the following algorithm statements using algorithm2e package. As can be seen from the image, return statement (should hold for other statements too) will be placed in a new line ...
4
votes
2answers
120 views

Algorithmicx multiple statements per line aligned over all lines

I would like to put a <- b and e <- f, in parallel on a single line in an algorithmicx environment. I want the same with c <- d and g <- h. Then I want to align both lines. The output ...
0
votes
0answers
67 views

last line of algorithms ends with =0 [closed]

I wrote some algorithms on shareLatex, but when compiling the document, each algorithm ends with =0 for example: End If=0. and so on what I have to do to avoid this problem. I use these packages: ...