Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [algorithmic]

algorithmic is an environment for typesetting {algorithms}.

Filter by
Sorted by
Tagged with
1
vote
1answer
12 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
51 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
16 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
61 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
45 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
63 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
0answers
21 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
40 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:} ...
2
votes
2answers
7k 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} ...
1
vote
1answer
322 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
115 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
37 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
47 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
138 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
23k 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
vote
1answer
37 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
36 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
56 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
101 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
481 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
1answer
95 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\...
2
votes
1answer
664 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
29 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} \...
3
votes
1answer
2k 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} \...
0
votes
1answer
68 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 ...
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ě ...
1
vote
1answer
194 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} \...
186
votes
1answer
99k views

algorithm, algorithmic, algorithmicx, algorithm2e, algpseudocode = confused

I am confused about the packages for writing simple "algorithms". There are too many options, and it is confusing when to use what. For example, if I use algpseudocode, then I can't add algorithmic ...
2
votes
1answer
309 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
34 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 ...
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
65 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
102 views

latex Algorithm

I need some help to reproduce the following algorithm in LaTeX
1
vote
1answer
375 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
208 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
727 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
115 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
81 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
26 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 $...
4
votes
1answer
189 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 ...
11
votes
2answers
40k views

Pseudocode: \Function vs. \Procedure?

The title says it all. What is the difference between a Function and a Procedure? When should I use which?
2
votes
2answers
65 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
150 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
798 views

latex algorithm displaying problems: lines are overlapped

duplicate I am using algorithm package (built with pdflatex -shell-escape -synctex=1 -interaction=nonstopmode under TexStudio) to draw my algorithm. It works well on a template, but when I switch to ...
2
votes
1answer
205 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{...
1
vote
2answers
243 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 ...
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. ...
2
votes
1answer
189 views

Pseudo-code with algorithmic. Escape and indent a function using varwidth and parbox

I'm using the algorithmic package to create pseudo-code for my document. One of the algorithms has a few lines that are too long and they go too far to the edge of the page so I wanted to add a ...