algorithmic is an environment for typesetting {algorithms}.

learn more… | top users | synonyms

4
votes
0answers
15 views

LyX: Can't compile with \usepackage{algpseudocode} with Language that isnt English

im pretty new to LyX and Latex. Im writing a paper in Hebrew and I want to add an algorithm in English. So i'm adding \usepackage{algpseudocode} to the Preamble and pasting some example algorithm. ...
4
votes
1answer
18 views

Place comment after while statement in algorithmic

I am having some trouble placing plain text in my algorithm using the algorithmic package. The problem only seems to occur after a '\WHILE' command. I need to start my 'while' loop, then immediately ...
1
vote
1answer
31 views

Insert indent in algorithm at line break of the same \State

I have the following code: \documentclass[12pt,a4paper,twoside]{book} \usepackage{graphicx} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm*}[t!] ...
2
votes
1answer
39 views

Why are vertical rules dashed sometimes with algorithmic package?

I would like to create vertical rules for indentation with algorithmic package. I applied the solution proposed here How can I create vertical lines indentation in algorithm pseudo code correctly ...
2
votes
1answer
49 views

If algorithm in Latex

I want to create a simple algorithm in my latex document. I have a variable which comes to my latex template from the web-form it can have just two values "yes" or "no", so in case if this value "yes" ...
2
votes
0answers
28 views

Is there a way to include an algorithm from external file?

I mean: when I put some code in my docs I can include it whitout writing all code in main document. Is there a similar thing for algorithm?
0
votes
1answer
62 views

Wrong number when reference inside algorithm

\usepackage{algorithm} \usepackage{algorithmic} \begin{algorithm}[tb] \caption{Algorithm} \label{alg} \begin{algorithmic}[1] \STATE blalblabla \label{cond1} \STATE ...
3
votes
1answer
41 views

Adding comment in same line and without sign

I use the following: \documentclass{article} \usepackage{algpseudocode} \usepackage{algorithm} \usepackage{textcomp} \usepackage{mathtools} \date{\today} \title{Some Title} \begin{document} ...
2
votes
1answer
40 views

Algorithmic package in two different languages in same document

I need to write both in French and English in my document (for reasons). And I need to write algorithms in both languages, using the algorithmic package. Is it possible ? If so, how can I do that ? ...
0
votes
0answers
34 views

How to illustrate vector operations in algorithm environment?

Is there a nice standard way to represent a vector, and things like vector creation, and operations like push_back, or add in the algorithm environment?
1
vote
1answer
90 views

Error in listofalgorithms, undefined control sequence in .loa file [closed]

I am trying to write a pseudo code in LaTeX, and want to list the algorithm in the \listofalgorithms. Using the following code, I can generate the pseudo code in pdf and also the algorithm is listed ...
1
vote
1answer
52 views

Indentation inside algorithmic environment [duplicate]

Consider the following snippet: \documentclass{article} \usepackage[textwidth=8.5cm]{geometry} \usepackage{amsmath} \usepackage{algorithm} \usepackage{algpseudocode} \usepackage{parskip} ...
2
votes
1answer
51 views

Writting Pseudocode by using package algorithmic

