The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [algorithmic]

algorithmic is an environment for typesetting {algorithms}.

Filter by
Sorted by
Tagged with
1
vote
1answer
57 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
19 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
20 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
35 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
34 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
35 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
35 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
34 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
32 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
51 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
77 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
369 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
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} \...
0
votes
1answer
89 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
34 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
64 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
154 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
290 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
33 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
104 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
51 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
57 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
39 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
98 views

latex Algorithm

I need some help to reproduce the following algorithm in LaTeX
1
vote
1answer
340 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
116 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
188 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
626 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
102 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
72 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
24 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
55 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
178 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
134 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
180 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
578 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
220 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
153 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
30 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
136 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}[...
0
votes
1answer
197 views

How to write a block of a real code (and not pseudo-code) in Latex?

I want to write the following code in latex, such that in pdf, we see the same format of writing (except background color and font colors). However, by algorithmic, output format is different. Is ...
0
votes
1answer
48 views

How to remove page number for the page includes “algorithm pseudo-code”?

I want to remove page number of the page of algorithm pseudo-code. I used afterpage as explained in this answer as follows: \afterpage{% \begin{algorithm} \begin{algorithmic}[1] ...
1
vote
1answer
174 views

Undefined control sequence \for loop

\begin{algorithm}[tb] \scriptsize $\prod_m$: Manipulated Call Trace, \scriptsize $\prod_n$: Natural Call Trace \\ \scriptsize $\Delta_m$: Unaligned Call Trace in $\prod_m$, \scriptsize $\Delta_n$:...
2
votes
1answer
168 views

How to force procedure name to be in small caps

When using algorithm environment: \begin{algorithm}[!t] \caption{Title} \begin{algorithmic}[1] \Procedure{\textsc{Graph}}{$ \alpha, \beta $} \State ... \EndProcedure \end{...
1
vote
1answer
297 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....
2
votes
1answer
752 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 ...
1
vote
1answer
77 views

Correct loading order of package newfloat along with hyperref and algorithmic packages?

There is extensive documentation that hyperref must be loaded towards the end. In particular, the following is the correct loading order for these specific packages: \usepackage{float} \usepackage{...
1
vote
0answers
190 views

Inline For Loop for algorithmic package

Using algorithmic package I would like to have an inline for loop. Currently I have the following code: \documentclass{article} \usepackage{algorithmic} \begin{document} \begin{algorithmic} ...
0
votes
0answers
765 views

How to resize an algorithm to fit into one page

I am using algorithm2e for writing an algorithm. I have a long algorithm that exceeds one A4 page length. But I want to compress it to fit into one page (resize percentage). I tried \resizebox but ...