{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

7
votes
1answer
73 views

How do I get rid of that extra line at the end of my custom algorithmicx block?

I'm using the algorithmicx package and have created a custom block called \On, but even with the noend option for algpseudocode I get an extra blank line at the end of the block. Here is a complete ...
1
vote
1answer
23 views

Possible to put an algorithm inside a \begin{itemize}?

Is it possible to put an algorithm inside a \begin{itemize} as one of the \items?
6
votes
2answers
65 views

Text below line at end of algorithm?

I am using the algorithm and algpseudocode packages. When I define an algorithm it ends with a horizontal line. I would like to have some text below this horizontal line explaining some special case ...
2
votes
1answer
29 views

How to have continuation indent in algorithmicx algorithm for long comments and States

Assuming that I can apply the same solution to my document, previously I asked how to have continuation indent in line comments on somebody else's MWE and got an answer. However, I could not apply ...
1
vote
1answer
68 views

Code is a mess because I cannot indent inside a for loop in my algorithm

I have a for loop in my algorithm and I can't get latex to properly indent the pseudocode inside it. It's just a mess at the moment, it won't even put the code in the for loop on separate lines. ...
1
vote
1answer
31 views

How to indent long comment continuation in the algorithmicx pseudocode

In the MWE, I try to add line continuation indent to the answer given in Properly indent comments with no line-numbering in algorithmicx E.g. I am trying to write the \LineCommentCont . I am using ...
0
votes
1answer
26 views

How do I change colouring of comments using algorithmicx?

I am using the algorithm and algpseudocode packages, whilst wrapping my algorithms around algorithm and algorithmic blocks. I would like to change the colour or formatting of my comments ...
4
votes
1answer
23 views

algpseudocode referring to produce in document

Given an algorithm written in algpseudocode: \documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm} \caption{Part 1} \begin{algorithmic}[1] ...
3
votes
2answers
40 views

Fixing the location of the appearance in algorithmicx environment

I'm trying to force an algorithm to stay between two paragraphs, but after compilation, it shows up in the next page. My algorithm takes more than half a page and is something like: ...
0
votes
0answers
20 views

algorithmicx: how to redefine end if in the right way

I'm from Russia and there we have different form of "end if" than just "\algorithmicend \algorithmicif" (кесли at least in my university) But when I'm trying to redefine that according to official ...
4
votes
1answer
53 views

undefined control sequence '\For' - algorithmicx package

I have to write some algorithm, thus I've decided to use algorithmicx package: \usepackage{algorithm} \usepackage{algorithmicx} \begin{algorithm} \begin{algorithmic}[1] \For{aa} ...
4
votes
1answer
70 views

Change algorithmicx caption name

I am trying to change the Caption name of Algorithmicx but it doesnt work. This what i include to use it. %pseudocode \usepackage{algorithm} \usepackage{algorithmicx} \usepackage{algpseudocode} ...
5
votes
1answer
76 views

Customizing some aspect of algorithmic environment

I'm using the algorithmic environment for typesetting algorithm in my document, but I'd like to customize some aspect and fix problems. I'm using the algpseudocode package with noend option, but it ...
1
vote
1answer
62 views

Two column Algorithmicx with variable-width columns

In another post, @Jubobs suggested to use the multicol package around an algorithmic environment, to typeset the algorithm in two columns. Recently, I faced a rather aesthetic issue: It might be the ...
4
votes
1answer
115 views

Algorithm input in a box

I am trying to write pseudo code \documentclass[a4paper]{article} \usepackage[english]{babel} \usepackage[utf8x]{inputenc} \usepackage{amsmath} \usepackage{graphicx} ...
4
votes
2answers
57 views

Algorithmicx multiple statements per line aligned over all lines

I would like to put a <- b and e <- f, in parallel on a single line in an algorithmicx environment. I want the same with c <- d and g <- h. Then I want to align both lines. The output ...
4
votes
1answer
90 views

Splitting an algorithm across two columns

Consider the following short example, where a two column page is selected, and the algorithm is split across the two columns using a manual \pagebreak within the algorithm's code: ...
3
votes
1answer
65 views

Properly indent comments with no line-numbering in algorithmicx

Writing comments in pseudocode, I wanted to insert comments to the right side of the line which is commented. This thread help me a lot. The algorithm is line-numbered, however I need the comments ...
6
votes
1answer
106 views

Place pseudocode inside tikz node

How can I place pseudocode, that is written by the algpseudocode package, inside a tikz node? (I don't want to just decorate the code, but use them inside a graph) MWE \documentclass{article} ...
3
votes
4answers
130 views

Incorrect reference to a line in algorithmic using hyperref

I am using algpseudocode and algorithm packages to typeset pseudocode. I also use float, hyperref and caption packages. The problem is that when I reference a line in the pseudocode, the number is ...
3
votes
1answer
144 views

Reduce the line number font size of pseudocode?

I have learned from here on how to reduce the font size in the pseudocode. The last thing left for me is to reduce the line number font size as well. The following is my MWE, and it seems that ...
3
votes
1answer
219 views

How may I remove \EndIf and \EndFor in algorithmicx?

For space consideration, I wish to condense my pseudocode. I find it a bit annoying to me to always have a \EndIf or \EndFor at the end of every block, especially when inside the block only lies one ...
2
votes
2answers
511 views

Pseudocode: \Function vs. \Procedure?

The title says it all. What is the difference between a Function and a Procedure? When should I use which?
1
vote
0answers
22 views

How to use dotted line to make indentation clearer in algorithmicx? [duplicate]

I wish to indicate clearly when a block starts and ends with "enclosing lines" in addition to the indentation. I understand that I can do it with algorithm2e like so \begin{algorithm}[H] \SetLine % ...
3
votes
1answer
279 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
136 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
64 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
325 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. ...
8
votes
1answer
217 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 ...
10
votes
1answer
414 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
77 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
140 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
57 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
810 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
135 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 ...
4
votes
1answer
5k 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
89 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 ...
0
votes
1answer
113 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 ...
3
votes
1answer
625 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 ...
4
votes
2answers
627 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
149 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
393 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
174 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
341 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
689 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 ...
5
votes
1answer
797 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
51 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 ...
1
vote
1answer
5k 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
194 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
127 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 ...