Graphics, Figures & TablesDouble Top-line in Algorithm

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Gundelund
Posts: 2
Joined: Wed Mar 21, 2012 12:29 pm

Double Top-line in Algorithm

Post by Gundelund »

Hey LaTeX gurus,

I have a problem with the algorithm environment, when i set it's position with the [H]. When I do that, I get a double line above the algorithm instead of the standard single line. Can you explain me why this is happening? My algorithm look like this:

Code: Select all

\begin{algorithm}[H]
\caption{Dijkstra's Algorithm}
\begin{algorithmic}[noend]
\Procedure{Dijkstra}{$G$: weighted connected simple graph, with all weights positive}
\State \{$G$ has vertrices $a=v_0, v_1,\dots , v_n=z$ and weights \\ \qquad \qquad $w(v_i, v_j)$ where $w(v_i, v_j)=\infty$ if $\{v_i, v_j\}$ is not an edge in $G$\}
\For{$i:=1$}{\;$n$}	
	\State $L(v_i):=\infty$
\EndFor
\State $L(a):=0$
\State $S:=\emptyset$
\State \{the labels are now initialized so that the label of $a$ is 0 and all other \\ \qquad \qquad labels $\infty$, and $S$ is the empty set\}
\While{$z \notin S$}
\Begin
	\State $u:=$ a vertex not in $S$ with $L(u)$ minimal
	\State $S:=S\cup \{u\}$
		\ForAll{vertices $v$ not is $S$}
			\If{$L(u)+w(u, v)<L(v)$}{$L(v):=L(u)+w(u,v)$}
			\EndIf	
			\EndFor
		\State\{this adds a vertex to $S$ with minimal label and updates the \\ \qquad \qquad labels of vertices not in $S$\}
\End
\EndWhile
\State \{$location$ is the subscript of the term that equals $x$, or is 0 if $x$ is not \\ \qquad \qquadfound\}
\EndProcedure
\end{algorithmic}
\end{algorithm}
I'm working in a memoir class LaTeX document. Hope you can help.
Last edited by localghost on Wed Mar 21, 2012 1:01 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

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Double Top-line in Algorithm

Post by localghost »

For an adequate problem description submit a proper minimal example that clearly reproduces the misbehaviour and is compilable out of the box. Due to missing information an explanation is not possible at the moment.


Thorsten
Post Reply