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

2
votes
0answers
177 views

How to set algorithm width to avoid overfull \hbox problem

I wrote the following latex text, but the log shows an error that overfull \hbox(10.0pt too wide) detected. I am sure that the algorithmic part exceed the width limit. Even if I type a few words, the ...
1
vote
1answer
40 views

Problem with cross references in table and algorithm

I am having a problem with cross references, which I have not been able to solve. I have a table and an algorithm which cannot be referenced. However, the behaviour in both cases is different: when I ...
0
votes
0answers
23 views

Indentations in Algorithm floats in LYX

I am using LYX and I'm trying to enter algorithms in an algorithm float. Is there a way to have indentation?
1
vote
2answers
94 views

Need help reformatting PowerPoint slide containing latex code

Consider the following PowerPoint slide: This was produced with the help of IguanaTex plugin, which allows you to generate pictures from latex snippets, and add them to your PowerPoint slides. ...
0
votes
0answers
58 views

Adding keywords to an algorithm in LYX

I am using the method explained in this post to add algorithms in LYX. I wonder if it is possible to add new keywords like (Input, Output, ...) so they appear in bold. I use Algorithm-Style Package ...
0
votes
0answers
29 views

How can I set the font for loops in algorithm2e?

Consider the following listing with algorithm2e. I want the font in the if-clause at the bottom to be in typewriter or the same font used in the loop bodies, and the list for the for-loops as well. I ...
0
votes
0answers
12 views

algorithm not coming properly [duplicate]

I want to write an algorithm like this using \documentclass{clv2} but my pdf is not being generated because of nested loops.
2
votes
1answer
59 views

algorithm textsc and uarial package?

Is it possible to get a regular optic at the algorithm package when using the uarial package? I am using: %change font \usepackage{uarial} %set arial as default font for everything ...
0
votes
3answers
65 views

Algorithm in document class clv2

How to write an algorithm in an article in \documentclass{clv2}, can anybody send me a working model with dummy algorithm, because I guess \caption is creating problem. I want to send it to ...
1
vote
0answers
37 views

Put two algorithms in the same page one after the other

I want to put two algorithm on the same page and be able to change the size of two of them at the same time as they are in a box. I thought about \minipage but I am not sure how exactly I can do it.
0
votes
0answers
44 views

How can very long algorithms be automatically split over multiple pages with a specific layout?

