Questions tagged [algorithmic]

algorithmic is an environment for typesetting {algorithms}.

Filter by
Sorted by
Tagged with
0
votes
1answer
36 views

Algorithmic “for” and “end for” don't not begin new line

I'm using a for loop in an algorithmic environment as follows: \begin{algorithm} \caption{data collection} \begin{algorithmic}[1] \Procedure{Synthesised data}{\textit{input:} control docs} ...
1
vote
1answer
17 views

Errors with algorithm and algorithmic usepackages

I'm writing pseudocode within the algorithm and algorithmic environment but both the numbering and typesetting get completely messed up. \usepackage{algorithm} \usepackage{algorithmic} \usepackage[...
1
vote
1answer
25 views

Making equation more compact in algorithmic and algorithm in double column

I am writing a pseudocode for algorithm under sty file aistats2021.sty using algorithmic and algorithm package. My question is how can I fit line 14 in one line? And here is the latex code. \...
0
votes
1answer
33 views

Box around an algorithm that spans two columns

Consider the following code, that provides a box around an algorithm. However, it does not work when the algorithm needs to span both columns in a double column article. To be specific, when I use \...
2
votes
1answer
11k views

How to use Function in latex algorithm?

begin{algorithm} \SetAlgoLined \DontPrintSemicolon \KwIn{$ NPs $\Comment*[r]{All Noun Phrases of D}} \KwOut{$ {NPs}^{'}$ \Comment*[r]{NPs without PHIs}} \SetKwFunction{Fun}{PHIsDetection} \Fun{$...
0
votes
0answers
16 views

Pagebreak in an algorithm using algstore/algrestore

I'm trying to use algstore/algrestore to split an algorithm over two pages. However, I would like to not insert a title in the split portion of the algorithm, similar to what is shown here. My only ...
3
votes
1answer
57 views

Highlight Lines in side-by-side algorithm

I have a 2 column latex template (IEEEtran), in which I put 2 algorithms side by side: \documentclass[10pt,conference]{article} \usepackage{algorithm} \usepackage{algorithmic} \usepackage{xcolor} \def\...
2
votes
1answer
643 views

Algorithm: overlapping code lines and misplaced final horizontal line

I am currently adapting an article to the MDPI template and I have encountered some problems with the algorithm package. Code lines overlap and the last code line appears below the end horizontal line....
0
votes
1answer
25 views

Reference to substeps (substates) of an algorithm

I'm using the algorithmicx package, and also a substate (substep) environment from the answer HERE. The problem is that referring to the substates, and even some normal states is broken. I tried ...
2
votes
1answer
36 views

Is there a way to make latex ignore case sensitivity in its algorithmic package?

I am writing a report which constitutes separately prepared documents. Unfortunately almost all the documents have algorithms written in different formats like \WHILE and \While . I am having an issue ...
0
votes
0answers
21 views

Why my pseudocode's indentation is rendering incorrectly?

I have the following LaTeX code for a pseudocode block. \begin{algorithm}[H] \caption{Particle Swarm Optimization para Dados Relacionais} \begin{algorithmic} \REQUIRE A matriz de dissimilaridade $D$, ...
0
votes
0answers
55 views

The package algorithmic it doesn't work in Wiley template

I'm trying to write an algorithm in a Wiley LaTeX template: \begin{algorithm} \caption{user-channel assignment algorithm} \begin{algorithmic} \STATE $Initialize$ $the \; AU \; and \; UAU \; lists$ \...
0
votes
0answers
28 views

Indent Latex algorithm numbering

I am using algorithm and algorithmic package to right the algorithm. But at some point, indentation in the numbering of the algorithm got mixed up please see the code and image. \begin{algorithm}[H] \...
2
votes
1answer
24 views

Decrese algorithmic indent

I am using algorithmic inside a tcolorbox. It has by itself a margin and combined with the indent from algorithmic it is too much: \documentclass{standalone} \usepackage[many]{tcolorbox} \...
1
vote
0answers
12 views

Missing list of Algorithm in the content

The command in my tex \listofalgorithms is detected as unrecognized command. In the generated pdf file. The page of Algorithm is presented, while in the content, this page is skipped. So what can I do ...
1
vote
1answer
36 views

Using algorithm2e, how to make IF condition 1 OR conditions 2 OR conditions 3 THEN

Using algorithm2e currently when I do this \If{ condition_1 OR condition_2 OR condition_3} But if the stuff between {} is too long, it wraps around and does not look good since there is no ...
0
votes
1answer
30 views

why adding hyperref makes algorithm2e not span pages any more?

TL 2020. compiled using lualatex I have set up of the form \begin{algorithm}[H] .... \end{algorithm} \begin{algorithm}[H] .... \end{algorithm} \begin{algorithm}[H] .... \end{...
1
vote
1answer
24 views

For loop not working properly in algorithm

The example and output is attached \documentclass[journal]{IEEEtran} \IEEEoverridecommandlockouts \usepackage{url} \usepackage{footnote} \usepackage{...
0
votes
1answer
62 views

Incorrect reference line in algorithmic and algorithm package. Everything is referenced as line number 1 [closed]

I am using algorithm and algorithmic package to write pseudocode of algorithm. But when I refer to labels defined inside the algorithm, it always says it's line 1. I am at a loss to figure out how to ...
0
votes
0answers
12 views

Something's wrong--perhaps a missing \item. \end{algorithmic}

Usage of algorithmic package in following way gives me error \documentclass{article} \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm} \begin{algorithmic} ...
0
votes
0answers
35 views

Is there any alternative for using \algsetup{linenodelimiter={}} with algpseudocode

I'm using algpseudocode library to write down my first algorithm in latex while showing line blocks. All I need to do is to change the style of the numbering from 1: to be 1 (without either . or :) I ...
1
vote
1answer
38 views

Latex Error “Command \AND already defined. \REQUIRE” with ifacconf document class

I have been getting the following error "Command \AND already defined. \REQUIRE" when using algorithms in ifacconf document class. I couldn't figure the cause of it. A sample code can be found below: ...
1
vote
2answers
26 views

Hide the numbering of some lines in algorithmc

I have the following LaTeX algorithm's code. I just need to hide the numbering of the first three lines; any suggestions? \documentclass{article} \usepackage{algorithm} \usepackage{algorithmic} \...
0
votes
1answer
33 views

Equation in Pseudocode problem

I am trying to write a pseudocode in Latex including an equation. My MWE is the following '\begin{algorithm} \caption{Fuzzy c-means clustering algorithm} \begin{algorithmic}[1] \State Choose ...
0
votes
0answers
242 views

Algorithm.sty not found

I have been using Miktek 2.9 and Texstudio as editor. There was a missing package of algorithms. I had downloaded it. Generated .sty file from .ins file. Copied the files to tex/latex. Refreshed FNDB. ...
0
votes
0answers
40 views

cref & algorithmic incorrect referencing [duplicate]

I tried to use the tipps in this post cleveref and algorithm2e. But it does not lead to the correct referencing, what is done wrong here and how to i get cref running with algorithm? \documentclass[]{...
0
votes
1answer
23 views

Algorithm Indentation issue with Multicols

Issue with indentation in an algorithm block inside multicols: Is this a known issue? \documentclass{article} \usepackage{amsfonts} % blackboard math symbols \usepackage{amsmath} % required for \...
2
votes
1answer
87 views

Missing $ inserted, Missing \endgroup inserted

I am writing an algorithm in latex. I am getting some error. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \title{Demo} \author{Subhadip Patra } \date{March 2020} \...
0
votes
1answer
144 views

How to write an algorithm in algorithm environment in Latex?

How do I write the following algorithm/pseudocode in algorithm environment in Latex? train_ANN(fi,wi,oj) For epochs from 1 to N While (j<=m) Randomly initialize wi={w1,w2…..wn} ...
1
vote
1answer
293 views

Latex generate error in IEEE ACCESS template in Figure, Algorithm, and Table

\documentclass{ieeeaccess} \usepackage{cite} \usepackage{amsmath,amssymb,amsfonts} \usepackage{algorithmic} \usepackage{graphicx} \usepackage{textcomp} \begin{document} \begin{table}[h!] \centering ...
1
vote
0answers
68 views

How to add C++ style multi-line comment in algorithmic Latex

I am using algorithmic to write a pseudocode in Latex. I wish to add both single(//) and multiple(/**/) lines comment in my code. \Procedure{Foo}{$x$} \State Set $a\gets b+c$ \LONGCOMMENT{this ...
5
votes
2answers
10k views

Algoritmic return command = 0

Can you suggest me what is wrong with using return command in algorithms. when I add \RETURN $C to my LaTeX document I get return C =0, what I need is just return C. \begin{algorithm} ...
0
votes
1answer
75 views

Algpascal body?

I was going thorough the documentation of AlgPascal of package http://tug.ctan.org/macros/latex/contrib/algorithmicx/algorithmicx.pdf My question here is when I am using \For{k\gets 1}{K} <...
1
vote
0answers
76 views

Floatrow distorts algorithm caption

This is the template for a conference: https://media.icml.cc/Conferences/ICML2020/Styles/icml2020_style.zip. I'm using that template for my paper. However, when I do \usepackage{floatrow}, it distorts ...
2
votes
1answer
193 views

Vertical line and numerating problems when using algorithm package to split an algorithm with long texts

I am making a two parts splited algorithm with vertical lines and numbering. I prefer to use algorithm package rather than using algorithm2e package, because this one does not provid either \algstore ...
1
vote
1answer
172 views

Is there a way to include an algorithm from external file?

I mean: when I put some code in my docs I can include it whitout writing all code in main document. Is there a similar thing for algorithm?
1
vote
1answer
40 views

How can I add a comment to an ELSIF?

I have a problem displaying a comment, I would like the comment to be displayed at the right of "then" in the second and the third if statements and here is what I obtain instead. \documentclass[...
2
votes
1answer
184 views

Algorithmic label cross references not working

I'm using the Latex style files of ICML 2020, that can be found here. In particular, they supply algorithm.sty and algorithmic.sty. When I try to reference a line in an algorithm, I get a cross-...
1
vote
1answer
53 views

Adding caption in algorithmic package without using algorithm

For an IEEE submission I am not allowed to use algorithm package. They recommend to use algorithmic package. I am not able to add caption in the algorithmic package. This and this answer solves the ...
4
votes
1answer
162 views

Tabular-like alignment in algorithm

Is there a way to encapsulate every line in some dotted lines, and add on the right side 2 columns such that it would look the the picture below? And on every line I can write math equations or ...
3
votes
1answer
236 views

Footnote does not appear under algorithm

I have created pseudocode for an algorithm and would like to add a footnote under the algorithm. However, when I try to apply the answer provided here, no footnote does appear. See the following ...
2
votes
1answer
143 views

Write pseudo algorithm in LaTeX

I am trying to write pseudocode in my paper. Here are the snippet and the image like what I want. Can someone please help me to format it? \begin{algorithm}[H] \DontPrintSemicolon $D_{obs}{(f,Nx,Ny,x,...
0
votes
1answer
435 views

! Undefined control sequence. \Procedure

I follow http://shantoroy.com/latex/how-to-write-algorithm-in-latex/ and https://www.overleaf.com/read/rddymzwmnqgb I have \begin{algorithm} \caption{Put your caption here} \begin{algorithmic}[1] ...
1
vote
1answer
73 views

Algorithmic and hyperref packages: strange interaction

I am not sure the bug below has already been reported as I cannot find clear information online. See the MWE: if \usepackage{hyperref} is not commented, the space below the equation is fairly large, ...
2
votes
1answer
127 views

How to fix an issue about multiple output lines in algorithm

When I write a pseudo code using algorithm and algorithmic. Output statement overflow a line like below. \begin{algorithm}[!h] \textbf{Input:} The set of public $parameters$\\ \textbf{Output:} ...
0
votes
1answer
279 views

Vertical Lines in Algorithms not appearing

I am using \documentclass[5p]{elsarticle} and packages \usepackage{algorithmic} \usepackage[ruled, vlined, longend, linesnumbered]{algorithm2e} There is no error but did not get the vertical lines in ...
1
vote
1answer
179 views

algorithmic package dont automatically break page when too long [duplicate]

I have an algorithm defined with algorithmc like this: \documentclass{article} \usepackage{algorithm} \usepackage{algorithmicx} \begin{document} \begin{algorithm} \begin{...
0
votes
1answer
181 views

Using \cref for algorithm step

What \crefname do I provide for referring to a step of an algorithm (not the algorithm float itself!)? I am able to label the steps of an algorithm and refer them using \ref but how do I use \cref ...
1
vote
1answer
328 views

avoid line overflow in algorithm

How can I stop lines of my algorithm to be overflowing as shown in the picture below, I would like to break the lines that are too long into 2 lines and just go down to the next line if one line ...
15
votes
2answers
27k views

Unnumbered lines in algorithm

My question is similar to this one, I need to skip number for some lines of the algorithm. However the solution from that question does not work for me. How can I disable numbers for some lines using ...

1
2 3 4 5