Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [pseudocode]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
55 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
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
115 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
18 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
63 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
48 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
40 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
51 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
122 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
78 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
0answers
24 views

Beamer: Include Pseudocode within a columns environment

Consider the following MWE: \documentclass[10pt]{beamer} \usetheme{metropolis} \begin{document} \begin{frame}{Estimating Covariance Matrix} \begin{columns}[T] \begin{...
0
votes
1answer
141 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
39 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
31 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
90 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ě ...
1
vote
1answer
157 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
70 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 \...
0
votes
3answers
284 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
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{...
0
votes
0answers
171 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
68 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
127 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
302 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
81 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
99 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
135 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
84 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
77 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 ...
2
votes
1answer
5k 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 ...
2
votes
1answer
241 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
96 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 ...
3
votes
1answer
387 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
467 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
154 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
117 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?...
1
vote
0answers
392 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
147 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
257 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
265 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
234 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
143 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 ...
5
votes
1answer
2k views

Input and output in latex algorithm [duplicate]

In latex, I am writing a pseudocode where I want to have output (of input and output) in the following fashion: This is my code: \documentclass[sigconf]{acmart} \usepackage{amsmath} \usepackage{...
1
vote
0answers
125 views

Typesetting of block allocations in pseudo-code

I am currently writing pseudo code from a matlab code into a latex document. I a m using the algorithm2e package. I was wondering what was the best way to write down block allocations in a loop. For ...
2
votes
1answer
179 views

Formating of Pseudo code

I have the code: \documentclass[a4paper, 11pt]{article} \usepackage{comment} % enables the use of multi-line comments (\ifx \fi) \usepackage{fullpage} % changes the margin \usepackage[swedish]{babel}...
1
vote
0answers
322 views

Turn Julia code in listings into pseudocode

I am trying to automatically import code written in Julia and make it into semi-pseudocode. As an minimal example I am trying to replicate the following pseudocode style: I am guessing this was made ...
0
votes
1answer
2k views

Vertical line for pseudo code

\documentclass[two column,conference]{IEEEtran} \usepackage{algorithm} \begin{document} \begin{algorithm} \caption{HD} \label{array-sum} 1: Initialization of parameters \\ 2: Randomly ...
1
vote
0answers
717 views

How to display and cite algorithms in an Elsevier journal (using elsarticle.cls)?

Elsevier's PRL guide for authors does not include any conventions to cite algorithms. However, my manuscript includes an algorithm coded using algpseudocode enclosed in an algorithm environment which ...
4
votes
1answer
679 views

algorithm2e - How to remove space between colon and text?

How can I reduce this large space between colon and text in line with Input: ? Also please how to remove align of text after Input: and Precondition: ? I am using algorithm2e. Is it possible with this ...
2
votes
2answers
133 views

Change name in pseudocode

I am writing my code in pseudocode package and I would need to change the name "Algorithm" to "Algoritmus". Is there any possibility how to do this in this package? I have found it just for package ...