Questions tagged [pseudocode]

{pseudocode} is a compact and informal description of a computer programming algorithm.

Filter by
Sorted by
Tagged with
1
vote
1answer
17 views

Pseudocode: “If not” control structure

I use the following packages: \usepackage{algorithm} \usepackage{algpseudocode} to display pseudocode of some algorithms in my latex document. For conditionals I use the follow \If{success = 0} \...
-1
votes
1answer
64 views

Can you show me how to make this pseudocode using `LaTeX`?

Can you show me how to make this pseudocode using LaTeX?
2
votes
1answer
26 views

Pseudocode in the style of Algorithm Design (Kleinberg & Tardos)

How do you write pseudocode in the style below? I tried using the verbatim environment but I can't seem to get the variables italicized and symbols like \in to work. I also tried using the algorithmic ...
0
votes
1answer
90 views

Why do I get “Require” and “Ensure” instead of “input” and “output” phrases in my pseudocode in IEEE Access format?

When I wrote the following pseudocode in \documentclass{article} format, I get "Input" and "Output" phrases after the compilation but when I write the same latex code in the IEEE ...
0
votes
0answers
67 views

Cannot write my pseudocodes in IEEE Access format?

I am trying to write an IEEE Access paper by using the template on their website. But I am having trouble writing my pseudocodes since there is no pseudocode example in their template. When I use ...
2
votes
2answers
57 views

Using a matrix as a parameter in an algorithm

I'm trying to write a pseudocode algorithm in LaTeX, where one of the functions needs to have matrices as a parameter. I need to get it to look like this: I've been using the algorithm package, but ...
0
votes
0answers
39 views

pseudocode Environment in Latex

I am trying to write the below algorithm in Latex but failed to get the symbols which are highlighted in red. Does latex support this symbol or I am making a mistake in the script? Example script: \...
0
votes
1answer
50 views

Pseudocode notation [closed]

In pseudocode, how do you state comparisons and statements? Should I use == and = like in programming languages or should I completely switch to $=$ for comparison and $:=$ for each statement? What ...
0
votes
0answers
141 views

The package algorithmic it doesn't work in Wiley template

I'm trying to write an algorithm in a Wiley LaTeX template: \begin{algorithm} \caption{user-channel assignment algorithm} \begin{algorithmic} \STATE $Initialize$ $the \; AU \; and \; UAU \; lists$ \...
0
votes
1answer
15 views

Print apexes/superscript and subscript in quote

I am trying to print apexes and subscript in my pseudocode. I used this code to write it, but it prints it as it is without converting it in math. \begin{quote}\linenumbersep=-5pt \resetlinenumber[1] \...
0
votes
1answer
54 views

set margin 7 mm from left lineno internal line numbers

