{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

2
votes
1answer
19 views

How to reinitialize the lines counter for algorithms?

I have four algorithms in a section but the problem is that the lines numbering doesn't start with 1 in each algorithm. For example, the first one is numbered from 1 to 11 but the second one start ...
0
votes
1answer
15 views

algpseudocode: Is it possible to make the “noend” option work with custom blocks?

This question provides several good answers on creating custom algpseudocode blocks with no ending tag. Based on that, I was wondering if such custom blocks can be redefined in order to detect the ...
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!] ...
1
vote
1answer
7 views

How to suppress block ends in algorithmicx? [duplicate]

Is there a way to make algorithmicx not display the ends of blocks? I've tried redefining the block's end as empty, but it still typesets an empty line instead of ignoring it completely. ...
2
votes
0answers
49 views

How to combine algorithm and algorithm2e in one document?

I got myself in big trouble and I can't get out of it. I use standalone package to combine different latex files into one. Each Latex file compiles OK on its own. When I combined them, I found a ...
0
votes
0answers
37 views

Formatting an algorithm with a nice presentation

I was reading this paper and I think is really nice the format how they present the algorithms, how can I do this? what packages are needed and the styles. Thanks in advance.
0
votes
0answers
8 views

Unable to find algorithmicx.tar.lzma

I want to use the algpseudocode package. For that I need the algorithmicx package. But I am not able to get the algorithmicx.tar.lzma. I am only getting the algorithmicx.cab file. Therefore, I am ...
2
votes
1answer
38 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 ...
0
votes
0answers
23 views

Change the format of an algorithm from a table to any algorithm typesetting

I have been struggling to format the pseudocode of my algorithm from the current state (in a table) to the one provided by the algorithm package. After several tries with answers like: one, another, ...
1
vote
1answer
34 views

indent algorithmic outside of a block

I want to change the horizontal position of the complete code. Remove the padding if you will. How can I do that? \begin{algorithm}[t!] \algrenewcommand\algorithmicindent{.1em}% \caption{With intent ...
0
votes
1answer
37 views

Algorithms: change the style of individual line numbers

I would like to change the style of individual lines in an algorithm. For example, I'd like surround key line numbers with a box, color them, or otherwise distinguish them. It is possible to change ...
2
votes
1answer
71 views

Undefined control sequence.\BState ->\State \algbackskip \BState

I got the error while creating a pseudocode for my report. The following is my code in LaTeX. This gives out an stating "undefined control sequence \BState ->\State \algbackskip \BState". Kindly help ...
3
votes
1answer
47 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
89 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
106 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 ...
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
34 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
32 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
44 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
68 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
267 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
68 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
337 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
173 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
135 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
119 views

Get current position in the line / get space until 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
97 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
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} ...
5
votes
1answer
80 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
2k 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
508 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} ...
35
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 ...
4
votes
1answer
264 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
105 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
349 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
36 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
170 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
422 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
74 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
205 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
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} ...
4
votes
2answers
85 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
1k 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
153 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] ...
14
votes
1answer
43k 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
244 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
977 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 ...
3
votes
1answer
127 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}$} ...