Questions tagged [algorithmic]

algorithmic is an environment for typesetting {algorithms}.

Filter by
Sorted by
Tagged with
0
votes
0answers
12 views

\algstore & \algrestore : Without changing the algorithm number

My algorithm is too long to be fitted into one page. So I am \algstore & \algrestore in \usepackage{algorithm}. However, even if I can successfully split the algorithm, I think it is just making ...
1
vote
1answer
26 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
15 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
30 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
31 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
21 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
32 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
38 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
130 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
25 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
73 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
32 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
47 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
93 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
249 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
31 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
70 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
47 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
52 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
34 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
91 views

latex Algorithm

I need some help to reproduce the following algorithm in LaTeX
1
vote
1answer
223 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
79 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
144 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
375 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
70 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
58 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
23 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
44 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
129 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
95 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
108 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
409 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
31 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
174 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
137 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
29 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
119 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
174 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
40 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
152 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
129 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
242 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....
1
vote
1answer
576 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
65 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
152 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
614 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 ...
1
vote
1answer
386 views

Indentation in algorithmic package when having multiple lines

I'm using algorithmic package and I've got this code: \documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithmic}[1] \Function {BalanceCascade}{} \...
1
vote
1answer
38 views

Centering a custom-environment defined for width adjustment of algorithms

I am using the algpseudocode environment provided by the algorithmicx package in my thesis. I am wrapping the pseudocode inside the algorithmic environment provided by the algorithms package. The ...
0
votes
1answer
87 views

Algorithm mashing into definitions and overfull / underfull warnings

In a long latex doc I have I get my algorithm inserted into my definition for some reason. I apologize for not having a small working example I could not get one to work. Have a bunch of overfull and ...