I am using the method here to generate my pseudocode, however my code is long and after running the tex file, instead of breaking the code box into two parts, it moves the whole code to the next page. I want to know how can I break it? Here is the code:
\documentclass[11pt,bezier]{article}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{amssymb,amsfonts,xspace}
\usepackage{amsmath}
\usepackage{algorithm,fontspec}
\usepackage[noend]{algpseudocode}
\renewcommand{\baselinestretch}{1.1}
\textwidth = 15 cm \textheight = 20 cm \oddsidemargin =0.7 cm
\evensidemargin = 0 cm \topmargin = -0.2 cm
\parskip = 2 mm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*\Let[2]{\State #1 $\gets$ #2}
\algrenewcommand\alglinenumber[1]{
{\sf\footnotesize\addfontfeatures{Colour=888888,Numbers=Monospaced}#1}}
\algrenewcommand\algorithmicrequire{\textbf{Precondition:}}
\algrenewcommand\algorithmicensure{\textbf{Postcondition:}}
\begin{document}
\begin{algorithm}
\caption{Counting mismatches between two packed DNA strings
\label{alg:packed-dna-hamming}}
\begin{algorithmic}[1]
\Require{$x$ and $y$ are packed DNA strings of equal length $n$}
\Statex
\Function{Distance}{$x, y$}
\Let{$z$}{$x \oplus y$} \Comment{$\oplus$: bitwise exclusive-or}
\Let{$\delta$}{$0$}
\For{$i \gets 1 \textrm{ to } n$}
\If{$z_i \neq 0$}
\Let{$\delta$}{$\delta + 1$}
\EndIf
\EndFor
\State \Return{$\delta$}
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{document}
P.S.I removed my text before it, which results in the shift.
algorithm
environment is likefigure
ortable
, so it can't be split across pages.