Questions tagged [algorithmic]

algorithmic is an environment for typesetting {algorithms}.

28 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
127 views

LyX: Can't compile with \usepackage{algpseudocode} with Language that isn't English

I'm pretty new to LyX and Latex. I'm writing a paper in Hebrew and I want to add an algorithm in English. So I'm adding \usepackage{algpseudocode} to the Preamble and pasting some example algorithm. ...
2
votes
0answers
828 views

How to set algorithm width to avoid overfull \hbox problem

I wrote the following latex text, but the log shows an error that overfull \hbox(10.0pt too wide) detected. I am sure that the algorithmic part exceed the width limit. Even if I type a few words, the ...
1
vote
0answers
29 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 ...
1
vote
0answers
43 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 ...
1
vote
0answers
37 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
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 \...
1
vote
1answer
380 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
0answers
244 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} ...
1
vote
0answers
522 views

Referencing a range of lines in algorithm

How is it possible a cross-reference a range of lines in an algorithm? I can cross-reference a single line easily using the simple \label(...) and then \ref(...) to cross-reference it. For example ...
1
vote
0answers
116 views

The customized font going out of right margin of the page in algorithmic

I am using algorithmic package in latex to write an algorithm. I have customized the font style for the comments to my need. For this I have used the two commands to define \COMMENT and \LONGCOMMENT ...
1
vote
0answers
405 views

Fixing position for Algorithm2e does not work

I have the following minimal example. When I compile this, the result is fine, as expected. \documentclass[ngerman,12pt,a4paper]{report} \usepackage[left=2cm,right=2cm]{geometry} \usepackage{...
1
vote
0answers
301 views

algorithmicx - How to change “Procedure” to “def”

I am using algorithmicx. It gives a block using \Procedure. However, I want to make my presentation of algorithms in python style, since I implemented it in python. In python, to define a function, ...
1
vote
0answers
244 views

Error with algorithm and algorithmic packages

I have the following problem that involves the algorithm and algorithmic packages with the garamondx font. This is a minimal example: \documentclass[letterpapet,10pt]{article} \usepackage{garamondx} ...
1
vote
0answers
505 views

writing Algorithm in Latex

I want a Latex code that will write the following algorithm using \begin{algorithm} and \begin{algorithmic}. I have done this \floatname{algorithm}{Procedure} \renewcommand{\algorithmicrequire}{\...
1
vote
0answers
2k views

Switch statement using algorithmic environment

How to use Switch statement in algorithmic environment. I tried the following sample code but the errors are: unrecognized command (algorithmicswitch, algorithmiccase, \Switch, \EndSwitch, \Case, etc.)...
1
vote
1answer
71 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
20 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} ...
0
votes
1answer
29 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 ...
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?
0
votes
0answers
26 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 ...
0
votes
0answers
37 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
49 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
64 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{...
0
votes
0answers
129 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 ...
0
votes
0answers
1k 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 ...
0
votes
0answers
452 views

Algorithm indent problem with sig-alternate document & algorithm(ic) package

Can anyone tell me why the indention of the algorithm does not work? I have the following code: \begin{algorithm} \caption{STEP 1} \begin{algorithmic}[1] \REQUIRE Something \FOR{\textbf{each} $user$}...
0
votes
0answers
3k views

how to use \algsetup in latex environment

I am using the "algorithmic" environment and want to use \algsetup. But getting an error. \documentclass{article} \usepackage{algpseudocode} \usepackage{algorithmic} \usepackage{float} \begin{...
0
votes
0answers
968 views

algpseudocode is not formatting properly in elsarticle template

I am using algpseudocode to write pseudo code. I am noticed that the pseudo code is justify aligned, which doesn't look good here. Below is the snippet of latex code- \usepackage{algorithm} \...