0

I am using the template of Frontiers of computer Science Journal to format my research paper. The template can be found in the link below.

https://journal.hep.com.cn/fcs/EN/column/column11258.shtml

This is two column document and I have to add some pseudocodes. Some pseudocodes are long therefore, they should be extended to second column. The issue I am facing is the algorithm is cropped and is not coming in second column. I am using breakablealgorithm but it is not working. Screen shot is attached below. As you can see the algorithm is not coming on second column, it is cropped and only part that fits in the page appears. Algorithm PDF

\documentclass{fcs}
\usepackage{bm}


\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{lmodern}
\usepackage{algorithm,algpseudocode}
\usepackage{multicol}

\makeatletter
\algrenewcommand\ALG@beginalgorithmic{\footnotesize}
\algrenewcommand\algorithmiccomment[2][\scriptsize]{{#1\hfill\(\triangleright\) #2}}
\makeatother

\makeatletter
\newenvironment{breakablealgorithm}
  {% \begin{breakablealgorithm}
   \begin{flushleft}
     \refstepcounter{algorithm}% New algorithm
     \hrule height.8pt depth0pt \kern2pt% \@fs@pre for \@fs@ruled
     \renewcommand{\caption}[2][\relax]{% Make a new \caption
       {\raggedright\textbf{\fname@algorithm~\thealgorithm} ##2\par}%
       \ifx\relax##1\relax % #1 is \relax
         \addcontentsline{loa}{algorithm}{\protect\numberline{\thealgorithm}##2}%
       \else % #1 is not \relax
         \addcontentsline{loa}{algorithm}{\protect\numberline{\thealgorithm}##1}%
       \fi
       \kern2pt\hrule\kern2pt
     }
  }{% \end{breakablealgorithm}
     \kern2pt\hrule\relax% \@fs@post for \@fs@ruled
   \end{flushleft}
  }
\makeatother


\algnewcommand{\algorithmicforeach}{\textbf{for}}
\algdef{SE}[FOR]{ForEach}{EndForEach}[1]
  {\algorithmicforeach\ #1\ \algorithmicdo}% \ForEach{#1}
  {\algorithmicend\ \algorithmicforeach}% \EndForEach

\algnewcommand{\algorithmicdowhile}{\textbf{while}}
\algdef{SE}[While]{While}{EndWhile}[1]
  {\algorithmicdowhile\ #1\ \algorithmicdo}% \While{#1}
  {\algorithmicend\ \algorithmicdowhile}% \End While



\usepackage[hyphens, allowmove]{url} %
\makeatletter \g@addto@macro\UrlSpecials{\do\!{\newline}}\makeatother

\urlstyle{same}

\volumn{ }
\doi{ }
\articletype{REVIEW~ARTICLE}
\copynote{{\copyright} Higher Education Press and Springer-Verlag Berlin Heidelberg 2012}
\ratime{Received month dd, yyyy; accepted month dd, yyyy}
\email{$\times\times\times\times@\times\times\times.\times\times\times$}
%% Title
\title{$\bm{Frontiers~ of~ Computer~ Science}$\\[2mm] Instruction for authors}
%% Authors
\author{Firstname LASTNAME \xff $^{1,2}$}
%% Addresses of authors
\address{{1\quad Higher Education Press, Beijing 100029, China}\\
{2\quad Academic Journal Division, Beijing 100029, China}}

%% Running head
\markboth{Front. Comput. Sci.}{Firstname LASTNAME: please insert running head here}

\begin{document}
\maketitle
\setcounter{page}{1}
\setlength{\baselineskip}{14pt}

\begin{abstract}
 A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
Frontiers of Computer Science is an international
peer-reviewed academic journal sponsored by the Ministry of
Education of China. The journal is jointly published by Higher
Education Press of China and Springer on a bimonthly basis in
English. Online versions are available through both
Frontiers of Computer Science is an international
peer-reviewed academic journal sponsored by the Ministry of
Education of China. The journal is jointly published by Higher
Education Press of China and Springer on a bimonthly basis in
English. Online versions are available through both
Education Press of China and Springer on a bimonthly basis.
 A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-rev.
abstract
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
 Frontiers of Computer Science is an international
peer-rev.
abstract
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
 Frontiers of Computer Science is an international
peer-rev.
abstract
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
 Frontiers of Computer Science is an international
peer-rev.
abstract
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
 Frontiers of Computer Science is an international
peer-rev.
abstract
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
 Frontiers of Computer Science is an international
peer-rev.
abstract
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
A short abstract of up to 300 words written in one paragraph
 Frontiers of Computer Science is an international
peer-revi
\end{abstract}

\Keywords{Up to 8 words separated by commas.}

\section{Introduction}

\noindent 

Education of China. The journal is jointly published by Higher
Education Press of China and Springer on a bimonthly basis in
English. Online versions are available through both
Education Press of China and Springer on a bimonthly 


\begin{algorithm}
\caption{Test Algo}\label{Test}
\hspace*{\algorithmicindent} \textbf{Input} $    \textit{\textbf{ R}},\textit{\textbf{U}} $
\newline
 \hspace*{\algorithmicindent} \textbf{Output} $X$
\begin{breakablealgorithm}
\begin{algorithmic}[1]
\Procedure {$\emph{Test\_Algo}$} {$\textit{\textbf{R,D}}$}

\State $\textit{max\_idx} \gets \textit{Max index of \textbf{R}}$

\ForEach{$i \in \textbf{range}(0,\textit{max\_idx}-1)$}%
\ForEach{$j \in \textbf{range}(i+1,\textit{max\_idx}-1)$}%

\State $\textit{a} \gets  \textbf{\textit{R}}[i]$  \Comment{\parbox[t]{.40\linewidth}{Comment1}}
\State $\textit{b} \gets  \textbf{\textit{R}}[i+1]$ 
\State $\textit{c} \gets  \textbf{\textit{R}}[j]$ 
\State $\textit{d} \gets  \textbf{\textit{R}}[j+1]$ 
\newline
\State $\textit{old\_vlaue} \gets  \textbf{\textit{D}}[a,b]+\textbf{\textit{D}}[c,d]$ \Comment{\parbox[t]{.40\linewidth}{Old distance}}

\State $\textit{new\_vlaue} \gets  \textbf{\textit{D}}[a,c]+\textbf{\textit{D}}[b,d]$ \Comment{\parbox[t]{.40\linewidth}{New distance after swap}}
\newline
\If {$\textit{new\_vlaue} < \textit{old\_vlaue} $}  \Comment{\parbox[t]{.40\linewidth}{Check if there is improvement.}}
\State $\textbf{\textit{R}} \gets \textit{updated }$ 
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State $\textbf{\textit{R}} \gets \textit{updated }$ 
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State $\textbf{\textit{R}} \gets \textit{updated }$ 
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State $\textbf{\textit{R}} \gets \textit{updated }$ 
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State $\textbf{\textit{R}} \gets \textit{updated }$ 
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State $\textbf{\textit{R}} \gets \textit{updated }$ 
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State $\textbf{\textit{R}} \gets \textit{updated }$ 
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning value.}}
\EndIf                   
\EndForEach
\EndForEach
\newline
\State \Return $\textbf{\textit{R}}$ \Comment{\parbox[t]{.40\linewidth}{Returning \textbf{\textit{R}} without improvement.}}
\EndProcedure
\end{algorithmic}
\end{breakablealgorithm}
\end{algorithm}


\end{document}
3
  • Can you please add a screenshot, showing your problem? Then not everybody needs to download and "install" said template, while experiened members may have a valid solution just from looking at it. Thanks
    – MS-SPO
    Jul 31 at 12:42
  • Thanks for your feedback. I have added the screenshot.
    – Ayaz49
    Jul 31 at 14:02
  • The only thing breakablealgorithm does is play with the loa. I've never heard of a breakable algorithm envrionment. The best you can do is make copies and crop. See tex.stackexchange.com/questions/204703/… Aug 1 at 1:40

Your Answer

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

Browse other questions tagged or ask your own question.