Math & ScienceAfter the pseudocode =0 is added

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
tommy33
Posts: 1
Joined: Thu Jul 24, 2014 6:24 pm

After the pseudocode =0 is added

Post by tommy33 »

Hello everyone,

I have some problems with using pseudocode in Latex. After I build the file =0 is added at the end of the file. Any suggestion how can I fix that?
Thank you for your answer in advance.

\usepackage{algorithm,algcompatible}
\usepackage{algpseudocode}
\begin{algorithm}
\caption{getInitialItems}\label{IniA}

\State \textbf{Input parameters}
\State ComSub: \textit{matrix of all videos in our subset of LDOD-CoMoDa research dataset (videos ID and coordiantes)}
\State n: \textit{number of items that are being looking for}
\State \textbf{Output parameters}
\State nIDs: \textit{vector of IDs of the selected items}\\
\vspace{0.1cm}
\begin{algorithmic}[1]
\State Randomly select n videos from the ComSub subset (using function \textit{rand} in Matlab).
\end{algorithmic}
\end{algorithm}


The output is:

.
.
1: Randomly select n videos from the ComSub subset (using function rand
in Matlab). =0

=0 is added at the end.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

After the pseudocode =0 is added

Post by Stefan Kottwitz »

Hi Tommy,

welcome to the forum!

It seems that there' a compatibility issue with all those algorithm packages together.

Try this, using caption instead of algorithm for the algorithm floats with captions:

Code: Select all

\documentclass{article} 
%\usepackage{algorithm,algcompatible}
\usepackage{algpseudocode}
\usepackage{caption}
\DeclareCaptionType{algorithm}
\begin{document}
\begin{algorithm}
\caption{getInitialItems}\label{IniA}
\begin{algorithmic}[1]
\State \textbf{Input parameters}
\State ComSub: \textit{matrix of all videos in our subset of LDOD-CoMoDa research dataset (videos ID and coordiantes)}
\State n: \textit{number of items that are being looking for}
\State \textbf{Output parameters}
\State nIDs: \textit{vector of IDs of the selected items}\\
\State Randomly select n videos from the ComSub subset (using function \textit{rand} in Matlab).
\end{algorithmic}
\end{algorithm} 
\end{document}
algorithm.png
algorithm.png (16.34 KiB) Viewed 11539 times
Stefan
LaTeX.org admin
Post Reply