I have a questions, why give me a clear line at fourth line? Can i delete "statement" end while and end for? \begin{algorithmic} [1] \FOR{$j \gets 0$ \TO $n - 1$ } \STATE{$t \gets A[j]$ \STATE ...
2
votes
0answers
177 views

How to set algorithm width to avoid overfull \hbox problem

I wrote the following latex text, but the log shows an error that overfull \hbox(10.0pt too wide) detected. I am sure that the algorithmic part exceed the width limit. Even if I type a few words, the ...
1
vote
0answers
37 views

Put two algorithms in the same page one after the other

I want to put two algorithm on the same page and be able to change the size of two of them at the same time as they are in a box. I thought about \minipage but I am not sure how exactly I can do it.
1
vote
0answers
35 views

algorithmicx - How to change “Procedure” to “def”

I am using algorithmicx. It gives a block using \Procedure. However, I want to make my presentation of algorithms in python style, since I implemented it in python. In python, to define a function, ...
0
votes
0answers
44 views

How can very long algorithms be automatically split over multiple pages with a specific layout?

My question is related to this other question just published I have the same problem and I solve with your solution, removing {algorithm*} environment (which is a floating box, and boxes never ...
0
votes
0answers
84 views

How to insert a subscript in algorithm

I'm writing a pseudocode by algorithm package. Now I want to write a variable using a subscript: I would write something like var\ped{e} where var is the name of the variable and e is the subscript. I ...
0
votes
0answers
28 views

Why is this algorithm badly outlined?

I have the following algorithm in Latex using the algorithm and algorithmic package: \begin{algorithm} \caption{Play-N-Games algorithm} \label{alg:play} \begin{algorithmic} \State $Agent\gets Make ...
0
votes
0answers
79 views

Algorithm indent problem with sig-alternate document & algorithm(ic) package

Can anyone tell me why the indention of the algorithm does not work? I have the following code: \begin{algorithm} \caption{STEP 1} \begin{algorithmic}[1] \REQUIRE Something \FOR{\textbf{each} ...
3
votes
1answer
213 views

How to change font style of all algorithm/algpseudocode keywords?

In detail I want to change the font style of all keywords like If Return For to bold/sans serif, but only the keywords. MWE: \documentclass{article} \usepackage{algorithm} ...
0
votes
0answers
12 views

Algorithmic error: Missing \endcsname inserted [duplicate]

I have the following document: \documentclass[10pt,aps,pre,amsmath,amsfonts,amssymb,floatfix,longbibliography,superscriptaddress,notitlepage]{revtex4-1} \usepackage{amssymb,amsmath} \usepackage{bm} ...
2
votes
2answers
58 views

How to use multiple columns inside an algorithm, showing a step, and its complexity side by side

I would like to write my algorithm to multiple columns, showing a step, and its complexity cost side by side. Any idea on how to do it? Here is an example (not my document)
4
votes
1answer
187 views

Remove the colon from line numbering in algpseudocode

Is there a way to remove the colon (:) from the line numbering in algorithms (using the algpseudocode package)? \documentclass{article} \usepackage{algpseudocode} \begin{document} ...
0
votes
0answers
106 views

! LaTeX Error: Command \algref already defined

I amy trying to compile this pseudocode in my document but I am getting the error: ! LaTeX Error: Command \algref already defined. Or name \end... illegal, see p.192 of the manual. See the LaTeX ...
4
votes
1answer
39 views

Spacing between operators in IEEE document algorithms

I use the IEEE format and the algorithmic package. However, the spacing around binary operators in algorithms is too wide. attached screenshot: using this code: \documentclass{IEEEtran} ...
4
votes
2answers
174 views

Algorithm environment problem

I am doing my master thesis and need to include an algorithm into my LaTeX code. I have been trying for hours now, but I still have several errors that always show up. It is my first time using the ...
5
votes
1answer
144 views

Algorithms and amsart

Basically, I have copied the code from answer to this quesiton, for I have to translate some words. I have only changed documentclass from article to amsart. \documentclass[11pt]{amsart} ...
2
votes
1answer
138 views

Several errors in LaTeX algorithm environment

Hello guys i am new to LaTeX, i have written an algorithm in algorithm environment which is as follows: \documentclass{report} \usepackage{amsmath} \usepackage{algorithm} ...
0
votes
0answers
30 views

How to write “for” block with counter by Algorithmic package

How can I write a code like below using algorithmic package for (int i = 0; i < node.children; ++i) ..... I can't use foreach or forall because in a point inside the loop I should decrement i ...
1
vote
0answers
64 views

Error with algorithm and algorithmic packages

I have the following problem that involves the algorithm and algorithmic packages with the garamondx font. This is a minimal example: \documentclass[letterpapet,10pt]{article} \usepackage{garamondx} ...
1
vote
1answer
706 views

Algorithm nested for loops generate a blank line

%!TEX program = xelatex \documentclass{article} \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm}[] \caption{LDA} \begin{algorithmic}[1] \FOR{$d$} \STATE{ ...
3
votes
2answers
253 views

Wrap a few lines of Algorithmic in a box

I have some pseudocode where I want to reveal an algorithm little-by-little. Currently I highlight the code that is revealed by coloring it red and this looks good onscreen. However, on print, this ...
1
vote
1answer
74 views

Comment in algorithmic on a line beginning with if, and using uncover/visible

I am trying to modify this code, into the following one : \documentclass{beamer} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage[plain]{algorithm} \usepackage{algorithmic} ...
2
votes
1answer
294 views

Table of contents of algorithm and algorithm2e together

The contents of the algorithms thinks that an algorithm that uses algorithm is one algorithm and an algorithm that uses algorithm2e is another algorithm, not the second of what was imported with the ...
2
votes
0answers
198 views

writing Algorithm in Latex

I want a Latex code that will write the following algorithm using \begin{algorithm} and \begin{algorithmic}. I have done this \floatname{algorithm}{Procedure} ...
0
votes
0answers
15 views

Linebreak with algorithm environment in two column mode [duplicate]

I want to integrate an algorithm in a two column article, but I'm not happy with the output (screenshot below). I'm wondering why the algorithm environment don't break the code and go on the next ...
5
votes
3answers
131 views

Spacing issue with algorithmic and eqparbox

I am using the algorithmic package to display code. In order to get flush-right, left aligned comments, I also use the eqparbox package and redefine \algorithmiccomment; see minimal example below. As ...
36
votes
1answer
8k views

algorithm, algorithmic, algorithmicx, algorithm2e, algpseudocode = confused

I am getting confused about the package structure for writing simple "algorithms". There are too many options, and also got totally clueless about when to use what. Is there any definitive guidelines ...
1
vote
1answer
1k views

! Missing \endcsname inserted in \begin {algorithmic}

file1.tex: \documentclass[12pt,letterpaper]{report} %%%%%%%%%%%%%%%% Xiaodi add: \usepackage{longtable} \newcommand{\argmin}{\arg\!\min} \usepackage[dvips]{graphicx} ...
7
votes
2answers
5k views

Algorithm in IEEE format

I want to type an algorithm in ieee format. I have used algorithmic package. But using that package, I couldn't type a caption to the algorithm and "Algorithm " above the written algorithm. What ...
1
vote
2answers
100 views

Section numbering conflicts in latex

I am using the following code in latex (llncs template) to write a paper. I am using xpretocmd to avoid conflicts between arabtex and algorithmic but the problem is that once I solved this conflict by ...
4
votes
1answer
193 views

Increase width of caption's horizontal lines in algorithmic and listings

I've been able to increase the width of the horizontal lines honoring the second answer in LaTeX tables: How do I make bold horizontal lines (typically \hline)?. Now, I'd like to do the same in ...
2
votes
0answers
460 views

Switch statement using algorithmic environment

How to use Switch statement in algorithmic environment. I tried the following sample code but the errors are: unrecognized command (algorithmicswitch, algorithmiccase, \Switch, \EndSwitch, \Case, ...
0
votes
0answers
32 views

Split algorithm over two pages, inside a for loop [duplicate]

I have found questions similar to mine, but none of the solutions given solves my problem. Because my algorithm is too long to fit on one page, I want it to be split on two pages. Solutions I've ...
2
votes
0answers
17 views

Algorithmic, put curled bracket over states [duplicate]

I am using the algorithm package and I want to but brackets over a set of lines, because it will be repeated for some cases.. \documentclass[a4paper,10pt, twoside]{book} \usepackage[utf8]{inputenc} ...
0
votes
0answers
832 views

how to use \algsetup in latex environment

I am using the "algorithmic" environment and want to use \algsetup. But getting an error. \documentclass{article} \usepackage{algpseudocode} \usepackage{algorithmic} \usepackage{float} ...
2
votes
0answers
525 views

Algorithm keeps appearing on the last page of my latex document

I am writing an algorithm with the algorithmic environment and Latex keeps pushing it on the last page, no matter what I do, this is just a short example. \documentclass[a4paper,10pt, twoside]{book} ...
4
votes
1answer
469 views

Change font for function names within algorithmic

Using the following code, the function name foo is printed as \textsc{foo}. \usepackage{algorithmic} \begin{document} \begin{frame} \begin{algorithmic}[1] \Function{foo}{$a$} \EndFunction ...
0
votes
0answers
301 views

algpseudocode is not formatting properly in elsarticle template

I am using algpseudocode to write pseudo code. I am noticed that the pseudo code is justify aligned, which doesn't look good here. Below is the snippet of latex code- \usepackage{algorithm} ...