{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)

1
vote
1answer
41 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
80 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
18 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
37 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
128 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
24 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
17 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
37 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} ...
1
vote
0answers
83 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
72 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
155 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
131 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
47 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
33 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
39 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
56 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
64 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
42 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
85 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
48 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
132 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
60 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
41 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
42 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
41 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
60 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 ...
1
vote
0answers
63 views

Algorithm Environment

I want to write an algorithm into my paper but it is just a pseudocode and none of the fancy if-then loops etc. Instead, I want it to look something like Algorithm 11.1 here: What environment ...
1
vote
0answers
57 views

algorithm2e with RevTex

Note: I have seen the previous answer to this problem here and it doesn't work for my purposes. I suspect that others are in the same boat. I'm writing a paper for which the publisher requires the ...
4
votes
1answer
42 views

spacing problem for more than three algorithms in one page

I use algorithm and algpseudocode package. Problem is, when I tried to start the fourth procedure\function, the fourth one starts in the middle of the next page instead of right below to the third ...
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, ...
0
votes
0answers
44 views

Algorithm problem in poster with tikzposter

I am creating a poster using tikzposter. But it seems to have a bug with algorithm packages. I use the following code but the borders of algorithm block span to the whole width of the poster: ...
2
votes
1answer
50 views

Write Procedure Name correctly formated in algorithm enviroment

I want to call a function in an algorithm enviroment. \documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm} \caption{Recursion} ...
3
votes
1answer
125 views

Adjust Format of List of Algorithms

I'm using an existing LaTeX template for a thesis and am trying to match the List of Algorithms to the List of Figures. I have already applied some formatting changes, but there are a few attributes ...
3
votes
1answer
35 views

Algorithms disappear when I use multicols

This is my code: \documentclass[11pt]{llncs} \usepackage[utf8]{inputenc} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{dsfont} \usepackage{multicol} \usepackage{fixltx2e} ...
1
vote
0answers
89 views

How to convert latex algorithm2e into msword format [closed]

I need to write below latex algorithm using windows words, How I can do that? \documentclass{article} \usepackage[linesnumbered,ruled,vlined]{algorithm2e}% http://ctan.org/pkg/algorithm2e ...
1
vote
1answer
37 views

Justifying code according to corresponding elements indentation [duplicate]

How do I justify my comments as to inner for loop indentation in the below code: \documentclass[a4paper]{article} \pagestyle{empty} \usepackage{algorithm} \usepackage{algpseudocode} ...
4
votes
1answer
90 views

Algorithmic: Put If and EndIf into same line

I use the algorithmic package to create a pseudo-code-source in latex. I have a source with many short if-statements. The fact that the END (from EndIf) is put in a new line every time leads to a ...
0
votes
1answer
183 views

How to properly format pseudocode (algorithm) in LNCS (Lecture Notes in Computer Science)?

I know that when I need to paste the source code, I should use \verb or \verbatim. But how about pseudocode\algorithms? Should I use \verb or \verbatim as well? Can't really find any official Springer ...
4
votes
1answer
162 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 ...
2
votes
3answers
62 views

Place two algorithm into two column

I have single column page. I would like to add my two algorithm into two column. How can I do this? My algorithms are below. \begin{algorithm}[h] \caption{Resolve 1} \begin{algorithmic} \scriptsize ...
6
votes
1answer
222 views

How to align comments in algorithm code?

I will to align comments in another column, package algorithm. (Similar question: Faulty right alignment for comments in algorithmic package), but I will to become that result: ...
6
votes
2answers
102 views

Remove top rule from algorithm package

How can I remove only the top rule, which is above the caption, from the algorithm package? So not the two rules which are above and below the algorithm. I borrowed the mini example from: ...
3
votes
0answers
94 views

Object-oriented class typesetting? [closed]

I am looking for a way to beautifully typeset an OO class like : classname { properties: prop1 : integer prop2 : Node methods: someMethod() } With the look ...
7
votes
2answers
113 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 ...
0
votes
0answers
89 views

What package(s) are recommended for making algorithm block diagrams in LaTeX?

I am in the process of writing a conference paper for IEEE, and I was wondering what packages might be recommended for making good looking (but simple) block diagrams for algorithms? I am relatively ...
0
votes
0answers
36 views

What´s the easy way to put algorithms? [duplicate]

I was trying with algorithm2e , and I had a little problems, LATEX is so complicated and so tedious. The results are excelent, but... the time and effort is BIG BIG! What´s the easy way to describe ...
2
votes
1answer
96 views

Disable Algorithm Label

I am using the \usepackage{pseudocode} in this code \documentclass{article} \textwidth=4.5in \textheight=7.125in \usepackage{pseudocode} \begin{document} \renewcommand{\thepseudocode}{} ...
1
vote
0answers
52 views

Reduce space below an algorithm

I am using the algorithm package for my algorithms in the paper. I find that the space below the algorithm is very large after generating a PDF, so I want to shrink the space. Firstly, I come to add ...
3
votes
1answer
123 views

How to write sentences in an algorithm in latex?

Hi I am trying to write an algorithm which looks something like the image below: I was wondering how to write the "Step 1 (Update)" and also the rest of the line which says "When an edge e...." ...
6
votes
1answer
90 views

What conventions or packages are appropriate for formatting records, algebraic data types in LaTeX?

LaTeX formatting practice is well-established and well-supported by existing packages for three common cases relevant in computer science: Source code listings Established, conventional mathematical ...