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.

0
votes
1answer
35 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
1answer
24 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
33 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
24 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
60 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
30 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
58 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
62 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
85 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
45 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
113 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
58 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
71 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
19 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 ...
2
votes
0answers
194 views

Insert pseudocode into Word through Aurora and mikTex

Using Microsoft Word 2013, Windows 10 Here is my code: \renewcommand{\thealgorithm}{2} \begin{algorithm}[H] \caption{*******************************************} \label{ABCLFRS} \begin{algorithmic}...
2
votes
2answers
54 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
84 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 ...
0
votes
0answers
16 views

When writing pseudo-code I get the caption as “Procedure” when I want it as “Algorithm”

I want the caption of this pseudo-code to read Algorithm 2. I'm using the following code: \begin{algorithm}[H] \caption{This caption}\label{euclid} \begin{algorithmic}[1] \State Set $x$ from some ...
1
vote
1answer
83 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
44 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
67 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
2k 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
140 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
79 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
212 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
281 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
80 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
98 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
246 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
75 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
146 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
votes
0answers
87 views

Algorithm with indentation in LaTeX

I am trying to write an algorithm with indentation. \documentclass{article} \usepackage{algorithm}% http://ctan.org/pkg/algorithms \usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx \...
1
vote
0answers
199 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
178 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
121 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 ...
4
votes
1answer
1k 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
111 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
143 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
258 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
1k 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
664 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
515 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
122 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 ...
1
vote
0answers
761 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 ...
4
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
700 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
451 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}...
3
votes
1answer
454 views

Increase algorithm font size in beamer

I'm preparing a presentation and I'm using a beamer template. I must to increase the font size of a specific algorithm (it's not a global change). The latex code is: \begin{frame}{Serial Breadth-...
0
votes
1answer
3k views

Pseudocode Latex

How to write this algorithm pseudocode in latex: Algorithm 1 Channel Assignment using Random Ordering (RO) K←Set of channels C(v)←0,∀v∈V root← Root Selection(V) C(root)← Channel ...