algorithmic is an environment for typesetting {algorithms}.

learn more… | top users | synonyms

0
votes
1answer
21 views

How to write an algorithm in french? [Errors]

I am trying to write my algorithm in french language. I found this solution which works for me but with errors. The errors are: \algorithmicendelsif undefined \algorithmicendif undefined ...
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} ...
4
votes
1answer
37 views

spacing problem for more than three algorithms in one page

I use algorithm and algpseudocode package. Problem is, when I tried to start the fourth procedure\function, the fourth one starts in the middle of the next page instead of right below to the third ...
0
votes
0answers
24 views

Algorithm problem in poster with tikzposter

I am creating a poster using tikzposter. But it seems to have a bug with algorithm packages. I use the following code but the borders of algorithm block span to the whole width of the poster: ...
2
votes
2answers
36 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} ...
4
votes
1answer
40 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
0answers
41 views

How can I mimic the style of 'algorithm' in an 'lstlisting' environment?

In my LaTeX document, I have an algorithm added using algorithm and algorithmic: \documentclass{article} \usepackage{graphicx} \usepackage{apalike} \usepackage{setspace} \usepackage{amsmath} % ...
2
votes
3answers
52 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 ...
3
votes
1answer
110 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...." ...
1
vote
0answers
32 views

connecting loop lines in algpascal?

I am using the algorithmic package to typeset an algorithm. I would like to have connecting lines between the beginning and end of a loop or conditional in algpascal package. in this link enter link ...
2
votes
1answer
1k views

! LaTeX Error: Something's wrong--perhaps a missing \item

I am using TEXMAKER. Here is a code segment. \usepackage{algorithmic} begin{algorithmic} \FOR {$i\gets0$ to $n$} \do \FOR {$j \gets$0 \TO $min(i,k)$} \do \IF {$j=0$ \OR $j=i$} ...
5
votes
1answer
392 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
114 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. ...
6
votes
2answers
475 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} ...
1
vote
0answers
18 views

Indentation lines in algorithm package [duplicate]

I am using the algpseudocode and the algorithm2e package, and want the lines down below the indents like below (the example on the algorithm here). Does anyone know how to achieve this easily?
8
votes
1answer
81 views

Suppress line numbers in front of 'repeat' and 'until' keywords in algorithmic

Here is my minimal example: \documentclass{article} \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm} \caption{Test} \begin{algorithmic}[1] \REQUIRE ...
3
votes
1answer
284 views

Algoritmic return command = 0

Can you suggest me what is wrong with using return command in algorithms. when I add \RETURN $C to my LaTeX document I get return C =0, what I need is just return C. \begin{algorithm} ...
5
votes
1answer
278 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" ...
2
votes
2answers
1k 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?
3
votes
1answer
102 views

Left alignment in the algorithm and reset the numbers

I'm using algorithmic package and I would like to have certain text be left aligned. Also, would like to reset the numbering for each line inside the algorithm after certain text. The MWE provided to ...
4
votes
1answer
847 views

comment in algorithmic on a line beginning with if

I'm working with algorithmic to create some pseudo-code with comments. With a macro found on this site (see header), comments will be aligned on the right, which is wonderful. However, I don't get it ...
2
votes
1answer
75 views

How to remove \BODY defined in the algorithmic package?

The algorithmic package defines a command \BODY which evidently clashes when used in conjunction with the environ package. More specifically, LaTeX failes to compile when an algorithmic environment is ...
6
votes
1answer
154 views

Conflict between arabtex and algorithmic

Below is a minimal working example which recreates the problem I'm facing. \documentclass{article} \usepackage{algorithmic} \usepackage{arabtex} \begin{document} \section{Introduction} \RL{d} ...
3
votes
1answer
896 views

Placing a single algorithm in two columns

I have a single-column document and to save space I would like to make a long algorithm (produced using packages algorithm and algorithmic) to be double-column. That is, I would like the float content ...
0
votes
0answers
31 views

Spanning a procedure of an algorithm more than 1 page [duplicate]

I am unable to do this in LaTeX. Please help. And people who have marked this as duplicate, please mention the link to the question as I could not find any.. \begin{algorithm} \begin{algorithmic} ...
3
votes
2answers
138 views

