Questions tagged [algpseudocode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
40 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
1answer
59 views

Indent at automatically generated line breaks is lost for long single statements in algorithm

MWE: \documentclass[11pt,a4paper,notitlepage]{report} \usepackage{amsmath} \usepackage{amsthm} \usepackage{amssymb} \usepackage{algorithm}% http://ctan.org/pkg/algorithms \usepackage{algpseudocode}% ...
0
votes
0answers
37 views

If else statement inside a step of algorithm

I am trying to write if-else loop in an algorithm within the substeps. Somehow it doesn't appear as expected. \documentclass[]{article} \usepackage{algorithm,algpseudocode,float} \usepackage{...
1
vote
1answer
55 views

Error Message in Displaying Algorithm

I am writing a thesis, and there I have three files, one is main, another one is Chapter and the last one is a.tex. main.tex is using to call the chapter. I have written main algorithm in a.tex. So ...
2
votes
2answers
187 views

Else If is not working on algorithm in algpseudocode

I tried to add \Else in my pseudocode using packages algorithm and algpseudocode but it is not showing and I am getting Missing number, treated as zero. This is my code and the current outcome. \...
0
votes
0answers
25 views

The algorithm does not execute in IEEE transaction template. Please help [duplicate]

\documentclass[journal]{IEEEtran} \usepackage[classicReIm]{kpfonts} \usepackage{booktabs,tabularx,lipsum} \usepackage{longtable} \usepackage{float} \usepackage{graphicx} \usepackage{subfigure} \...
0
votes
2answers
35 views

Lower case “line” when referencing algorithmicx line with cleveref

MWE: \documentclass[12pt]{article} \usepackage{algpseudocode} \usepackage[capitalize]{cleveref} \begin{document} \begin{algorithmic}[1] \State\label{line} Hello World \end{algorithmic} This is a ...
1
vote
1answer
87 views

algorithmicx: More space between lines

My algorithmicx (more concretely: algpseudocode) lines contain quite a lot of sub-/superscripts, which makes them look quite "squeezed" onto each other. How can I have them spaced a little apart ...
2
votes
1answer
60 views

Pseudocode in latex cannot be formated

I´m writting my work and for some reasone my pseudocode in final pdf cannot be formated: Mistake report is this: The code I'm using: \documentclass[11pt,a4paper,openright]{report} \let\openright=\...
0
votes
1answer
53 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{...
1
vote
1answer
29 views

How to ref the counter in the command AlgHeader?

First, a counter AlgCounter is defined. Second, a new command \AlgNo is defined and the counter AlgCounter is used in the definition of \AlgNo. Third, in order to draw three lines of an algorithm, a ...
2
votes
0answers
122 views

writing a data structure in an algorithm [closed]

I am trying to write up a data structure in my algorithm. \documentclass[]{IEEEtran} \usepackage{algorithm,algpseudocode} \begin{document} \begin{algorithm} \caption{Algorithm1} \begin{algorithmic}[...
2
votes
1answer
168 views

Function numbering in algorithms

Algorithms are getting numbered automatically but unable to get same for the functions. In the following example, Algorithms are numbered as Algorithm 1 and Algorithm 2 by themselves but Functions ...
2
votes
1answer
140 views

How to force procedure name to be in small caps

When using algorithm environment: \begin{algorithm}[!t] \caption{Title} \begin{algorithmic}[1] \Procedure{\textsc{Graph}}{$ \alpha, \beta $} \State ... \EndProcedure \end{...
1
vote
1answer
339 views

Add List of Algorithms in thesis's Table of content

I am using template provided by our university for my thesis link. I have started using latex recently. I tried different solutions from google for adding list of Algorithm, but none worked for me. ...
0
votes
1answer
212 views

Algorithm packages don't work

I am currently writing an essay and I'd like to insert some kind of code. This is my first time trying such a thing so I'm very unexperienced. I found the packages algorithm, algorithmicx, ...
1
vote
1answer
44 views

Centering a custom-environment defined for width adjustment of algorithms

I am using the algpseudocode environment provided by the algorithmicx package in my thesis. I am wrapping the pseudocode inside the algorithmic environment provided by the algorithms package. The ...
0
votes
0answers
306 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 ...
0
votes
1answer
1k views

There is always a zero at the end of my algorithm [duplicate]

There is my source code. \documentclass[conference]{IEEEtran} \usepackage{algorithm} \usepackage{algorithmic} %\usepackage{algpseudocode} \usepackage[algcompatible]{algpseudocode} \usepackage{...
2
votes
1answer
599 views

Missing number, treated as zero when using \If without \EndIf with algpseudocode

I'm trying to typeset a pseudo code with an \If block without the matching \EndIf using algpseudocode. This is my MWE: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{geometry} \...
3
votes
1answer
133 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 ...
0
votes
2answers
62 views

How to have one code to be typeset both as final and as source code [duplicate]

I'm very limited in writing Latex code and I could not find how to solve my problem searching in the forum ou googling around. My problem: I have to write a document with many algorithms and show ...
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
1answer
192 views

Change style of Pseudo Code

how can i make if , while , else , in pesudo code writing with bold and all capital letters like IF WHILE and not as they defined in default in the package \begin{document} \centerline {\Large {\"U}...
2
votes
1answer
574 views

Alignment of line numbers

I am brand new to LaTeX, and am trying to create a short pseudo code section for a paper. The current issue I'm facing is that line numbers (and vertical alignment in general) is off for many lines. ...
2
votes
2answers
215 views

Nested Algorithms Markup with IEEEtran

I'am using the IEEEtran class when writing an article and I want to include an algorithm with some (multiple-)nested functions. Including the algorithm in the IEEEtran class was confusing at first but ...
3
votes
2answers
786 views

New algorithm environment with a separate counter

I am trying to define a new environment called protocol, which is the same as the algorithm environment, except for the title and counter. I used this as my guideline. However, it does not reset the ...
1
vote
1answer
178 views

Fix the vertical alignment inside Algorithm Pseudocode

I am new to Latex and I am writing the pseudocode of an algorithm in Latex. For each step of the algorithm I want to provide a description of that step. I use the following code: \documentclass{...
2
votes
1answer
592 views

standalone does not work with algorithms

I have a series of algorithms for which I would like to create independent pdf files I can add later. I tried to use the standalone package but somehow these are not compatible. This is the MWE: \...
1
vote
0answers
44 views

algorithm, algorithmic split code into parts with [H] remove line when no caption is set [duplicate]

I'm using algorithm and algpseudocode and want to split up the algorithm. Therefore I want the code parts to be at the position I'm explaining them, so I use the floating [H]. But the code starts with ...
1
vote
1answer
2k 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 ...
0
votes
1answer
1k views

Alignment of multlined equations in algorithm

I would like to align the multline equation within algorithm environment such that it fits the current block (aligned with the beginning of the line # Solve the equation: in the example bellow): The ...
0
votes
1answer
2k views

How to use the algorithmic package with IEEEtran class?

I found this question explaining how to use algorithm2e package with IEEEtran class. However I would like to be able also to use the algorithmic package. For the following code: \begin{figure}[!t] \...
1
vote
2answers
320 views

Box around lines of algpseudocode with \tikzmark

I use the algpseudocode package to write code and I would like to draw boxes around some lines of the code. This answer gets pretty close to what I want. The idea is to mark the first and last line of ...
5
votes
1answer
821 views

indentation scope lines broken in algpseudocode

I am trying to provide a vertical line that shows the indentation in an algorithm. I'm following this answer, but when I add some math that is higher than the line height, the lines get broken. This ...
1
vote
0answers
800 views

! Missing \endcsname inserted in \end {algorithmic} [closed]

I have the following code: \documentclass{AIAA} \begin{algorithm} \caption{my algorithm}\label{myalg} \begin{algorithmic}[1] \State Inputs: $N_s$, $\Delta t$, ...