Tagged Questions

{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

6
votes
1answer
1k views

Vertical loop/block lines in algorithmicx with 'noend' option

I am using the algorithmicx package to write an algorithm. However I am using the noend option: \usepackage[noend]{algpseudocode} Is there anyway to get vertical lines for each block of code? This ...
3
votes
1answer
263 views

Indenting pseudocode

I am very new to TeA, and am having trouble indenting a block of pseudocode within an enumeration. Or perhaps more specifically, the algorithm's pseudocode seems to ignore the enumerations ...
0
votes
0answers
82 views

How to write this algorithm properly

Here I have attached the current code \begin{document} \begin{flushleft} \begin{picture}(10,5) \put(1,1){\line(1,0){450}} \end{picture} \end{flushleft} \textbf{\textit{Algorithm:}} Curves on ...
2
votes
1answer
694 views

Self-defined Width of the Pseudocode Box with algorithmicx?

This post has beautifully shown how to make the algorithm pseudocode box as wide as one column or two columns. I am now writing a pseudocode with many if layers. So a one-column box cannot suffice. ...
9
votes
2answers
340 views

How to automatically keep the indentation level when a line has to be broken

I'm using the algpseudocode package with two custom commands, \Let and \LongState to handle automatic indentation of (broken) long lines in the spirit of Werner's answer, which uses \parbox to wrap ...
11
votes
1answer
655 views

Algorithm as figure and without italic and bold formatting?

I want to include an algorithm in my latex document, however without printing most of it in italic and all the keywords in bold font like it's done by default by e.g. the algorithmicx package. I like ...
4
votes
1answer
88 views

algpseudocode side effect

All tables in my document seem to be affected after I've started using package algpseudocode. Pretty much every table now always starts with two additional lines. These lines are utilized properly ...
4
votes
1answer
172 views

acmsmall breaks line number alignments of algorithms

I am formatting an article with one of the ACM journal formats: acmsmall. However, when I look at algorithms, I noticed that the lines of my algorithm lost their indentation. This problem does not ...
1
vote
1answer
67 views

algorithmic, referring using the name and inputs

I'm using the algorithmicx package, but I would like my algorithm to look like: Algorithm My Algo $(\lambda,\beta)$ i.e., the algorithm should accept inputs as shown. I then want refer to this ...
3
votes
1answer
1k views

Problem with algorithmicx: perhaps a missing \item. What's wrong?

I'm trying to write simple pseudocodes using package algorithmicx in TexWorks 0.4.4 and MiKTex 2.9 on Windows 7 but I get this error: ! LaTeX Error: Something's wrong--perhaps a missing \item. See ...
4
votes
1answer
230 views

Indentation of continued lines in algorithmicx

Trying to get the indentation right within the algorithmic environment I run into trouble, and all the solutions posted so far have not been able to solve my problem as I'd like to see it solved. I ...
6
votes
1answer
10k views

do-while loop in pseudo code

The algorithmic package lets me make a while loop as \begin{algorithmic} \While{$u\neq v$} \State Something \EndWhile \end{algorithmic} which results in a while(u is not v) do ...
1
vote
1answer
110 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 ...
1
vote
1answer
145 views

Algorithms in mdframed

Now that I converted all my theorems to mdframed, I'd like a consistent layout for my algorithms as well? What ways are there to typeset pseudocode algorithms in mdframed? So far I've been using ...
4
votes
1answer
1k views

cleveref fails to reference algorithms

In the following example document, both \autoref and plain ref will correctly link and number an algorithm reference, but cleveref fails that task. It will just insert question marks instead. In ...
5
votes
2answers
1k views

Caption numbering breaking up an algorithm with algorithmicx

According to its documentation, algorithmicx package allows break up an algorithm inside a document, as follows: Related tex code is: \documentclass{article} \usepackage{algorithm} ...
2
votes
1answer
218 views

Line break inside procedure's definition with algorithmicx

I don't know if this package is the best for my purpose, but I'm using algorithmicx (see here the documentation) to write algorithms (in pseudcode) inside my work. At now, I've just a problem: ...
4
votes
2answers
680 views

using standalone with algorithmicx or algorithm2e

I am trying to compile a standalone file containing pseudocode created with the algorithmicx package. According to algorithmicx crashes standalone it should work with the preview option set for ...
7
votes
2answers
287 views

Indentation in the algorithm package after \Ensure, \Require

I have this piece of code: \documentclass[11pt]{article} \usepackage{algorithm} \usepackage{algpseudocode} \usepackage{varwidth} \begin{document} \begin{algorithmic} \Require ...
2
votes
1answer
496 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 ...
4
votes
1answer
1k views

Ploblems with vertical lines in algorithmicx

I use algorithmicx with verical lines. And code is working good: \documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} % Vertical line \makeatletter ...
6
votes
1answer
2k views

Numbering in algorithmicx

I have simple code: \documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm} \caption{Examples}\label{alg:Examples} \begin{algorithmic}[1] ...
2
votes
1answer
71 views

Problem with the block with the word wrap in algorithmicx

For a good word wrap, I use this code in algorithmicx: \parbox[t]{\dimexpr\linewidth-\algorithmicindent}{<text>\strut} But when the code contains several nested structure leaves a block of ...
2
votes
1answer
10k 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).
5
votes
1answer
240 views

Renaming while loop in package algorithm

How do I rename the While loop using algorithm and algpseudocode? \documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm*} \caption{bar baz} ...
1
vote
0answers
210 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
1answer
693 views

Line number error using “Require” and “Ensure” in package{algorithmicx}

