{algorithmicx} provides an improved typesetting environment for algorithmic pseudocode. It is compatible with the algorithms bundle that provides the algorithm and algorithmic environment for typesetting floating {algorithms}.

learn more… | top users | synonyms

3
votes
1answer
25 views

Spurious whitespace with algpseudocode and noend

I'm currently typesetting some pseudocode and was up to now pretty happy with the algorithmicx package and the algpseudocode command set. However, I would now like to use the noend option to omit end ...
1
vote
1answer
40 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 ...
4
votes
1answer
49 views

Define algorithmicx block without line numbers

I'm trying to define some sort of algorithmicx command to give me this: \Statex \textbf{Local State:} \Statex \hspace{\algorithmicindent} $v \gets []$ \Statex \hspace{\algorithmicindent} $h \gets ...
1
vote
0answers
54 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 ...
0
votes
0answers
19 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, ...
2
votes
1answer
26 views

How can I change the layout of comment in a pseudocode?

I'm writing a pseudocode with algorithm package. Now algorithmicx package produce a comment with the triangle on the right of the line which is referred (this is the default layout). I need to change ...
0
votes
1answer
39 views

How to get consistent rule lengths for algorithmicx and listings floats?

In the following MWE, I would like the rules (the gray lines above and below the floats) of both environments (listings and algorithmicx, resp. algpseudocode style) to have visually (I'm not aiming ...
2
votes
1answer
49 views

How to have a “repeat” statement without an “until” statement using algorithmicx package [duplicate]

I'd like to write something very similar to the algorithm shown below, but using the algorithmicx package. (This example comes from p. 152 of the book Proximal Algorithms by Boyd and Parikh.) How ...
0
votes
0answers
30 views

algorithmicx and TikZ to mark indentation [duplicate]

Is it possible to use the algorithmicx package and modify the command blocks somehow that I get vertical lines for the indentation? Should this be probably done with TikZ? (The package algorithm2e can ...
1
vote
1answer
130 views

algorithmicrequire undefined when using algorithmicx

I was using algorithmic and algorithm to write algorithm: \usepackage[noend]{algorithmic} \usepackage{algorithm} \renewcommand{\algorithmicrequire}{\textbf{Input: }} ...
2
votes
1answer
48 views

Missing line below caption in algorithm environment

Using two different computers at work and at home, I sometimes compile my thesis with one computer and sometimes with the other. Most of the time the two versions are consistent, but for algorithms I ...
1
vote
2answers
239 views

I keep getting perhaps a missing \item error

I'm having problems with my LaTeX code. I keep getting an error: Underfull \vbox (badness 10000) has occurred while \output is active [13] ! LaTeX Error: Something's wrong--perhaps a missing \item. ...
1
vote
0answers
18 views

\ref to algorithm/algorithmic not working [duplicate]

I am trying to reference an algorithm in my thesis, made using the algorithmicx and algorithm packages, but it fails, ending up with the dreaded ?? and the following error: LaTeX Warning: Reference ...
4
votes
2answers
125 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 ...
2
votes
1answer
77 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} ...
3
votes
0answers
89 views

Get current position in the line / get space untill end of line

How can I get the current position within the line? Or how can I find out how much space is left until the end of line? (With the help of \linewidth it is easy to deduct one value from the other) ...
5
votes
2answers
72 views

How to format line in algorithm

I use ACM conference paper template (Two columns) to write paper. The problems bug me for a long time about Algorithms format: The function name always converted to UPPERCASE. Larger blank between ...
2
votes
0answers
159 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} ...
5
votes
1answer
68 views

Algorithmicx print first line number when numbering every n-th

Using the algorithmicx it is pretty easy to turn on or off line numbering or to number every n-th line. Taking this MWE (taken from the doc) \documentclass{article} \usepackage{algpseudocode} ...
3
votes
1answer
1k views

Algorithm return statement does not begin on new line

I have the following code for displaying an algorithm: \begin{algorithm} \caption{Compute index of nearest grid point given particle position (1D)} \label{nearestGridPoint} ...
0
votes
1answer
320 views