I am trying to set a 7 mm margin from the left on my pseudocode. I am using lineno package and this is what I wrote: \lipsum[2-4] \begin{alltt}{\footnotesize{\internallinenumbers S = \(\emptyset\) ...
0
votes
2answers
38 views

Adding emptyset in my pseudocode

I am trying to write some pseudocode using verbatim. The problem is, I can't get it write the right symbols. Here's my code: \begin{verbatim} S= $\emptyset$ while ((not ottimo(S) ) and (C \ne $...
0
votes
0answers
25 views

Why can I not specify two statements under an if then?

The algorithm disappears when I add \State{ stm2} \If{(conditions)} \State { stm1 } \State{ stm2} \EndIf
1
vote
0answers
35 views

Right brackets for multiple code lines [duplicate]

I'm new to latex and I was wondering is there a way to achieve something like this in latex? I have searched the internet but I achieve a good solution. This post is good but it didn't have written ...
3
votes
2answers
280 views

Modifying the algorithm name in algorithm2e

I am using the algorithm2e package to generate pseudocode for a paper. The journal requires the format of "S1 Pseudocode", "S2 Pseudocode", etc. However, I am only able to generate the format as "...
0
votes
1answer
94 views

Equation in Pseudocode problem

I am trying to write a pseudocode in Latex including an equation. My MWE is the following '\begin{algorithm} \caption{Fuzzy c-means clustering algorithm} \begin{algorithmic}[1] \State Choose ...
1
vote
1answer
46 views

Indentation not aligning while using algorithm2e package

Below is my latex: \usepackage[ruled,longend]{algorithm2e} \begin{algorithm} $I \gets \text{Images of objects' plane}$\newline $Detector \gets \text{Define detector}$\newline $Descriptor \...
0
votes
1answer
102 views

Bold some part of algorithm in overleaf, latex

\begin{algorithm} \FOR{$1\leq i \leq M$} \WHILE{$x)>x_1$} Hello world \ENDWHILE \STATE Set y=2 \ENDFOR Hello everyone, I have a question regarding the algorithm in the latex. I want to bold ...
1
vote
1answer
56 views

algorithm2e package lines are not ending in forall loop

My code is below I checked similar questions but can't find the answer. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[]{algorithm2e} \begin{document} \begin{algorithm} \...
0
votes
0answers
24 views

Use of algorithm within minipage gives error [duplicate]

I would like to adjust column width in algorithm below: \usepackage{amsmath,amssymb} \usepackage[norelsize, linesnumbered, ruled, lined, commentsnumbered]{algorithm2e} \begin{document} %\begin{...
0
votes
0answers
145 views

How to mimic this pseudo code? and conflicting packages

I am trying to mimic this algorithm but the layout is not working. How can I get the same layout (or something close to it)? See code below picture. I am using the package algo and the algo.sty link ...
2
votes
1answer
197 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:} ...
3
votes
1answer
1k views

Writing pseudocode for parallel programming

"How do you write pseudo-code for parallel programming? Especially, how do you differentiate local and shared variables? How do you represent operations like scatter, gather, reduce, broadcast, and ...
0
votes
1answer
21 views

This algorithmic command is not executing

\documentclass{article} \usepackage{algpseudocode} \usepackage{algorithm} \begin{document} \begin{algorithm} \caption{family} \hspace*{\algorithmicindent} \textbf{Input}\\ \hspace*{\algorithmicindent} ...
2
votes
1answer
1k views

Algorithmicx Nested FOR loop in pseudocode

I have been trying to format the pseudocode below combining algorithmicx and algpseudocode commands as well as following another related post algorithmicx or algpseudocode custom command indentation ...
1
vote
0answers
74 views

Can I make indent over many line on overleaf in \newtheorem?

I like to make it so that when I used \begin{pf} everything in the area is indented in a bit and when \end{pf} the text after is indented back out again, and if there are others inside it is indented ...
1
vote
0answers
125 views

How to put large pseudocode in on slide?

I have used the following beamer class for the slides. I have put some algorithms in the slide, but pseudocode not looking good \frame[shrink=25]{\frametitle{Algorithms in Quotient Groups} ...
2
votes
2answers
552 views

Adding vertical lines in algorithm2e outside of blocks

I am using the package algorithm2e and notice that it has a great feature where vertical lines can be connected within "blocks" of code (see Vertical loop/block lines in algorithmicx with 'noend&#...
3
votes
0answers
382 views

How to display vertical lines at indents in lstlisting?

I want to display vertical lines in indentations. I already found this thread: Lstlisting and indentation lines, but it isn't what I want. This is how my attempt looks like: This is how I want it to ...
0
votes
1answer
2k views

Pseudocode - repeat-until command

Hello how can I rewrite repeat until command so ''until'' in line 15 is closer to number 15 (not in the same column as line14) \documentclass{article} \usepackage{amsmath} \usepackage{algpseudocode} ...
0
votes
2answers
53 views

Pseudocodes in latex

So I'am writting paper in czech language in latex and every time I write Pseudocode - it shows Algorithm (in english) Is there a way to rewrite pseudocode name from 'algorithm' to 'algoritmus'? \...
0
votes
1answer
140 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\...
1
vote
1answer
242 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} \...
1
vote
2answers
92 views

Pseudocode in latex with multiple for cycles

\begin{algorithm} \caption{Určení sousedících clusterů} \begin{algorithmic}[1] \For {$a, b \in C$} \State předpokládej, že $a, b$ jsou sousedící \For {$k, l \in C$ a $k, l\neq a, b$} \If {$P_a P_b \...
1
vote
3answers
3k views

Format Code/Pseudocode

In a document containing a lot of other stuff, I have the following code which I have kept in verbatim(for lack of other ideas). As you can see, the alignment doesn't look so good. How do I make it ...
0
votes
1answer
130 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{...
0
votes
0answers
274 views

Formatting pseudo-code Algorithm

I need to write the algorithm as formatted in the word. I need to insert initiate statement without taking any numbers, format symbols bold to indicate matrix, change the comments font and change ...
0
votes
1answer
135 views

What is the advantage of using a pseudocode package instead of simply putting code inside of a verbatim block? [closed]

What are the advantages of using a pseudocode package (like algorithm2e) above simply putting code inside of a verbatim block? Edit: In order to make the question less vague, I will say this: ...
2
votes
1answer
195 views

Put a vertical arrow on the one column table

I made a simple table with one column and I want to imitate the pseudocode. My code is like this: \begin{table}[!h] \caption{Algorithm for CNN Architecture} \label{tab:fonts} \centering \begin{...
1
vote
0answers
620 views

Insert pseudocode into Word through Aurora and mikTex [closed]

Using Microsoft Word 2013, Windows 10 Here is my code: \renewcommand{\thealgorithm}{2} \begin{algorithm}[H] \caption{*******************************************} \label{ABCLFRS} \begin{algorithmic}...
2
votes
2answers
149 views

How to remove whitespace in pseudocode

I have this type of figure containing pseudocode and my result is like shown here: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{cryptocode} \usepackage{dashbox} \begin{...
1
vote
1answer
153 views

bad position of a section

I'm currently writing a thesis using Latex. Unfortunatly i'm facing a bad output since two days without resolving it. To explain the problem here is my output: The first page: The second page: As ...
1
vote
1answer
268 views

bad format pseudo code with algorithm2e in latex

I'm trying to add a pseudocode to my article using latex and the algorithm2e package. Unfortunatly i'm getting a bad format for one of my algorithms. Here is my latex file : \documentclass[12pt,...
0
votes
1answer
285 views

Error message when displaying algorithm

MWE below. I am working on my Bachelor's thesis and have been stuck with these errors for quite a while. They produce almost the correct output but the numbers of the lines are always zero and I get ...
1
vote
1answer
99 views

Latex for numpy boolean indexing [closed]

Assume mask is a length N boolean vector and x is a length N vector. Using numpy fancy indexing i can write: y = x[mask] How can the above operation be shown clearly, formally, and concisely using ...
6
votes
1answer
13k views

Algorithm pseudocode in markdown

I am writing a project report in markdown. Use LaTeX inside the markdown to write formulas. Then I convert the markdown file to PDF with pandoc. All works like a charm. But, I would like to include ...
3
votes
1answer
627 views

sans-serif font in text, monospace serif within algorithm

In my .tex document I use sans-serif font with \sffamily. (And I don't want this to be monospace!) For my algpseudocode I tried using \texttt. (For I want using a serif monospace font.) Please take ...
2
votes
1answer
116 views

How do I get separate source code functions in one line?

It it difficult to create a question for this. I want to tex source code like here. Is this with listings? Which package do they use? How do I get the separate procedures in one line? And how do I get ...
5
votes
1answer
1k views

algorithm2e: do N times

I want to write this in algorithm2e pseudocode: Do N times stuff that has to be done N times end or maybe Repeat N times stuff that has to be done N times end Since the loop body does not ...
1
vote
1answer
2k 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}{} \...