如何在 LaTex 的两列页面中添加可分解算法?

如何在 LaTex 的两列页面中添加可分解算法?

我正在使用《计算机科学前沿》期刊的模板来格式化我的研究论文。该模板可在以下链接中找到。

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

这是两列文档,我必须添加一些伪代码。有些伪代码很长,因此应该将它们扩展到第二列。我面临的问题是算法被裁剪,没有出现在第二列中。我正在使用可破坏算法但它不起作用。屏幕截图附在下面。正如您所见,算法没有出现在第二列上,它被裁剪,只显示适合页面的部分。 算法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}

相关内容