My question is related to this other question just published I have the same problem and I solve with your solution, removing {algorithm*} environment (which is a floating box, and boxes never ...
0
votes
0answers
84 views

How to insert a subscript in algorithm

I'm writing a pseudocode by algorithm package. Now I want to write a variable using a subscript: I would write something like var\ped{e} where var is the name of the variable and e is the subscript. I ...
0
votes
1answer
86 views

How to write algorithm without numbering in latex

I am looking for the way to write a algorithm as: (without numbering). Please help me to write it in latex. Thanks in advance Algorithm: Input: A, B,C. Initialize \alpha, \beta,u Employ the A While ...
1
vote
0answers
58 views

Typesetting algorithms in LaTeX like Kleinberg and Tardos 'Algorithm Design' [closed]

Is there any LaTeX package for typesetting algorithms in the style Kleinberg and Tardos uses in Algorithm Design?
0
votes
0answers
28 views

Why is this algorithm badly outlined?

I have the following algorithm in Latex using the algorithm and algorithmic package: \begin{algorithm} \caption{Play-N-Games algorithm} \label{alg:play} \begin{algorithmic} \State $Agent\gets Make ...
0
votes
0answers
79 views

Algorithm indent problem with sig-alternate document & algorithm(ic) package

Can anyone tell me why the indention of the algorithm does not work? I have the following code: \begin{algorithm} \caption{STEP 1} \begin{algorithmic}[1] \REQUIRE Something \FOR{\textbf{each} ...
4
votes
1answer
39 views

Errors with the following algorithm -inputenc Error

\documentclass{article} \usepackage{algorithm,algpseudocode} \begin{document \begin{algorithm} \caption{PUML Algorithm} \label{PUML Algorithm} \begin{algorithmic}[1] \Procedure{Path\textendash Binary ...
3
votes
1answer
212 views

How to change font style of all algorithm/algpseudocode keywords?

In detail I want to change the font style of all keywords like If Return For to bold/sans serif, but only the keywords. MWE: \documentclass{article} \usepackage{algorithm} ...
0
votes
0answers
65 views

algorithms package, science packages and related configuration problems

I am new to Ubuntu and new to LaTeX and now I need to modify a .tex file. I use Texmaker. It said that the algorithmic.sty is missing, so I installed the texlive-science packages. But when I did, I ...
2
votes
1answer
39 views

Help to write LWU-NN algorithm in Latex -whats wrongg with my code

Please can someone guide me as to how to write the algorithm attached in Latex I have tried and its giving me a lot of errors \begin{document} \usepackage{algorithm} \usepackage{algpseudocode} ...
2
votes
1answer
86 views

How to add borders to algorithms that put side by side

I put two algorithms side by side using the following code, however, there is no borders for them and the it is hard to identify the two algorithms. The codes: \documentclass{llncs}% ...
0
votes
0answers
59 views

Force algorithm description, title and first function on the same page

I have an algorithm I want to describe. It's composed of several short functions, and while there are too many of them to fit them all on a same page, I want a clean solution to get each function to ...
3
votes
2answers
116 views

Placing graphic and algorithm on same page

If I have the following LaTeX code, is it possible to combine both graphic and algorithm so that they are fixed to a common page? \begin{figure} [H] \centering{\includegraphics[scale=1]{Figure.png}} ...
0
votes
0answers
54 views

The conflict between floatrow and algorithm packages

I was trying to use floatrow package to enable the subfigures. However, it seemed to damage the format of my algorithm a bit: \documentclass[11pt]{iopart} \usepackage[utf8]{inputenc} ...
4
votes
1answer
186 views

Remove the colon from line numbering in algpseudocode

Is there a way to remove the colon (:) from the line numbering in algorithms (using the algpseudocode package)? \documentclass{article} \usepackage{algpseudocode} \begin{document} ...
4
votes
1answer
135 views

Add lines to the bottom and top of algorithm

I am trying to write some psuedocode for my algorithm. Is it possible to add lines to the button and the top of the algorithm? If yes how? Code: \documentclass{article} \usepackage[]{algorithm2e} ...
1
vote
1answer
116 views

! Undefined control sequence. <recently read> \elf

I am trying to open an if statement after entering this if statement\eIf{$list size > 0$} at the position \elf{$stopAfterNext$ is not empty} but I am getting the error below. I can compile the ...
2
votes
1answer
31 views

Implementation of renewcommand in algorithms package

I am using the algorithms package, but am not being properly able to convert "Require" to say, something like "Parameters", using the \renewcommand macro. Can anyone please show how and in which part ...
1
vote
2answers
208 views

Add lines and line number to the pseudocode

I am trying to write some pseudocode. How can I add two line to the algorithm at the top and the bottom as well as adding line number. Code: \documentclass{article} %\usepackage{algorithmic}% ...
0
votes
0answers
30 views

individual algorithm environment with continuous numbering with normal algorithms

i am searching an algorithm environment in Latex. Im familiar with listings, algorithm and so on. But I want to create smth that looks like this: Initial step. Do the initial step General step. Do ...
1
vote
0answers
47 views

Typesetting algorithms: Taking the n argmax feature indices

I'm trying to typeset a simple greedy algorithm in LaTeX. My main question is how to correctly typeset "storing the indices of the best T values". Algo, simple and short: There is a matrix of ...
0
votes
1answer
92 views

How was this algorithm written?

The following algorithm appears on p. 152 of Boyd and Parikh's book Proximal Algorithms. I'd like to know how this was written in Latex, so that I can write my own algorithms in the same style. ...
8
votes
1answer
189 views

beamer - Mark several pseudocode block and insert comments near it

I try to use the answer proposed to this question: Mark a pseudocode block and insert comments near it But when I try to use it with several block, it does not work as perfectly as with only one ...
2
votes
1answer
131 views

Undefined control sequence and Something's missing perhaps a missing \item

I am using Windows 7 and getting a LaTeX Error in an algorithm; I am new to LaTeX and already spent a lot of time to figure this out but no luck. Could you please help me here? \begin{algorithm} ...
2
votes
0answers
52 views

Can my algorithm description be improved? [closed]

I'm writing a pseudocode description of the FISTA (with line search) algorithm from convex optimization. (I'm using slide 17-18 here as a source.) Can anyone suggest any improvements to my latex ...
5
votes
2answers
183 views

Style \listofalgorithms from algorithm package

I have some weird requirements for thesis formatting at my university. I was able to manage to mimic almost all of them, but List of Algorithms from algorithm package is something I cannot go through ...
3
votes
1answer
105 views

algorithm and controlling comment lines (shifting right or left)

I need to shift a comment to the right. Basically, in the below picture The comment is distracting the pseudocode, therefore, I'm hoping to get the below picture How to shift the comment to ...
1
vote
1answer
74 views

How to make caption above in algorithm

How can I make the caption "Algorithm 1" be placed above the first line and the text still inside the two first lines? And how can the line styles be changed in the algorithm environment? ...
3
votes
1answer
70 views

Floats change behavior when using package “algorithm”

Not really a problem, but I noticed this when pruning stuff from a document preamble to find a problem I was having. I've found the problem but also something a bit weird Just the act of importing ...
4
votes
2answers
41 views

Space in caption type name (algorithm)

To include code in my document I have following in my preamble: \usepackage[Code]{algorithm} \usepackage{listings} and following in the document body to display the actual code: begin{algorithm} ...
0
votes
0answers
48 views

Is there a nice way to split an algorithm float over multiple pages? [duplicate]

I am using the algorithm float with an lstlisting in it containing the code. Unfortunately, the code is just a little too long to fit on one page. I'd like to keep the layout provided by the ...
3
votes
1answer
105 views

How to put a line number with levels in algorithm?

\documentclass[a4paper, 10pt, 3p, final, twocolumn, times]{elsarticle} \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm}[htbp] \caption{somealg} \label{alg} ...
1
vote
1answer
272 views

algorithmicrequire undefined when using algorithmicx

I was using algorithmic and algorithm to write algorithm: \usepackage[noend]{algorithmic} \usepackage{algorithm} \renewcommand{\algorithmicrequire}{\textbf{Input: }} ...
0
votes
0answers
28 views

combining pictures and algorithm in two columns document

I tried a lot to prepare such a following format for my paper but it always put algorithm in a separated place. here is \begin{algorithm*}[] \KwIn{$L_1$, $L_2$ } \Return{$F$} ...
1
vote
1answer
77 views

Can I remove the word “algorithm” from the header and keep only the caption,also I “want for loop” to be indented after step 3

\begin{algorithm}[h] \begin{algorithmic} \caption{Math algorithm} \STATE \textbf {Step 1} $\rightarrow $ gather the data \STATE \textbf {Step 2} $\rightarrow $ estimate matrix \STATE \textbf {Step ...
2
votes
1answer
69 views

Missing line below caption in algorithm environment

Using two different computers at work and at home, I sometimes compile my thesis with one computer and sometimes with the other. Most of the time the two versions are consistent, but for algorithms I ...
1
vote
0answers
18 views

\ref to algorithm/algorithmic not working [duplicate]

I am trying to reference an algorithm in my thesis, made using the algorithmicx and algorithm packages, but it fails, ending up with the dreaded ?? and the following error: LaTeX Warning: Reference ...
2
votes
0answers
259 views

Using special characters with lstlisting

I am using the Algorithm2e package to use code in my LaTeX document. However, the code contains special characters such as à, é, è etc. Those characters causes errors such as Unicode character x not ...
4
votes
2answers
174 views

Algorithm environment problem

I am doing my master thesis and need to include an algorithm into my LaTeX code. I have been trying for hours now, but I still have several errors that always show up. It is my first time using the ...
5
votes
1answer
144 views

Algorithms and amsart

Basically, I have copied the code from answer to this quesiton, for I have to translate some words. I have only changed documentclass from article to amsart. \documentclass[11pt]{amsart} ...