Divide algorithm in two parts without incrementation of version

This is my code: \documentclass{article} \usepackage[paperheight=6\baselineskip]{geometry}% just for the example \usepackage{algorithm} \usepackage{algcompatible} \begin{document} ...
3
votes
1answer
562 views

Array inside Algorithm with underbrace and sidebrace

I'm writing my master's thesis (using LyX's thesis template) and am trying to display an algorithm. Since LyX's algorithm support doesn't quite cut it for me, I've decided to go ERT with LaTeX code ...
4
votes
3answers
3k views

Use algorithmic in LyX

I'm used to using the algorithmic package in LaTeX, but don't see an easy way to use it in LyX. I even tried this, but it didn't work. Further, it required me to change my document type, which is a ...
1
vote
1answer
95 views

How to define new loops in algorithmicx?

How can I define a new loop in algorithmicx? For example, code like this: ex1) PreLoop s do --statement1 --statement2 ex2) PostLoop s do --statement1 --statement2 Is it possible to define it ...
2
votes
1answer
413 views

Colors in Pseudocode matlab style

How do I get colours and more control over spacing in the algorithmic package like this: I tried this which looks good, but has numbers: \begin{enumerate} \item Create the cumulative sum of ...
1
vote
2answers
3k views

How to put \algorithm and \algorithmic environments inside a box?

I want to put an algorithm inside a box. Here is the code \fbox{\parbox{0.8\linewidth}{ \begin{algorithm} \caption{My algorithm} \begin{algorithmic}[1] \scriptsize ... \end{algorithmic} ...
1
vote
1answer
8k views

ELSE IF in algoritmic package

Is there a command in algorithmic package which is similar to \ElsIf in algorithmicx? ( I do not want each nested if to be indented).
4
votes
1answer
2k views

How can very long algorithms be automatically split over multiple pages?

I have a very long algorithm than spans several pages. I can not get Latex to make it span across several pages. I know that several questions similar to this one have already been asked, but I ...
4
votes
1answer
2k views

Unnumbered lines in algorithm

My question is similar to this one, I need to skip number for some lines of the algorithm. However the solution from that question does not work for me. How can I disable numbers for some lines using ...
4
votes
1answer
673 views

Alignment in algorithmic environment

I don't like how there is often a slight misalignment between assignment statements in an algorithmic environment. For example, the first version of the algorithm given below looks strange to me. I ...
1
vote
0answers
161 views

Algorithmic: file ended while scanning definition of \ALG\typeout [closed]

I m trying to the given code given in here: Algorithm and IEEEtran, or some other examples. by \usepackage{algpseudocode}. But I am getting this error: ./algpseudocode.sty:12: file ended while ...
3
votes
0answers
341 views

typing in bold font in algorithmic environment [closed]

Is there a way to type some words in bold in an algorithmic environment? I want to have the word stop typed, but when I use \STOP, this gives me an error.
3
votes
1answer
73 views

Statement (\STATE) indentation in Algorithmic package

I have the following code, \documentclass[]{memoir} \usepackage[utf8x]{inputenc} \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{algorithmic} ...
5
votes
1answer
178 views

How to make the line number in algorithm shown in bold

I have tried following which works (making the number in second line bold) \begin{algorithm}[h] \begin{algorithmic}[1] \State TSO.assignStartTs() {\bf\State} TSO.assignCommitTs() \end{algorithmic} ...
4
votes
1answer
2k views

Ruled Algorithms in columns/minipages

I'm using Benoit Guillon's algo styles for Lyx (at http://bgu.perso.libertysurf.fr/) in 2.0 to get nice algorithms ruled with line numbers. This is just a wrapper for the algorithm and algorithmic ...
2
votes
1answer
1k views

Make List of Algorithms formatting match LOT/LOF

I'm working on my thesis, and I have a minor formatting problem with my list of algorithms. The entry is added properly in the TOC and the font, size dotting and numbering are perfect, but for some ...
5
votes
2answers
5k views

“For” loop without “do”; “if” statement without “then”

How can I get rid of the do in a for loop and the then in an if statement when typesetting algorithms using the algorithm and algorithmicx packages?