
Ich versuche, die beiden algorithm
Umgebungen zu nummerieren und etwas Abstand zwischen ihnen zu lassen, aber ich erhalte nur die Nummerierung an der Seite. Wie kann ich es schaffen, die Nummer vor den Algorithmen zu erhalten?
Code:
\documentclass{article}
\usepackage{german,t1enc}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\usepackage{amsmath}
\renewcommand{\baselinestretch}{1.5}
\usepackage{mathtools}
\begin{document}
\begin{itemize}
\item[1.]
\begin{algorithm}[H]
\SetAlgoLined
\KwData{2 graphs T and \'{T} with nodes V and \'{V}.}
\KwResult{Find whether T and \'{T} are isomorph.}
function(T, \'{T}) \\
\Indp Find bijection of $\forall v \in V$ with $v_1, v_2 \dots , v_k$ in T so that $\pi(v)$ has the following childern $\pi(v_1), \pi(v_2), \dots, \pi(v_n)$ in \'{T}; \\
\If{the bijection is permutation}{
T and \'{T} are isomorph;
}
\end{algorithm}
\item[2.]
\begin{algorithm}[H]
\SetAlgoLined
\KwData{2 graphs T and \'{T} with nodes V and \'{V}.}
\KwResult{Find whether T and \'{T} are isomorph.}
function(T, \'{T}) \\
\Indp Find bijection of $\forall v \in V$ with $v_1, v_2 \dots , v_k$ in T so that $\pi(v)$ has the following childern $\pi(v_1), \pi(v_2), \dots, \pi(v_n)$ in \'{T}; \\
\If{the bijection is permutation}{
T and \'{T} are isomorph;
}
\end{algorithm}
\end{itemize}
\end{document}
Antwort1
Platzieren Sie ein \mbox{}
vor den Algorithmusumgebungen (nach jedem \item
)
Die Umgebung sollte durch „die die Nummerierung bereitstellt“ anstelle von „usw.“ itemize
ersetzt werden .enumerate
\item[1.]
\documentclass{article}
%\usepackage{german,t1enc} % Is this needed?
\usepackage{enumitem}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\usepackage{amsmath}
\renewcommand{\baselinestretch}{1.5}
\usepackage{mathtools}
\begin{document}
\begin{enumerate}
\item \mbox{}
\begin{algorithm}[H]
\SetAlgoLined
\KwData{2 graphs T and \'{T} with nodes V and \'{V}.}
\KwResult{Find whether T and \'{T} are isomorph.}
function(T, \'{T}) \\
\Indp Find bijection of $\forall v \in V$ with $v_1, v_2 \dots , v_k$ in T so that $\pi(v)$ has the following childern $\pi(v_1), \pi(v_2), \dots, \pi(v_n)$ in \'{T}; \\
\If{the bijection is permutation}{
T and \'{T} are isomorph;
}
\end{algorithm}
\item \mbox{}
\begin{algorithm}[H]
\SetAlgoLined
\KwData{2 graphs T and \'{T} with nodes V and \'{V}.}
\KwResult{Find whether T and \'{T} are isomorph.}
function(T, \'{T}) \\
\Indp Find bijection of $\forall v \in V$ with $v_1, v_2 \dots , v_k$ in T so that $\pi(v)$ has the following childern $\pi(v_1), \pi(v_2), \dots, \pi(v_n)$ in \'{T}; \\
\If{the bijection is permutation}{
T and \'{T} are isomorph;
}
\end{algorithm}
\end{enumerate}
\end{document}