I’m using the packages algorithmicx and algpseudocode to write algorithms in my paper. It’s more convenient and beautiful to specify comments than with the algorithmic. But I encounter an error while ...
0
votes
0answers
42 views

writing part of a pseudocode [duplicate]

I have a few pseudocode lines like for each item in list L if (item > 50)| (item > 50)|(item > 50) value=item break; Obviously, this is not the exact code :). If I use a package ...
6
votes
2answers
10k views

Algorithm with Latex ( Package algorithmicx)

This is my algorithm: \usepackage{graphicx} \usepackage[linesnumbered,ruled,vlined]{algorithm2e} \usepackage{algorithmicx} \usepackage{algpseudocode} %\usepackage{algorithmic} ...
3
votes
1answer
274 views

Align pseudocode comments to the left

Writing comments in pseudocode, I wanted to insert comments which are not aligned to the right side of the line which is commented. This thread helped me a lot. However, I want comments to stand ...
3
votes
1answer
292 views

algorithmicx, broken left align with custom numbering

I am trying to use the algorithmic package with Step1. Step2. instead of 1, 2, ... line numbering and I have numberless lines. An example: \documentclass[11 pt]{report} \usepackage{algorithm} ...
2
votes
1answer
2k views

Error compiling algpseudocode example

Compiling this piece of code (which I took from the guide of the algorithmicx package) I get a lot of errors and do not understand why. I think it is probably some stupid typo I can't see but this is ...
3
votes
1answer
702 views

Change line numbering in algorithmics package

I would like to start the line numbering of the following code not from 1 but from 12 (as it is cut out of a larger code). So it should be 12,13,14,15 instead of 1,2,3,4. \documentclass{article} ...
2
votes
0answers
154 views

Divide algorithm inside If EndIf

This is a follow-up question to Option in the algorithm with Latex. This is the code: \begin{document} \begin{algorithm} \caption{My algorithme} \begin{algorithmic}[1] \Donnees: My data ...
4
votes
1answer
368 views

How to rename command to avoid double defined command names

Hy, I would like to use the packages vaucanson and algorithm. \documentclass[11pt,a4paper,twoside,openright]{book} \usepackage{algorithm} \usepackage[noend]{algpseudocode} \usepackage{vaucanson-g} ...
4
votes
1answer
979 views

Slight change in algorithm

This is my MWE for an algorithm however its throwing an error and I don't know how to get inputs and initialize. I want it to look like the attached image. ...
5
votes
1answer
143 views

Error using amsart with algorithmic[x]

I use the algorithm and algorithmicx packages to type algorithms in a paper and my main document class is amsart. All is well until I try to use \listofalgorithms. This returns a variety of error ...
2
votes
1answer
788 views

Algorithmcx and array representation

I'm using package algorithmcx and algpseudocode to describe an algorithm in a paper. Each function in the algorithm receive an array/list of numerical values, e.g. {x1, x2, ..., xn}. ...
5
votes
0answers
55 views

Review of algorithm-related packages? [duplicate]

Possible Duplicate: Print programs with its proper syntax Where can I find (if it exists) an updated review of the most relevant packages for handling with algorithms (pseudocode or code ...
0
votes
1answer
1k views

Algorithm in LaTeX

I wrote the following algorithm, however its not compiling and throws a few errors. I am not sure of what I did wrong. Any help would be appreciated. \begin{algorithm} \caption{Bridging ...
2
votes
1answer
581 views

Remove line numbering from algorithmicx procedure/function

I would like the lines of "procedure" and "end procedure", "function", and "end function" etc to not be numbered. For example, the default behavior produces this: 1 procedure hasNext(v,V,s) 2 ...
7
votes
1answer
1k views

Line numbering in algorithmic

I want to change the first number of the line numbering in my algorithm, but how is it done? This is my example: \documentclass[12pt]{beamer} \usepackage{amsmath, amsfonts, amssymb, amsthm} ...
5
votes
3answers
2k views

Forced indentation in algorithmicx

I have an algorithm dealing with some very large parameter names, messing up the readability. What I've done so far is break the lines of the problematic statement (lines 4-5) manually into two ...
0
votes
1answer
191 views

How to get Roman line numbering in algorithmicx? What is the counter name?

I try to get Roman numbering but couldn't find how to change it in the package documentation. After some research, I figured out how to do it using the algorithm2e package. (Use algonl as optional ...
2
votes
2answers
2k views

MacPorts: install packages for use in Texmaker

I'm using Texmaker and want to install the package algorithmicx to write some pseudocode. I've tried using MacPorts to download and install the package but I can't seem to load it in Texmaker or in ...
6
votes
1answer
2k views

algorithmicx package comments on a single line

Is it possible in algorithmicx package to have comments not aligned to the right side? For example I have code like this - \begin{algorithm}[!ht] \caption{My Algo.} \label{myalgo} ...
6
votes
1answer
1k views

How to make lstlisting look exactly like the algorithm environment?

I'm typesetting pseudocode with algorithm and algorithmicx to get results like the following (taken from the package documentation): Now I would like to print real C++ code with the listings ...
2
votes
1answer
1k views

Writing Pseudocode in LaTeX

I cannot seem to get any of the LaTeX pseudocode packages to work correctly on my computer. For example, if I run this block of code: \documentclass{article} \usepackage{algorithm}% ...
6
votes
1answer
1k views

Avoid putting statements on the same line with algorithmicx

I'm writing a simple pseudocode, but I have a problem with a repeat..until block. Basically what happens is that the return statement that follows the end of this loop gets rendered on the same line ...
8
votes
1answer
2k views

Adjust the indentation whithin the algorithmicx-package when a line is broken

I have this code \documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm} \caption{Minimal Working Example for my Problem} ...