{algorithms} is about the presentation, numbering, and layout of algorithms or pseudocode in documents. Popular packages are algorithms, {algorithmicx}, {algorithm2e} and {listings}. For questions about the specific package, use the appropriate tag instead.

learn more… | top users | synonyms (1)

3
votes
1answer
23 views

Procedure name with small caps in algorithm2e

I know that procedure in algorithm2e only allows captions like \caption{ProcedureName()}. However, I'd like my procedure to appear in small caps: \documentclass[12pt,a4paper]{article} ...
0
votes
0answers
17 views

Replacing 'Algorithm' keyword in caption of algorithm2e environment [duplicate]

I want the following to appear: ------------------------------------ Policy 1: APolicy ------------------------------------ while not-an-end-of-doc do read-line; print-line to stdout; end ...
4
votes
2answers
237 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
50 views

How to color an entire algorithm environment in LaTeX?

The entire algorithm environment needs to be colored in blue. While this can be done in a report or article environment, I am unable to get it done in the IEEE Journal templates. @Masroor : Thanks ...
1
vote
1answer
21 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] ...
10
votes
3answers
132 views

How can I make an algorithm environment wider than \linewidth or \textwidth?

I have already tried two things: \makebox[1.2\textwidth][c]{...} which did not work (perhaps missing \item). \redefinegeometry does not work well in this case beacause it’s not on a single page. MWE: ...
5
votes
1answer
64 views

Putting algorithm in minipage

