{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

1
vote
0answers
25 views

Combine Pre-existing Independent Documents that Use Algorithmicx and Algorithm2e?

I have a few relatively substantive pre-written documents that need to be combined together into one. Each document contains a lot of pseudocode. The complicating factor is that two documents use ...
1
vote
0answers
12 views

How to produce an extract of an algorithm using algorithmicx?

Having an algorithm written with the package algorithmicx, I'd like to rewrite two (single) lines in a later section of my document. However, if possible, I'd prefer not to write the complete ...
4
votes
1answer
77 views

Algorithm Package Error in Beamer

I have the following trivial example that I just can't compile. \documentclass{beamer} \mode<presentation> { \usetheme{Madrid} \usecolortheme[RGB={0,0,0}]{structure} } \usepackage{amsmath,...
3
votes
2answers
33 views

How to indent a long sentence in an algorithm

In this algorithm format I want the the "Considering the jth...." to be having the same indentation throughout even in newline. The Code is as follows: \documentclass{article} \usepackage{amsmath} \...
3
votes
1answer
47 views

autoref for algorithms

\usepackage{algorithm,algpseudocode} \usepackage{hyperref} So when I \begin{algorithm} \caption{Baseline}\label{ALG_baseline} \begin{algorithmic}[1] ... \end{algorithmic} \end{algorithm} the ...
2
votes
1answer
37 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
19 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
38 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!] \caption{...
1
vote
1answer
8 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
108 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
49 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
9 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
66 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
25 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
49 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
54 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
125 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
56 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
106 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
144 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
215 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
39 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
39 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
47 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
86 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
322 views

algorithmicrequire undefined when using algorithmicx

I was using algorithmic and algorithm to write algorithm: \usepackage[noend]{algorithmic} \usepackage{algorithm} \renewcommand{\algorithmicrequire}{\textbf{Input: }} \renewcommand{\algorithmicensure}{...
2
votes
1answer
81 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
400 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
187 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
175 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} %\usepackage[noend]{...
3
votes
0answers
137 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
113 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
212 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} \renewcommand{\algorithmicrequire}{\...
5
votes
1answer
85 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
3k 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} \begin{algorithmic}[...
0
votes
1answer
587 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} \usepackage{...
38
votes
1answer
9k 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
308 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} \end{...
1
vote
1answer
119 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 DETECT-...
3
votes
1answer
408 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} \usepackage{...
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} \algblockdefx{FORALLP}{...
4
votes
1answer
184 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 \hspace{\...
2
votes
1answer
463 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 this?...
1
vote
1answer
81 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
233 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] \caption{...
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} \usepackage{color,amsmath,...
4
votes
2answers
89 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] \Procedure{Algo1}{}...