{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

5
votes
1answer
35 views

Referring to correctly-styled algpseudocode procedure name in document

Given an algorithm written in algpseudocode: \documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm} \caption{Part 1} \begin{algorithmic}[1] ...
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
17 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 ...
3
votes
2answers
46 views

for loop in algpseudocode

I want change my pseudocode \documentclass{article}\usepackage{amsmath} \usepackage[noend]{algpseudocode} \usepackage{algorithm} \makeatletter \begin{document} \begin{algorithm} ...
3
votes
1answer
31 views

Errors using Algorithm

When I run the following code, the pdf is getting generated but I get errors. \documentclass[12pt,a4paper,oneside,oldfontcommands]{memoir} \usepackage{algorithm2e} \usepackage{algorithmicx} ...
4
votes
2answers
39 views

how to left justify comments to indent same as other text in Algorithmic

How do I left justify my comments in the algorithm. I am using algorithmicx package. What I want is: to pull the comment to left as shown in the attached snapshot. The code for my algorithm is ...
4
votes
1answer
142 views

Can the coding style of the algorithm environment be modified?

I'm using the packages \usepackage{algpseudocode} \usepackage{algorithm} to produce a pseudocode of the following algorithm: \begin{algorithm} \centering \caption{Octree based search ...
5
votes
1answer
632 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 ...
8
votes
2answers
277 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 ...
3
votes
1answer
34 views

algorithmicx or algpseudocode custom command indentation within a while loop or if statement

I have been trying all day to set-up the commands necessary to represent the Haggis pseudocode format using the algorithmicx package in Latex. I have managed to create the commands I need for the ...
1
vote
0answers
29 views

Algorithm floating like figure with border

This is my document (LuaLaTeX): \documentclass[a4paper,twoside,12pt]{scrreprt} \usepackage{fontspec} \usepackage{a4wide} \usepackage[english]{babel} \usepackage{caption} \usepackage{blindtext} ...
3
votes
2answers
76 views

Algorithm is not dividing into multiple frames

\section[Algorithm]{Algorithm} \begin{frame}[allowframebreaks] \begin{algorithm}[H] \begin{algorithmic}[1] \STATE \emph {Taking a sequence of values $(f_{1} \dotsc f_{n/2})$, and calculating $pfbm = ...
7
votes
2answers
83 views

algorithm with partial borders/frames

I use the algorithm float environment for pseudocode and want some algorithms to span two pages. That works fine with \algstore and \algrestore. However, I would like to omit these borders at the end ...
2
votes
1answer
37 views

Hyperref, cleveref and algpseudocode same identifier warning

I get the warning pdfTeX warning (ext4): destination with the same identifier (name{ALG@line.2}) has been already used, duplicate ignored with the MWE down below. \documentclass{article} ...
5
votes
1answer
7k 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 ...
6
votes
2answers
217 views

pseudo code with vertical line

I want to write some pseudo code. After few research I found algorithmicx with this post: Write pseudo code in latex But I want vertical line as this: function toto: | for i = 0 , i < 10, i++ | ...
1
vote
1answer
78 views

How change font family in algorithmic package

Is there any way to set a specific font family for algortihm environment, especially for the comment that placed inside it?
8
votes
1answer
123 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 ...
6
votes
2answers
91 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 ...
1
vote
1answer
88 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
33 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?
2
votes
1answer
73 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 ...
2
votes
1answer
81 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 ...
5
votes
2answers
5k views

“For” loop without “do”; “if” statement without “then”

How can I get rid of the do in a for loop and the then in an if statement when typesetting algorithms using the algorithm and algorithmicx packages?
0
votes
1answer
43 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
2answers
483 views

algorithmicx + babel + Hebrew incompatibility

When trying to create any document with babel and algorithmicx, e.g.: \documentclass{article} \usepackage[hebrew,english]{babel} \usepackage{algorithmicx} \begin{document} Hello, world. ...
3
votes
2answers
59 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
33 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 ...
5
votes
1answer
110 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
127 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} ...
11
votes
1answer
4k views

algorithm numbering

I am having trouble numbering and referencing algorithms. I want to have the references labeled by the chapter, then within the chapter, such as: First algorithm in chapter 1 - Algorithm 1.1 ...
5
votes
1answer
109 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
110 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 ...
3
votes
4answers
147 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 ...
4
votes
1answer
164 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
80 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
207 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
123 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
143 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} ...
4
votes
1answer
891 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
3answers
1k 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 ...
3
votes
1answer
308 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
459 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
1k 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
23 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 % ...
1
vote
1answer
64 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
176 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
74 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 ...
8
votes
1answer
2k views

Translate “Algorithm” in the caption

This is my code \begin{algorithm} \caption{Funkcija ACO} \label{alg:aco} \begin{algorithmic} \STATE{do something} \end{algorithmic} \end{algorithm} it produces a caption like this ...
2
votes
1answer
479 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. ...