Hi there,
I'd highly appreciate it, if somebody can help me on this one.
I used the algorithm/algorithmic package for a pseudo code.
The issue is that the pseudo code is longer than one page.
Now I get an LaTeX warning: Float too large for page...
I see algorithm uses float..
I wasn't able to find anything online that would address this problem.
I get a page break in the pseudo code when I use algorithmic without algorithm, but than
I have no caption/reference.
Is there any way to get an page break within algorithm? or some kind of float break?
thx
MacCowboy
Document Classes ⇒ algorithm / algorithmic: pagebreak
NEW: TikZ book now 40% off at Amazon.com for a short time.
- countbela666
- Posts: 64
- Joined: Thu Apr 26, 2007 2:44 pm
algorithm / algorithmic: pagebreak
Hi,
in the following minimum working example I define a new environment breakalgo which takes one optional and one mandatory argument. Argument one is the label and argument two the caption. But beware, it is a quite dirty hack and has not been tested profoundly.Regards
Marcel
in the following minimum working example I define a new environment breakalgo which takes one optional and one mandatory argument. Argument one is the label and argument two the caption. But beware, it is a quite dirty hack and has not been tested profoundly.
Code: Select all
\documentclass[english]{article}
\usepackage{%
babel,
blindtext,
algorithmic,
algorithm,
caption
}
\def\source{%
\REQUIRE $n \geq 0$
\ENSURE $y = x^n$
\STATE $y \Leftarrow 1$
\STATE $X \Leftarrow x$
\STATE $N \Leftarrow n$
\WHILE{$N \neq 0$}
\IF{$N$ is even}
\STATE $X \Leftarrow X \times X$
\STATE $N \Leftarrow N / 2$
\ELSE[$N$ is odd]
\STATE $y \Leftarrow y \times X$
\STATE $N \Leftarrow N - 1$
\ENDIF
\ENDWHILE
}
\makeatletter
\newenvironment{breakalgo}[2][alg:\thealgorithm]{%
\def\@fs@cfont{\bfseries}%
\let\@fs@capt\relax%
\par\noindent%
\medskip%
\rule{\linewidth}{.8pt}%
\vspace{-3pt}%
\captionof{algorithm}{#2}\label{#1}%
\vspace{-1.7\baselineskip}%
\noindent\rule{\linewidth}{.4pt}%
\vspace{-1.3\baselineskip}%
}{%
\vspace{-.75\baselineskip}%
\rule{\linewidth}{.4pt}%
\medskip%
}
\makeatother
\begin{document}
\listofalgorithms
\blindtext
\begin{algorithm}
\caption{Some clever name}
\begin{algorithmic}
\source
\end{algorithmic}
\end{algorithm}
\blindtext
\begin{breakalgo}{Another clever name}%
\begin{algorithmic}
\source
\end{algorithmic}
\end{breakalgo}
\blindtext
\end{document}
Marcel
Listen to me children of the night, beyond the doors of darkness you will find
a thousand worlds for you to see here, take my hand and follow me...
a thousand worlds for you to see here, take my hand and follow me...