A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [algorithmic]

algorithmic is an environment for typesetting {algorithms}.

Filter by
Sorted by
Tagged with
0
votes
1answer
17 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
1answer
31 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
58 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 ...
2
votes
1answer
30 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-...
0
votes
0answers
17 views

Is there a way to get capital While in algorithms environment?

Is there a way to get capital While in algorithms environment? Not sure if that's a good idea or not but is there a way to do it?
1
vote
1answer
15 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
82 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
32 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
78 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,...
1
vote
1answer
65 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, ...
0
votes
1answer
78 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] ...
0
votes
0answers
25 views

Algorithm exceeds page, short captionof form in TOC needed

I know this has been asked a couple of times, however the usual advices in using only the algorithmic environment without algorithm doesnt seem to work as i lose my algorithmn numbering and the short ...
2
votes
1answer
53 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:} ...
1
vote
1answer
49 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
71 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
42 views

Remove braces around the comment

I would like to remove these braces around the comment I would like the comment to look like this //AtLeast1T Leaf as opposed to this {//AtLeast1T Leaf} and I would like to keep using the algorithmic ...
0
votes
0answers
36 views

algorithm with vertical line

i created the following algorithm but i am not satisfied with the output.So i was wondering is there a way to add vertical lines in my algorithm but also keep the same structure and be able to put it ...
0
votes
0answers
46 views

Adjust design of algorithm when using the algorithmic package

I am using overleaf and I have inserted an algorithm into an template for a conference. Unfortunately, the algorithm is not displayed in the way I like: -the caption should be above the steps -there ...
0
votes
0answers
62 views

If else statement inside a step of algorithm

I am trying to write if-else loop in an algorithm within the substeps. Somehow it doesn't appear as expected. \documentclass[]{article} \usepackage{algorithm,algpseudocode,float} \usepackage{...
1
vote
1answer
144 views

Remove \Endif from algorithm

I want to write the following algorithm in LaTeX. The code I used is as follows: \documentclass{article} \usepackage{algorithm} \usepackage{algorithmic} %\usepackage{algpseudocode} %\algtext*{EndIf} ...
2
votes
2answers
692 views

Else If is not working on algorithm in algpseudocode

I tried to add \Else in my pseudocode using packages algorithm and algpseudocode but it is not showing and I am getting Missing number, treated as zero. This is my code and the current outcome. \...
0
votes
0answers
33 views

The algorithm does not execute in IEEE transaction template. Please help [duplicate]

\documentclass[journal]{IEEEtran} \usepackage[classicReIm]{kpfonts} \usepackage{booktabs,tabularx,lipsum} \usepackage{longtable} \usepackage{float} \usepackage{graphicx} \usepackage{subfigure} \...
0
votes
1answer
102 views

Error emerged when I run the following LaTeX code

