Math & Sciencealgorithms | Page Break for Algorithm

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
sebkro
Posts: 1
Joined: Fri Jun 01, 2012 11:16 pm

algorithms | Page Break for Algorithm

Post by sebkro »

Hello,

I have written the following algorithm but unfortunately LaTeX puts it in the center of a new page and leaves the rest of this page completely blank even though there is still quite a lot of space left on the page.

Code: Select all

\begin{algorithm}
\caption{Solve Query}
\begin{algorithmic}[1]
	\Require \hspace*{1mm}
		\newline \(q_{init}\): robot's current configuration
		\newline \(q_{goal}\): destination configuration
		\newline \textit{k}: number of closest neighbours being examined for each configuration
		\newline \textit{G} = (\textit{V},\textit{E}) is the previously computed roadmap
	\Ensure \hspace*{1mm}
		\newline P is a path from \(q_{init}\) to \(q_{goal}\) or NIL if such a path does not exist
		\newline
		
	\State \textit{\(N_{q_{init}}\)} \(\leftarrow\) the \textit{k} closest neighbours of \textit{\(q_{init}\)} from \textit{V} according to \textit{dist}
	\State \textit{\(N_{q_{goal}}\)} \(\leftarrow\) the \textit{k} closest neighbours of \textit{\(q_{goal}\)} from \textit{V} according to \textit{dist}
	\ForAll{\(q' \in N_{q_{init}}\)}
		\If{\textit{\(\Delta\)}(\textit{\(q_{init}\)}, \textit{q'}) \(\neq\) NIL}
			\State \textit{E} \(\leftarrow\) (\textit{\(q_{init}\)}, \textit{q'}) \(\cup\) \textit{E}
			\State break
		\EndIf
	\EndFor
	\ForAll{\(q' \in N_{q_{goal}}\)}
		\If{\textit{\(\Delta\)}(\textit{\(q_{goal}\)}, \textit{q'}) \(\neq\) NIL}
			\State \textit{E} \(\leftarrow\) (\textit{\(q_{goal}\)}, \textit{q'}) \(\cup\) \textit{E}
			\State break
		\EndIf
	\EndFor
	\State \textit{P} \(\leftarrow\) shortest path(\textit{\(q_{init}\)}, \textit{\(q_{goal}\)}, \textit{G})
	\State \Return P
\end{algorithmic}
\end{algorithm}
So i want the rest of the page to be filled with that text. Right before and after the algorithm there is just plain text without line breaks or anything so that cannot be the problem. I am completely new to LaTeX so I hope someone can give me hint.


Thanks a lot,
Sebastian
Last edited by localghost on Sat Jun 02, 2012 1:29 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Post Reply