I have the following algorithm. Could any one please let me know how I can put it in a minipage? \begin{algorithm}\small {Start}\; \eIf{A is bigger than B}{ \eIf{if A is bigger than C}{ A; }{ ...
0
votes
0answers
31 views

Algorithmus at caption for Algorithm

I am using classicthesis for Algorithm caption when pdf is generated it write "Algorithmus " rather than Algorithm :
7
votes
1answer
221 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
2answers
27 views

How can I use an align environment or tabbing in the algorithm environment?

I would like to have these expressions aligned so that the kerning and slightly different character widths do not result in an uneven overall appearance. I tried using an align environment within ...
4
votes
1answer
36 views

Combination of microtype and algorithm package fails to compile

I try to compile the following MWE: \documentclass{article} \usepackage[activate=true,final,tracking=true,kerning=true,spacing=true]{microtype} % improves font appearance. ...
5
votes
1answer
77 views

Graph algorithm

I must make an animation of one algorithm on graph, I must make something like bfs, starting in one vertex and increasing values of other vertices. Then we take another vertex and start once again, ...
4
votes
1answer
102 views

How can I customise the amount of horizontal space that follows line numbers?

I'd like to increase the amount of horizontal space that after comes each line number in my algorithm (typeset with algpseudocode). Because algorithmicx in general, and algpseudocode in particular, ...
2
votes
1answer
58 views

How to insert algorithm pseudocode in Lyx?

recently I found LyX is good for writing notes. But I don't know how to add a piece of algorithm pseudocode in Lyx environment. Could you please help give some advice? Thanks! How could I implement ...
2
votes
1answer
41 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
47 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 ...
5
votes
2answers
135 views

How to switch off “figure” in algorithm2e only in certain cases?

Suppose the following situation. Algorithm2e should have the global option "figure", i.e. an algorithm is included in Figures. However we need to switch off this property only in certain cases (to ...
1
vote
1answer
119 views

What is this typography in this variable?

I am wondering how to get "gamma2" to have the same font as in Doing gamma2 = \Gamma (\alpha + 2) gives the wanted equation, but "gamma2" does not have the font of the example. How can I get ...
0
votes
0answers
52 views

Springer style for Algorithms in publication

I want to make own paragraphs for algorithms by numbering them appropriately. I do not need any fancy things - white background, no borders and black font are ok. I am trying to write in Springer ...
1
vote
1answer
41 views

How can I typeset code region comments to the left of an algorithm? [duplicate]

I'm looking for a way to add region comments to an algorithm. A comment should appear left of the listing and mark the corresponding code region by, for example, a large curly bracket. Like summaries ...
2
votes
1answer
29 views

Change style of specific algorithm with algorithm2e

I have the following LaTeX code \documentclass{article} \usepackage[ruled]{algorithm2e} \begin{document} \begin{algorithm} do something\; \caption{Algorithm #1} ...
2
votes
1answer
33 views

How to modify default parameters in the Algorithmic Environment module using LyX?

I'm using LyX together with the Springer Journal LaTeX template to write a document. I'm also using the Algorithmic Environment module to create an algorithm layout within my document. The problem is ...
2
votes
1answer
42 views

Algorithm split in two parts, need to be consecutive - forcing the text bellow

I am splitting my algorithm over two pages, since it is to long. And I would like them to appear one after the other, but If I do it like in the code below, the text coming after the second part ...
4
votes
1answer
47 views

Numbering Procedure and Algorithm Independently in algorithm2e

I want to use algorithm2e to generate two procedure and two algorithm. The procedure and algorithm may be interleaved with one another, and both procedure and algorithm have their independent counter ...
1
vote
1answer
58 views

Long algorithm doesn't split into two pages

I wrote an algorithm but it is long and it can't fit in one page but my problem is that it doesn't split into two page .. what happen is that a part of the algorithm appears in the first page and the ...
3
votes
1answer
119 views

How to make while(true) do loop?

Can someone explain to me how to make this? http://prntscr.com/4y0t4x I've got the two lines done, but I couldn't find anywhere about "while(true) do" loops and also about foreach. This is what I ...
0
votes
0answers
34 views

Split algorithm over two pages in a loop, algcompatible not working, float env. needed

My question before has been deleted, however the answers suggested are not solving my problem. So I want to split a really long algorithm onto two pages, the thing is, i want also the loop contained ...
2
votes
1answer
54 views

Procedure numbering in algorithm2e

When I use the package algorithm2e, I find the algorithms can be easily numbered, but the procedure cannot. How can I number the Procedures in algorithm2e, like Procedure 1, Procedure 2, ... %% ...
3
votes
1answer
152 views

Package algorithm

I am using algorithm package in order to create a pseudocode. But I would like to modify the way it appears some lines. Here is my code: \documentclass[twoside,12pt]{book} \usepackage{algorithm} ...
0
votes
0answers
30 views

How do I include figure or equation references inside algorithm environment in Lyx?

I would like to cross reference figures (and also maybe equations) inside the algorithm environment in Lyx but could not figure out how to do this. Help please?
0
votes
1answer
39 views

Package algorithmicx choking on line numbers

I'm trying to compile the code from this answer: http://tex.stackexchange.com/a/1376/35161 I keep getting the following error: ! Undefined control sequence. \ALG@cmd@2@alglinenumber ...size ...
2
votes
0answers
48 views

Algorithm keeps appearing on the last page of my latex document

I am writing an algorithm with the algorithmic environment and Latex keeps pushing it on the last page, no matter what I do, this is just a short example. \documentclass[a4paper,10pt, twoside]{book} ...
3
votes
1answer
273 views

How to format a pseudocode algorithm

I would like to know how to format a pseudocode algorithm like the one shown in the picture below. I would like to see an example of Tex/Latex code that would mimic the style, formatting and design of ...
4
votes
3answers
78 views

Claim Check Set From A List of Clients

I don't know that this fits here, but here's my question: I'd like to make a set of claim checks from a list of clients so that they can all be printed together within the same PDF. I'm looking for ...
5
votes
1answer
191 views

How can I typeset function names as they appear in algorithmic environments?

I'm using the algorithmicx package and I'd like to mention a function in common text. Is there a way to do that, or do I have to make a format that mimics the one used in the algorithm (all caps ...
3
votes
1answer
141 views

how to adjust this algorithm

I have an algorithm and I would like to adjust it to look good. I have some matrices and some equations, so I would like to put the text in the left not in the center. ...
1
vote
0answers
60 views

Trouble creating custom algorithm environment with separate counter

I am trying to create a custom algorithm environment for CUDA kernel code that runs on the GPU, but have little experience with custom LaTeX. It should have a separate counter, be referenced as Kernel ...
1
vote
1answer
59 views

Different line numbers for two procedures in similar algorithm

I have following algorithm with two different procedures (i.e., phases) and want to give separate line numbers to both of them. Can any body help me out please? Thanks... ...
1
vote
1answer
64 views

Changing indentation of pseudocode including line numbers with algorithm and algorithmic

If I have pseudocode as shown below using the algorithm and algorithmic packages, is it possible to indent the pseudocode, including the line numbers, so that it lines up with the indentation of the ...
4
votes
2answers
70 views

Changing the default layout produced by algorithm and algorithmic packages

If the default output of the algorithm and algorithmic packages for the following code: \begin{algorithm} \begin{algorithmic}[1] \PRINT \texttt{‘‘Hello, World!’’} \end{algorithmic} ...
2
votes
1answer
87 views

Problem in Algorithm Code [closed]

I am trying to complete my research paper in LaTeX but getting following three errors. I have tried so many things from the internet but to no advantage. Could any one help me please? 1) File ...
3
votes
1answer
53 views

Make listofalgorithms (algorithm2e) inside a section instead of chapter

I'm writing my thesis and I have a few algorithms (using algorithm2e) that I want to list in my appendix, but I don't want to start a new page. Also my listoffigures currently creates a section, not a ...
5
votes
1answer
150 views

Two algorithm counters for different types of algorithms

I want to create two separate algorithm counters in Latex. The first one is for my main algorithms, the second one for subroutines. In particular, I now have the following algorithms (in order): ...
2
votes
2answers
96 views

Missing $ inserted. <inserted text> on a math algorithm

I've made the following pseudocode: \documentclass[]{article} \usepackage[]{algorithm2e} \begin{document} \title{Title} \author{Author} \date{Today} \maketitle \begin{algorithm}[H] pseudoalgoritmo ...
0
votes
1answer
168 views

Why is my algorithm nowhere to be found in the PDF? [closed]

I need to typeset a pseudocode algorithm. (I use TexStudio on Windows 7.) If I put the code in a single new tex file, I can see the pdf file. But, I cannot see it if I put it inside one of the other ...
3
votes
2answers
92 views

break an long line in an algorithm

I have a long line in an algorithm and want to break it into two lines. For similar case in equations, split can be used. How do I do this within an algorithm? \documentclass{article} ...
0
votes
1answer
53 views

How to write an algorithm in french? [Errors]

I am trying to write my algorithm in french language. I found this solution which works for me but with errors. The errors are: \algorithmicendelsif undefined \algorithmicendif undefined ...
1
vote
0answers
47 views

make latex to automatically choose the placement of algorithms

I have several algorithms written down in a single file and would like latex to spread them across the document to save spaces. For example an algorithm can be just 3 or 4 lines and another can be 20 ...
0
votes
0answers
45 views

Error trying to align series of equations

I am new to LaTex and I am using TexWorks and PDFLaTeX. This is the following code that I am trying to compile. El Random Fores es muy basico y intuitivo:%$$ \begin{gather} \text{Dado que tienes el ...
4
votes
1answer
93 views

eqparbox causes error for \hline and \hdashline

When compiling the MWE below, I get presented with the errors "Undefined control sequence \hline" and "Undefined control sequence \hdashline". The problem is caused by the eqparbox package, as code ...