Missing number treated as zero :(

Bonjour , quelqu'un pourrai me dire ou est le problème dans ce code en latex? \documentclass{report} \usepackage{amsthm} \usepackage{amsfonts} \usepackage{graphics} \usepackage{graphicx} ...
26
votes
1answer
5k 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 ...
4
votes
1answer
195 views

LaTeX Math Mode in algorithmic environment

The following code works fine: \documentclass{article} \usepackage{algpseudocode,amsmath} \begin{document} \begin{algorithmic}[1] \State \Call{MergeSort}{$T(1,\dotsc,n)$} \end{algorithmic} ...
1
vote
1answer
83 views

Tweaking fonts in algorithms

I'm working on a problem set for my algorithms course and just started using the algorithm and algorithmicx packages to produce pseudocode. Here's what it looks like: Is there a way to give ...
3
votes
1answer
180 views

algorithm2e style comments in algorithmicx

I want to use \tcc and \tcp commands in algorithmicx package. Is there any way to do this? \documentclass[12pt,a4paper]{report} \usepackage[english]{babel} \usepackage[utf8]{inputenc} ...
1
vote
0answers
35 views

“for all … do in parallel” without “end for” [duplicate]

I am using this approach to have a for all ... do in parallel using the algcompatible package. \documentclass{article} \usepackage{algorithm} \usepackage{algcompatible} ...
4
votes
1answer
143 views

How to change indentation of while loop in embedded pseudo algorithm?

I am writing an algorithm, which has some sub-algorithms, and I want to have all in one pesudocode. How can I do this (manage the indention)? As long as I am using \State, I can use ...
2
votes
1answer
287 views

Algorithm2e package edit the line numbers

I need to remove the line numbers only below Step 1 and continue it after Step 2 and skip numbering infront of cc in Step 2. Please refer to the attached figure and the latex code. How I can do ...
1
vote
1answer
58 views

Ref command does not work in pseudocode

I want to use \ref command in my pseudocode like this: 1st Line : "mut Eq. x" 2nd Line :"cr Eq. y" 3rd Line :"sel Eq. z" But i am getting "Latex Error : Command \item invalid in math mode" in the 2nd ...
2
votes
1answer
154 views

Add colon to algorithm Caption after algorithm number [duplicate]

If I typeset a simple algorithm using the algorithmicx package, say \documentclass{article} \usepackage{algpseudocode} \usepackage{algorithm} \begin{document} \begin{algorithm}[H] ...
1
vote
1answer
919 views

! Missing \endcsname inserted in \begin {algorithmic}

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

Algorithms in Two columns not allowing text to the side

I'm typesetting a two column document with an algorithm as a figure. The algorithm is in the left hand column, but nothing appears in the right hand column, which wastes space. My working example is ...
6
votes
2answers
824 views

Algorithm not showing the end loop statement

I'm using algorithm package for writing algorithms. I'm using following code for generating a loop \begin{algorithm} \caption{My algorithm}\label{alg:myalgo} \begin{algorithmic}[1] ...
1
vote
1answer
112 views

Breaking up an algorithm into several parts

I would to divide an algorithm I wrote into parts as shown in the attached file This is what I did so far : \begin{algorithm} \caption{Selection algorithm} \label{mpral} \begin{algorithmic}[1] ...
12
votes
1answer
33k views

Writing an algorithm in LaTeX

I am trying to write an algorithm in LaTeX. I used a for loop inside the algorithm (see attached image), but the problem is that the statements that are below the for loop are not tapped. Why? I ...
2
votes
1answer
195 views

Different numbering for algorithms and procedures

I am using algorithmicx package in LaTeX to write an algorithm and a procedure in my LaTeX file. I want LaTeX to number the procedures differently, but the numbering is the same as algorithms. Is ...
4
votes
2answers
672 views

Algorithms LaTeX \EndForAll and “Some Blocks are not closed!!!”

I'm new to the algorithm package in LaTeX and need help figuring out how to debug my MWE below, which gives six errors. It look complicated, but half the errors are the same thing and in one case I'm ...
2
votes
1answer
93 views

Forcing a newline in the algpseudocode package

I have written the following pseudocode: \begin{algorithm} \caption{Check if any player has won.} \begin{algorithmic}[1] \Procedure{isWin}{$Game$} \ForAll{$seq \in \Call{getWinSeqs}{Game}$} ...
0
votes
0answers
645 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
2answers
198 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
1answer
198 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 ...
12
votes
1answer
2k views

How can I typeset function names as they appear in algorithmic environments?

I'm using the algorithmicx package and I'd like to mention a function in common text. Is there a way to do that, or do I have to make a format that mimics the one used in the algorithm (all caps ...
3
votes
1answer
684 views

How to have the algorithmicx comment symbol in algorithm2e?

I want to know how can I have the nice ▷ $\triangleright$ comment symbol of algorithmicx in algorithm2e?
4
votes
1answer
135 views

Trouble creating custom algorithm environment with separate counter

I am trying to create a custom algorithm environment for CUDA kernel code that runs on the GPU, but have little experience with custom LaTeX. It should have a separate counter, be referenced as Kernel ...
6
votes
1answer
614 views

How to wrap lines correctly inside algorithmic

I am having problems displaying algorithms. The wrapping is really ugly and I can't, for the life of me, find a fix that doesn't involve manually tweaking the hell out of everything, to the point that ...
4
votes
1answer
940 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
1answer
138 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} ...
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
1answer
264 views

stop bold in algorithmx

I am using the algorithmx package: http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/algorithmicx/algorithmicx.pdf The keywords such as "if", "while", "then", "else" "end if" etc. etc. all ...