The following code gives error message: \documentclass[energies,article,accept,moreauthors,pdftex,10pt,a4paper]{mdpi} \usepackage{booktabs} \usepackage{array} \newcommand{\PreserveBackslash}[1]{\let\...
0
votes
0answers
35 views

Pseudocode in latex with fractions with text [duplicate]

So I´ trying to re-write this pseudocode in latex My pseudoce is like this: \begin{document} \begin{algorithm} \caption{Učící mechanismus obcí} \begin{algorithmic}[1] \While {Obce ještě ...
0
votes
1answer
92 views

Representing Objects/Classes in Latex

I was curious... I couldn't find this in any of the documentation of the algorithm2e and algorithmicx packages. I'm wondering if there's a way to represent objects with attributes in LaTeX. Would help ...
1
vote
1answer
202 views

Some help needed with pseudocode in LaTeX

Hello trying to writte pseudocode in Latex I cant fix mistake in line 8 code: \begin{algorithm} \caption{Učící mechanismus všech obcí} \begin{algorithmic}[1] \While {Obce ještě nedokonvergovaly} \...
2
votes
1answer
330 views

Is it possible to draw vertical lines in algorithm (not algorithm2e) package?

My question is if it is possible to draw vertical lines in the algorithm package. I have seen the following question: Vertical line for pseudo code But I don't want to use algorithm2e because it ...
1
vote
0answers
36 views

Remove “end if” lines using algorithmic

I'm new to Latex and currently writing pseudocode using algorithmic. I want to remove all "end if" lines from the code. I tried to use \usepackage[noend]{algpseudocode} but it does not work (see the ...
0
votes
1answer
136 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
52 views

How to have a space between algorithm lines

I have an algorithm and I would like to insert space between its steps. Here is my try: \documentclass[12pt,a4paper,openright]{report} \usepackage{amsmath} \usepackage{amssymb} \usepackage{...
0
votes
1answer
72 views

An error in inserting pseudo code in LaTeX

I want to insert a simple pseudo code as follows, but I confront with an error and I am not able to resolve it. \documentclass{article} \usepackage{algpseudocode} \usepackage{algorithm} \usepackage{...
-1
votes
1answer
41 views

Problem in package algorithmic

This is my code : \begin{algorithmic} \STATE Sort increasingly the $a_{i}, i=1,...,n$ \STATE $a_{n+1}\gets \infty$ \STATE $m \gets 1$ \STATE $\Tilde{x} \gets \infty $ \WHILE{$ \Tilde{x} \geqslant a_{...
0
votes
1answer
114 views

latex Algorithm

I need some help to reproduce the following algorithm in LaTeX
1
vote
1answer
457 views

Algorithm returning 0

I wrote algorithms using the algorithm and algorithmic packages, but I always get the last line returning 0. I tried to use this solution, but I could not make it work. Below my algorithm code and ...
1
vote
1answer
193 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 ...
1
vote
1answer
254 views

errors in latex algorithm formatting Something's wrong--perhaps a missing \item

I am trying to write an algorithm and I receive the following errors Missing = inserted for \ifnum. \end{algorithmic} Command \algorithmic already defined. } Missing = inserted for \ifnum. \end{...
3
votes
1answer
874 views

How can I create an initialization block in an pseudo algorithm block in Latex?

How can I create the following algorithm block in Latex? I have everything except the init block. How can I create this? \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{algorithm2e} ...
0
votes
0answers
123 views

Text overwriting line number in algorithmic environment - Solved

Below is a MWE consisting of two small algorithms demonstrating how the unnecessary use of {...} environment can cause unexpected behavior from LaTeX, i.e., overwriting line number as shown in the ...
1
vote
0answers
93 views

Algorithmen Substate

I am trying to TeX my description of one of my algorithms. My Algorithm will be described by words not by code. My first Problem was that i rather like the 1. Notation over 1: I solved this by \...
2
votes
1answer
28 views

Disable algorithm numbers for only certain algorithms in a document

I have the following MWE \documentclass[runningheads]{llncs} \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm}[H] \caption{BLAH} \begin{algorithmic}[1] \REQUIRE $...
2
votes
2answers
77 views

How to achieve proper formatting with minipage and algorithmic packages

Following this question, I used the solution in my document as follows but as you can see in the output, the algorithms do not start and end at the same levels. Is there a way I can make the ...
4
votes
1answer
219 views

Referencing line numbers in an algorithm using autoref

What is the autoref command to reference a line number of an algorithm? I tried to define stepautorefname, linenoautorefname and alglinenoautorefname commands as shown below but they don't work like ...
4
votes
1answer
159 views

Changing line numbering format using algorithmic package

The following code numbers each line in the algorithm as <number><colon>. Is there a way to number each line as <number><period>? \documentclass{article} \usepackage{algorithm,...
2
votes
1answer
258 views

Using \vv within in algorithmic

For the document below, I'm getting errors, shown below, when using \vv in the algorithmic environment. If I change to \vec, there is no error. What can I do to continue using \vv? \documentclass{...
2
votes
1answer
812 views

Algorithm In LaTeX Elsevier Template

Actually, I wrote algorithm first in general LaTeX format and done successfully. Following algorithm packages I had used: \usepackage{algorithm,algpseudocode} \usepackage{algorithmic} \usepackage{...
0
votes
0answers
32 views

Divide a algorithm with small sub parts in more than one page [duplicate]

I want to write down a algorithm using TeXStudio. The algorithm is very huge so it cannot fit in one page. I use \usepackage{algorithm} ,\usepackage[noend]{algpseudocode} to write down this algorithm. ...
1
vote
2answers
261 views

Error with algorithm package occurred when using standalone subfile

I am trying to create a standalone subfile in which I want to add some algorithms. The document is compiled right when I am using the \documentclass[9pt]{article} in the preamble. But the following ...
1
vote
1answer
179 views

algorithm and tikzpicture side by side

How can I put minipage and tikzpicture side by side? I would like the right picture to centre (now it is aligned to the top) and give it a figure environment so I can give it a caption. This caption ...
0
votes
1answer
36 views

How to make algorithm centred in text and take less space (smaller width)

How to make algorithm bar shorter? \begin{algorithm}[H] \caption{Exact Invariant Simulator} \begin{algorithmic}[H] \label{alg:eisim} \FOR{$r \in \{1,2,...,R\}$} \...
2
votes
0answers
182 views

writing a data structure in an algorithm [closed]

I am trying to write up a data structure in my algorithm. \documentclass[]{IEEEtran} \usepackage{algorithm,algpseudocode} \begin{document} \begin{algorithm} \caption{Algorithm1} \begin{algorithmic}[...