Questions tagged [pseudocode]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
24 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
33 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
69 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
17 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
19 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
44 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 ...
0
votes
0answers
15 views

Indentation of blocks and number-skipping algorithmicx package

I'm having a few issues regarding indentation and line numbering with the algorithmicx package. I don't really understand from the package documentation how to do the following: I would like to ...
1
vote
1answer
27 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
23 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
23 views

Expressing a parallel algorithm in pseudocode environment

I am using algorithmicx to write some pseudocode and I'd really like to show some things are done in parallel - but there seems no obvious way to express this parallelism: so I am left putting the ...
0
votes
0answers
101 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
89 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
450 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
19 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
462 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
57 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 ...
0
votes
0answers
79 views

Pseudocode split into parts

I'm trying to write a block of pseudocode like here I know how to remove line numbers and get the black lines at the top and the bottom. I don't know how to label each section like 'Process' and '...
1
vote
0answers
80 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
343 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&#...
2
votes
0answers
209 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
650 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
47 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
0answers
36 views

Pseudocode with fraction with words [duplicate]

trying to write this pseudocode in Latex, however I canot solve line 15 (fraction with words) I would like to ask for any advice Thank you \begin{algorithm} \caption{Učící mechanismus všech ...
0
votes
1answer
116 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
225 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
78 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
1k 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
93 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
213 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
88 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
161 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
437 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
120 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
119 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
209 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
144 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
92 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 ...
3
votes
1answer
9k 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
411 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
108 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 ...
4
votes
1answer
691 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
911 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
300 views

How to present my code output in LaTeX?

I try to create an application that takes several inputs and represent them in a comprehensive manner. Let's say I have the following script: x = 5 y = 'meters' z = 'second' and I want to get a pdf/...
1
vote
1answer
134 views

How to achieve this type of format when writing pseudo-code?

I want to achieve the following type of format when writing pseudo-code, but I am struggling to achieve it with algorithm package: Is this written with the algorithm package, or is it another package?...
2
votes
0answers
577 views

Explaining function parameters in pseudocode

I am writing pseudocode using the algorithmicx package. I am using the \Comment function to explain definitions inside the algorithm, but I'm unsure what the proper way of explaining what the function ...
2
votes
1answer
207 views

Display “Pseudocode” instead of “Algorithm” in \begin{algorithm}

Instead of the "Algorithm" which gets automatically added when used with \usepackage{algorithm}, I want it to display as "Pseudocode", How can I do this? : Like the "Pseudocode" written in this: The ...
1
vote
1answer
391 views

algorithm2e line between for and end not appropriate

Has anyone an idea why the line does not match with the first end, but instead with the second? \documentclass{article} \usepackage{mathrsfs,amsmath,bm,amsfonts} \usepackage[ruled,vlined]{algorithm2e}...
1
vote
0answers
314 views

How to solve ! Undefined control sequence. error in Latex

I am using packages \usepackage{algpseudocode}, \usepackage{algorithm} to run below algorithm but it gace error! Undefined control sequence. l.1248 \IF $f(X_{i})$ better $f(X_{k})$? Please tell ...
0
votes
1answer
258 views

Latex formatting a pseudocode

I have this matlab code and i want to write it's pseudo code in latex, how can i convey the same message as this code. The code is given below for i=1:32 if(1<=i&&i<=16) z=...
3
votes
1answer
156 views

How to reproduce this pseudocode? [duplicate]

I am trying to replicate the style of the following pseudocode. The following minimal working example almost produces what I want except the extra vertical space between lines 7 and 8. How can I ...