1
    %%%% ijcai21.tex

\typeout{IJCAI--21 Instructions for Authors}

% These are the instructions for authors for IJCAI-21.

\documentclass{article}
\pdfpagewidth=8.5in
\pdfpageheight=11in
% The file ijcai21.sty is NOT the same than previous years'
\usepackage{ijcai21}

% Use the postscript times font!
\usepackage{times}
\usepackage{soul}
\usepackage{url}
\usepackage[hidelinks]{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[small]{caption}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{booktabs}
\usepackage{algorithm}
\usepackage{algorithmic}
\urlstyle{same}

\newtheorem{example}{Example}
\newtheorem{theorem}{Theorem}

\pdfinfo{
/TemplateVersion (IJCAI.2021.0)
}

\title{IJCAI--21 Formatting Instructions}

% Single author syntax
\author{
}


\begin{document}

\maketitle

\begin{algorithm}[tb]
\caption{Example algorithm}
\label{alg:algorithm}
\textbf{Input}: Your algorithm's input\\
\textbf{Parameter}: Optional list of parameters\\
\textbf{Output}: Your algorithm's output
\begin{algorithmic}[1] %[1] enables line numbers
\STATE Let $t=0$.
\WHILE{condition}
\STATE Do some action.
\IF {conditional}
\STATE Perform task A.
\ELSE
\STATE Perform task B.
\ENDIF
\ENDWHILE
\STATE \textbf{return} solution
\end{algorithmic}
\end{algorithm}


\end{document}

All I want to use the procedure contains input and the three statements.

2
  • 1
    Welcome to TeX.SX! Can you explain what's going wrong or what you want to achieve? When I download ijcai21.sty from here and compile your file, everything works as expected.
    – gernot
    Dec 29 '20 at 23:47
  • @gernot it is not working, i want to start my code with a procedure Dec 30 '20 at 9:52
0

If you want/have to use the algorithmic package, you have to define the procedure statement yourself. Put the following code into your preamble.

\usepackage{algorithmic}
\newcommand\algorithmicprocedure{\textbf{procedure}}
\newcommand{\algorithmicendprocedure}{\algorithmicend\ \algorithmicprocedure}
\makeatletter
\newcommand\PROCEDURE[3][default]{%
  \ALC@it
  \algorithmicprocedure\ \textsc{#2}(#3)%
  \ALC@com{#1}%
  \begin{ALC@prc}%
}
\newcommand\ENDPROCEDURE{%
  \end{ALC@prc}%
  \ifthenelse{\boolean{ALC@noend}}{}{%
    \ALC@it\algorithmicendprocedure
  }%
}
\newenvironment{ALC@prc}{\begin{ALC@g}}{\end{ALC@g}}
\makeatother

Use it as follows:

\PROCEDURE[optional comment]{proc name}{arguments}
...
\ENDPROCEDURE

If you use the algpseudocode package (which is based on the algorithmicx package), procedures are predefined.

Package "algorithmic"

enter image description here

\documentclass{article}
\usepackage{algorithmic}
\newcommand\algorithmicprocedure{\textbf{procedure}}
\newcommand{\algorithmicendprocedure}{\algorithmicend\ \algorithmicprocedure}
\makeatletter
\newcommand\PROCEDURE[3][default]{%
  \ALC@it
  \algorithmicprocedure\ \textsc{#2}(#3)%
  \ALC@com{#1}%
  \begin{ALC@prc}%
}
\newcommand\ENDPROCEDURE{%
  \end{ALC@prc}%
  \ifthenelse{\boolean{ALC@noend}}{}{%
    \ALC@it\algorithmicendprocedure
  }%
}
\newenvironment{ALC@prc}{\begin{ALC@g}}{\end{ALC@g}}
\makeatother
\begin{document}
\begin{flushleft}
\textbf{Input}: Your algorithm's input\\
\textbf{Parameter}: Optional list of parameters\\
\textbf{Output}: Your algorithm's output
\begin{algorithmic}[1] %[1] enables line numbers
\PROCEDURE[some comment]{MyProc}{$a,b\colon \mathrm{int}$}
\STATE Let $t=0$.
\WHILE{condition}
\STATE Do some action.
\IF {conditional}
\STATE Perform task A.
\ELSE
\STATE Perform task B.
\ENDIF
\ENDWHILE
\STATE \textbf{return} solution
\ENDPROCEDURE
\end{algorithmic}
\end{flushleft}
\end{document}

Package "algpseudocode"

enter image description here

\documentclass{article}
\usepackage{algpseudocode}
\begin{document}
\begin{flushleft}
\textbf{Input}: Your algorithm's input\\
\textbf{Parameter}: Optional list of parameters\\
\textbf{Output}: Your algorithm's output
\begin{algorithmic}[1] %[1] enables line numbers
\Procedure{MyProc}{$a,b\colon \mathrm{int}$}\Comment{some comment}
\State Let $t=0$.
\While{condition}
\State Do some action.
\If{conditional}
\State Perform task A.
\Else
\State Perform task B.
\EndIf
\EndWhile
\State \textbf{return} solution
\EndProcedure
\end{algorithmic}
\end{flushleft}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.