Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pseudocode]

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

1
vote
0answers
33 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
43 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
24 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
15 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
53 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} ...
1
vote
0answers
40 views

2-opt in pseudocode

Hello I am trying to write 2-opt local search algorithm for tsp in pseudocode -- is this completed or not? I am not sure. \documentclass{article} \usepackage[top=25mm,bottom=25mm,right=35mm,left=...
0
votes
2answers
37 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
26 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
72 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
31 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
71 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
64 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
107 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
50 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
145 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
60 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
86 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{...
0
votes
1answer
24 views

How to add full width code in NAACL 2016 template

I am working on a school project that involves writing a paper using the NAACL 2016 template. I know I can make a single column figure using \begin{figure}...\end{figure}, but I'd like to add some ...
1
vote
0answers
255 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
62 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
93 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
103 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
51 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
71 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
3k 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
179 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
84 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
274 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
338 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
90 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
105 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?...
0
votes
0answers
282 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
118 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
193 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
210 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
219 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
125 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
119 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
157 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
281 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
688 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 ...
3
votes
1answer
577 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
125 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 ...
1
vote
1answer
1k views

Style Pseudocode in LaTeX

I'm trying to replicate the style of the following pseudocode taken from 'The Elements of Statistical Learning'. I've tried with algorithm,algorithmic and enumerate (for the item) but I haven't ...
2
votes
0answers
1k views

Latex algorithm standards [closed]

I have written some latex code for some pseudocode I written which uses: \usepackage{amsmath} \usepackage{algorithm} \usepackage[noend]{algpseudocode} I was wondering whether there is a standard for ...
3
votes
1answer
1k views

How to remove header and line numbering from algorithmic?

I created a pseudocode algorithm like this: % Pseudo code % \usepackage{amsmath} \usepackage{algorithm} \usepackage[noend]{algpseudocode} \algdef{SE}{Begin}{End}{\textbf{begin}}{\textbf{end}} \begin{...
2
votes
1answer
769 views

ForEach loop with \usepackage[noend]{algpseudocode}

I used the perfect answer from here How can I define a ForEach loop on the basis of the existing ForAll loop? to define for each loop. Once I replace \usepackage{algpseudocode} with \usepackage[...
1
vote
1answer
504 views

algorithm2e - can't get ends to line up in for loop

This is my code: \begin{algorithm}[H] \SetAlgoLined \KwResult{Computes Flux in x and y direction} \KwIn{arrays flux\_x and flux\_y of length $x \times y$} \SetKwArray{fluxx}{flux_x} \SetKwArray{fluxy}...