
Estou tentando numerar os dois algorithm
ambientes e colocar algum espaço entre eles, mas estou apenas obtendo a numeração ao lado? Como posso conseguir obter o número antes dos algoritmos?
Código:
\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}
Responder1
Coloque a \mbox{}
antes dos ambientes do algoritmo (depois de cada \item
)
O itemize
ambiente deve ser substituído por enumerate
which fornece a numeração em vez de \item[1.]
etc.
\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}